This commit is contained in:
Andreas Österreicher
2011-02-22 09:04:25 +00:00
parent b61d510ac6
commit eab9fb1a2a
4 changed files with 179 additions and 10 deletions
+43
View File
@@ -953,5 +953,48 @@ class benutzerberechtigung extends basis_db
return false;
}
}
public function getKostenstelleUser($kostenstelle_id)
{
$qry = "SELECT
distinct uid, a.art,
CASE WHEN a.berechtigung_kurzbz is null
THEN tbl_rolleberechtigung.berechtigung_kurzbz
ELSE a.berechtigung_kurzbz END as berechtigung_kurzbz
FROM
(
SELECT * FROM system.tbl_benutzerrolle WHERE kostenstelle_id='".addslashes($kostenstelle_id)."'
UNION
SELECT * FROM system.tbl_benutzerrolle WHERE
oe_kurzbz = (SELECT oe_kurzbz FROM wawi.tbl_kostenstelle WHERE kostenstelle_id='".addslashes($kostenstelle_id)."')
OR oe_kurzbz IN(
WITH RECURSIVE oes(oe_parent_kurzbz) as
(
SELECT oe_parent_kurzbz FROM public.tbl_organisationseinheit
WHERE oe_kurzbz=(SELECT oe_kurzbz FROM wawi.tbl_kostenstelle WHERE kostenstelle_id='".addslashes($kostenstelle_id)."')
UNION ALL
SELECT o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
WHERE o.oe_kurzbz=oes.oe_parent_kurzbz
)
SELECT oe_parent_kurzbz
FROM oes)
) as a
LEFT JOIN system.tbl_rolleberechtigung USING(rolle_kurzbz)
WHERE (start is null OR start<=now()) AND (ende is null OR ende>=now()) AND negativ=false";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new benutzerberechtigung();
$obj->berechtigung_kurzbz = $row->berechtigung_kurzbz;
$obj->uid = $row->uid;
$obj->art = $row->art;
$this->berechtigungen[] = $obj;
}
}
}
}
?>
+26 -5
View File
@@ -360,15 +360,36 @@ class firma extends basis_db
*/
public function getAll($firma_search = null)
{
$qry = "SElECT * FROM public.tbl_firma";
if (!empty($firma_search))
{
$qry.= " WHERE ";
$matchcode=mb_strtoupper(addslashes(str_replace(array('<','>',' ',';','*','_','-',',',"'",'"'),"%",$firma_search)));
$qry.=" UPPER(trim(public.tbl_firma.name)) like '%".$matchcode."%'";
$matchcode=mb_strtoupper(addslashes(str_replace(array('<','>',' ',';','*','_','-',',',"'",'"'),"%",$firma_search)));
//Zuerst werden die Ergebnisse geliefert, die mit $filter_search beginnen
//danach jene Ergebnisse bei denen $filter_search innerhalb des Namens vorkommt
$qry = "
SELECT
firma_id, name, anmerkung, firmentyp_kurzbz, updateamum, updatevon, insertamum, insertvon,
ext_id, schule, steuernummer, gesperrt, aktiv, finanzamt, '1' as sort
FROM public.tbl_firma
WHERE
UPPER(trim(public.tbl_firma.name)) like '".$matchcode."%'
UNION
SELECT
firma_id, name, anmerkung, firmentyp_kurzbz, updateamum, updatevon, insertamum, insertvon,
ext_id, schule, steuernummer, gesperrt, aktiv, finanzamt, '2' as sort
FROM public.tbl_firma
WHERE
UPPER(trim(public.tbl_firma.name)) like '%".$matchcode."%'
AND UPPER(trim(public.tbl_firma.name)) NOT like '".$matchcode."%'
ORDER BY sort, name, firma_id";
}
else
{
$qry = "SELECT * FROM public.tbl_firma ORDER BY name";
}
$qry.= " ORDER BY NAME";
if($this->db_query($qry))
{
while($row = $this->db_fetch_object())
+5 -1
View File
@@ -67,7 +67,11 @@ $menu=array
'name'=>'Firma', 'link'=>'firma.php', 'target'=>'content','permissions'=>array('wawi/firma'),
'FirmaNeu'=>array('name'=>'Neu', 'link'=>'firma.php?method=new', 'target'=>'content'),
'FirmaSuchen'=>array('name'=>'Suchen', 'link'=>'firma.php', 'target'=>'content'),
)
),
'Berechtigungen'=>array
(
'name'=>'Berechtigungen', 'link'=>'berechtigung.php', 'target'=>'content',
),
),
'Berichte'=> array
(