This commit is contained in:
Andreas Österreicher
2009-07-14 14:21:35 +00:00
parent d60748cdb4
commit e3373aae2f
5 changed files with 48 additions and 11 deletions
@@ -26,7 +26,7 @@ header("Expires Mon, 26 Jul 1997 05:00:00 GMT");
header("Pragma: no-cache");
header("Content-type: application/vnd.mozilla.xul+xml");
require_once('../../vilesci/config.inc.php');
require_once('../../config/vilesci.config.inc.php');
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
echo '<?xul-overlay href="'.APP_ROOT.'content/mitarbeiter/mitarbeiterdetailoverlay.xul.php"?>';
+1
View File
@@ -24,6 +24,7 @@ abstract class db extends basis
abstract function db_affected_rows($result=null);
abstract function db_last_error();
abstract function db_free_result($result=null);
abstract function db_version();
}
require_once(DB_SYSTEM.'.class.php');
-1
View File
@@ -356,7 +356,6 @@ class benutzerberechtigung extends basis_db
WHERE tbl_benutzerfunktion.uid='".addslashes($uid)."'
ORDER BY negativ DESC";
if(!$this->db_query($qry))
{
$this->errormsg='Fehler beim Laden der Berechtigungen';
+41 -9
View File
@@ -155,21 +155,53 @@ class organisationseinheit extends basis_db
{
$childs[] = $oe_kurzbz;
$qry = "SELECT * FROM public.tbl_organisationseinheit WHERE oe_parent_kurzbz = '$oe_kurzbz'";
if($this->db_query($qry))
$dbversion = $this->db_version();
if($dbversion['server']>=8.4)
{
$myresult = $this->db_result;
while($row = $this->db_fetch_object($myresult))
//ab PostgreSQL Version 8.4 wird die Rekursion von der DB aufgeloest
$qry = "
WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
(
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
WHERE oe_kurzbz='".addslashes($oe_kurzbz)."'
UNION ALL
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
WHERE o.oe_parent_kurzbz=oes.oe_kurzbz
)
SELECT oe_kurzbz
FROM oes
GROUP BY oe_kurzbz;";
if($myresult = $this->db_query($qry))
{
$childs = array_merge($childs, $this->getChilds($row->oe_kurzbz));
while($row = $this->db_fetch_object($myresult))
{
$childs[] = $row->oe_kurzbz;
}
}
else
{
$this->errormsg = 'Fehler beim Ermitteln der Childs';
}
return $childs;
}
else
{
$this->errormsg = 'Fehler beim Ermitteln der Childs';
{
//vor 8.4 muss die Rekursion in PHP aufgeloest werden
$qry = "SELECT * FROM public.tbl_organisationseinheit WHERE oe_parent_kurzbz = '$oe_kurzbz'";
if($myresult = $this->db_query($qry))
{
while($row = $this->db_fetch_object($myresult))
{
$childs = array_merge($childs, $this->getChilds($row->oe_kurzbz));
}
}
else
{
$this->errormsg = 'Fehler beim Ermitteln der Childs';
}
return $childs;
}
return array_unique($childs);
}
/**
+5
View File
@@ -133,5 +133,10 @@ class basis_db extends db
return pg_free_result($result);
}
}
function db_version()
{
return pg_version(basis_db::$db_conn);
}
}
?>