SYNC Fachbereich

This commit is contained in:
Rudolf Hangl
2007-01-02 17:00:26 +00:00
parent e26b9a0109
commit d848171f6e
14 changed files with 1032 additions and 18 deletions
@@ -0,0 +1,120 @@
<?php
/* Copyright (C) 2007 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
//*
//* Synchronisiert aufmerksamdurchdatensaetze von FAS DB in PORTAL DB
//*
//*
include('../../../vilesci/config.inc.php');
include('../../../include/aufmerksamdurch.class.php');
$conn=pg_connect(CONN_STRING) or die("Connection zur Portal Datenbank fehlgeschlagen");
$conn_fas=pg_connect(CONN_STRING_FAS) or die("Connection zur FAS Datenbank fehlgeschlagen");
$adress='ruhan@technikum-wien.at';
//$adress='fas_sync@technikum-wien.at';
$error_log='';
$text = '';
$anzahl_quelle=0;
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
function validate($row)
{
}
?>
<html>
<head>
<title>Synchro - FAS -> Portal - Aufmerkamdurch</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
/*************************
* FAS-PORTAL - Synchronisation
*/
$qry = "SELECT * FROM aufmerksamdurch;";
if($result = pg_query($conn_fas, $qry))
{
echo nl2br("Aufmerksamdurch Sync\n-------------------\n");
$anzahl_quelle=pg_num_rows($result);
while($row = pg_fetch_object($result))
{
echo "- ";
ob_flush();
flush();
$error=false;
$aufmerksamdurch =new aufmerksamdurch($conn);
$aufmerksamdurch->aufmerksamdurch_kurzbz =substr($row->name,0,8);
$aufmerksamdurch->beschreibung =$row->name;
$aufmerksamdurch->ext_id =$row->aufmerksamdurch_pk;
//Insert oder Update
$qry3="SELECT aufmerksamdurch_kurzbz FROM tbl_aufmerksamdurch WHERE aufmerksamdurch_kurzbz='".$aufmerksamdurch->aufmerksamdurch_kurzbz."';";
if($result3 = pg_query($conn, $qry3))
{
if(pg_num_rows($result3)>0) //eintrag gefunden
{
if($row3=pg_fetch_object($result3))
{
// update , wenn datensatz bereits vorhanden
$aufmerksamdurch->new=false;
}
}
else
{
// insert, wenn datensatz noch nicht vorhanden
$aufmerksamdurch->new=true;
}
}
If (!$error)
{
if(!$aufmerksamdurch->save())
{
$error_log.=$aufmerksamdurch->errormsg."\n";
$anzahl_fehler++;
}
else
{
$anzahl_eingefuegt++;
}
}
}
}
//echo nl2br($text);
echo nl2br($error_log);
echo nl2br("\nGesamt: $anzahl_quelle / Eingefügt: $anzahl_eingefuegt / Fehler: $anzahl_fehler");
?>
</body>
</html>
@@ -80,21 +80,25 @@ if($result = pg_query($conn_fas, $qry))
$bankverbindung->updatevon ="SYNC";
$bankverbindung->insertvon ="SYNC";
$bankverbindung->ext_id =$row->bankverbindung_pk;
if($row->typ='1')
if($row->typ=='1')
{
$bankverbindung->typ ='p'; //Privatkonto
$bankverbindung->verrechnung =false;
}
if($row->typ='2')
if($row->typ=='2')
{
$bankverbindung->typ ='f'; //Firmenkonto
$bankverbindung->verrechnung =false;
}
if($row->typ='11')
if($row->typ=='11')
{
$bankverbindung->typ ='v'; //Privatverrechnungskonto
$bankverbindung->typ ='p'; //Privatverrechnungskonto
$bankverbindung->verrechnung =true;
}
if($row->typ='12')
if($row->typ=='12')
{
$bankverbindung->typ ='k'; //Firmenverrechnungskonto
$bankverbindung->typ ='f'; //Firmenverrechnungskonto
$bankverbindung->verrechnung =true;
}
//Person_id feststellen
if($row->kontonr!='')
@@ -0,0 +1,126 @@
<?php
/* Copyright (C) 2007 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
//*
//* Synchronisiert Fachbereichsdatensaetze von FAS DB in PORTAL DB
//*
//*
include('../../../vilesci/config.inc.php');
include('../../../include/fachbereich.class.php');
$conn=pg_connect(CONN_STRING) or die("Connection zur Portal Datenbank fehlgeschlagen");
$conn_fas=pg_connect(CONN_STRING_FAS) or die("Connection zur Vilesci Datenbank fehlgeschlagen");
$adress='ruhan@technikum-wien.at';
//$adress='fas_sync@technikum-wien.at';
$error_log='';
$text = '';
$anzahl_quelle=0;
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
function validate($row)
{
}
/*************************
* VILESCI-PORTAL - Synchronisation
*/
//fachbereich
$qry = "SELECT * FROM fachbereich";
if($result = pg_query($conn_fas, $qry))
{
echo nl2br("Fachbereich Sync\n-----------------\n");
$anzahl_quelle=pg_num_rows($result);
while($row = pg_fetch_object($result))
{
$error=false;
$fachbereich = new fachbereich($conn);
$fachbereich->fachbereich_kurzbz ='';
$fachbereich->studiengang_kz ='';
$fachbereich->bezeichnung =$row->name;
$fachbereich->farbe ='';
$fachbereich->ext_id =$row->fachbereich_pk;
$qry = "SELECT * FROM tbl_fachbereich WHERE ext_id='$fachbereich->ext_id'";
if($result1 = pg_query($conn, $qry))
{
if(pg_num_rows($result1)>0) //wenn dieser eintrag schon vorhanden ist
{
if($row1=pg_fetch_object($result1))
{
//Fachbereichsdaten updaten
$fachbereich->fachbereich_kurzbz =$row1->fachbereich_kurzbz;
$fachbereich->studiengang_kz =$row1->studiengang_kz;
$fachbereich->farbe =$row1->farbe;
$fachbereich->new=false;
}
else
{
$error_log.="fachbereich_id von $row->fachbereich_id konnte nicht ermittelt werden\n";
$error=true;
}
}
else
{
//Fachbereich neu anlegen
$fachbereich->new=true;
}
if(!$error)
if(!$fachbereich->save())
{
$error_log.=$fachbereich->errormsg."\n";
$anzahl_fehler++;
}
else
$anzahl_eingefuegt++;
else
$anzahl_fehler++;
}
}
echo nl2br("abgeschlossen\n\n");
}
else
$error_log .= 'Fachbereichsdatensaetze konnten nicht geladen werden';
?>
<html>
<head>
<title>Synchro - Vilesci -> Portal - Fachbereiche</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
//echo nl2br($text);
echo nl2br($error_log);
echo nl2br("\nGesamt: $anzahl_quelle / Eingefügt: $anzahl_eingefuegt / Fehler: $anzahl_fehler");
?>
</body>
</html>
+5 -2
View File
@@ -81,7 +81,7 @@ if($result = pg_query($conn_fas, $qry))
$person->ersatzkennzeichen=$row->ersatzkennzeichen;
$person->familienstand=$row->familienstand;
$person->staatsbuergerschaft=$row->staatsbuergerschaft;
$person->geschlecht=$row->geschlecht;
$person->geschlecht=strtolower($row->geschlecht);
$person->ext_id=$row->person_pk;
$person->aktiv=true;
@@ -105,7 +105,10 @@ if($result = pg_query($conn_fas, $qry))
{
$person->familienstand=='w';
}
if ($person->geschlecht=='')
{
$person->geschlecht='m';
}
$error=false;
$qry="SELECT person_id FROM public.tbl_benutzer WHERE uid='$row->uid'";
if($resultu = pg_query($conn, $qry))
@@ -0,0 +1,166 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
//*
//* Synchronisiert Schlüsseldatensaetze von FAS DB in PORTAL DB
//*
//*
include('../../../vilesci/config.inc.php');
include('../../../include/schluessel.class.php');
$conn=pg_connect(CONN_STRING) or die("Connection zur Portal Datenbank fehlgeschlagen");
$conn_fas=pg_connect(CONN_STRING_FAS) or die("Connection zur FAS Datenbank fehlgeschlagen");
$adress='ruhan@technikum-wien.at';
//$adress='fas_sync@technikum-wien.at';
$error_log='';
$text = '';
$anzahl_quelle=0;
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
function validate($row)
{
}
?>
<html>
<head>
<title>Synchro - FAS -> Portal - Schlüssel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
/*************************
* FAS-PORTAL - Synchronisation
*/
$qry = "SELECT * FROM person_schluessel ORDER BY person_fk;";
if($result = pg_query($conn_fas, $qry))
{
echo nl2br("Schlüssel Sync\n--------------\n");
$anzahl_quelle=pg_num_rows($result);
while($row = pg_fetch_object($result))
{
echo "- ";
ob_flush();
flush();
$error=false;
$schluessel =new schluessel($conn);
$schluessel->person_id ='';
$schluessel->schluesseltyp ='';
$schluessel->nummer =$row->nummer;
$schluessel->kaution =$row->betrag;
$schluessel->ausgegebenam =date('Y-m-d',strtotime(strftime($row->verliehenam)));
$schluessel->updatevon ="SYNC";
$schluessel->insertvon ="SYNC";
$schluessel->ext_id =$row->schluessel_fk;
//Person_id feststellen
$qry1="SELECT person_portal FROM public.tbl_syncperson WHERE person_fas=".$row->person_fk.";";
if($result1 = pg_query($conn, $qry1))
{
if(pg_num_rows($result1)>0) //eintrag gefunden
{
if($row1=pg_fetch_object($result1))
{
$schluessel->person_id=$row1->person_portal;
//Schlüsseltyp feststellen
$qry2="SELECT schluesseltyp FROM tbl_schluesseltyp WHERE ext_id=".$row->schluessel_fk.";";
if($result2 = pg_query($conn, $qry2))
{
if(pg_num_rows($result2)>0) //eintrag gefunden
{
if($row2=pg_fetch_object($result2))
{
$schluessel->schluesseltyp=$row2->schluesseltyp;
//Insert oder Update
$qry3="SELECT schluessel_id FROM tbl_schluessel WHERE ext_id=".$row->schluessel_fk.";";
if($result3 = pg_query($conn, $qry3))
{
if(pg_num_rows($result3)>0) //eintrag gefunden
{
if($row3=pg_fetch_object($result3))
{
// update , wenn datensatz bereits vorhanden
$schluessel->schluessel_id=$row3->schluessel_id;
$schluessel->new=false;
}
}
else
{
// insert, wenn datensatz noch nicht vorhanden
$schluessel->new=true;
}
}
}
}
else
{
// insert, wenn datensatz noch nicht vorhanden
$schluessel->new=true;
}
}
else
{
$error=true;
$error_log.="schluesseltyp mit schluessel_fk: $row->schluessel_fk konnte in tbl_schluesseltyp nicht gefunden werden! (".pg_num_rows($result1).")\n";
$anzahl_fehler++;
}
}
}
else
{
$error=true;
$error_log.="person mit person_fk: $row->person_fk konnte in tbl_syncperson nicht gefunden werden! (".pg_num_rows($result1).")\n";
$anzahl_fehler++;
}
}
If (!$error)
{
if(!$schluessel->save())
{
$error_log.=$schluessel->errormsg."\n";
$anzahl_fehler++;
}
else
{
$anzahl_eingefuegt++;
}
}
}
}
//echo nl2br($text);
echo nl2br($error_log);
echo nl2br("\nGesamt: $anzahl_quelle / Eingefügt: $anzahl_eingefuegt / Fehler: $anzahl_fehler");
?>
</body>
</html>
@@ -0,0 +1,114 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
//*
//* Synchronisiert schluesseltypdatensaetze von FAS DB in PORTAL DB
//*
//*
include('../../../vilesci/config.inc.php');
include('../../../include/schluesseltyp.class.php');
$conn=pg_connect(CONN_STRING) or die("Connection zur Portal Datenbank fehlgeschlagen");
$conn_fas=pg_connect(CONN_STRING_FAS) or die("Connection zur FAS Datenbank fehlgeschlagen");
$adress='ruhan@technikum-wien.at';
//$adress='fas_sync@technikum-wien.at';
$error_log='';
$text = '';
$anzahl_quelle=0;
$anzahl_eingefuegt=0;
$anzahl_fehler=0;
function validate($row)
{
}
?>
<html>
<head>
<title>Synchro - FAS -> Portal - Schlüsseltyp</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
/*************************
* FAS-PORTAL - Synchronisation
*/
$qry = "SELECT * FROM schluessel;";
if($result = pg_query($conn_fas, $qry))
{
echo nl2br("Schlüsseltyp Sync\n---------------------\n");
$anzahl_quelle=pg_num_rows($result);
while($row = pg_fetch_object($result))
{
echo "- ";
ob_flush();
flush();
$error=false;
$schluesseltyp =new schluesseltyp($conn);
$schluesseltyp->beschreibung =$row->name;
$schluesseltyp->nummer =$row->nummer;
$schluesseltyp->anzahl =$row->anzahl;
$schluesseltyp->kaution =$row->betrag;
$schluesseltyp->ext_id =$row->schluessel_pk;
if($row->name=='Gaderobenschlüssel')
{
$schluesseltyp->schluesseltyp='Gaderobe';
}
elseif($row->name=='Zutrittskarte')
{
$schluesseltyp->schluesseltyp='Zutritt'.$row->nummer;
}
else
{
$schluesseltyp->schluesseltyp=$row->name;
}
$schluesseltyp->new=true;
if(!$schluesseltyp->save())
{
$error_log.=$schluesseltyp->errormsg."\n";
$anzahl_fehler++;
}
else
{
$anzahl_eingefuegt++;
}
}
}
//echo nl2br($text);
echo nl2br($error_log);
echo nl2br("\nGesamt: $anzahl_quelle / Eingefügt: $anzahl_eingefuegt / Fehler: $anzahl_fehler");
?>
</body>
</html>
+1 -1
View File
@@ -67,7 +67,7 @@ if($result = pg_query($conn_vilesci, $qry))
$lvinfo->pruefungsordnung =$row->pruefungsordnung;
$lvinfo->anmerkungen =$row->anmerkungen;
$lvinfo->kurzbeschreibung =$row->niveau;
$lvinfo->lehrformen =$row->lehrformen;
//$lvinfo->lehrformen =$row->lehrformen;
$lvinfo->genehmigt =($row->genehmigt=='t'?true:false);
$lvinfo->aktiv =($row->aktiv=='t'?true:false);
$lvinfo->sprache =$row->sprache;
+169
View File
@@ -0,0 +1,169 @@
<?php
/* Copyright (C) 2007 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Klasse aufmerksamdurch
* @create 02-01-2007
*/
class aufmerksamdurch
{
var $conn; // @var resource DB-Handle
var $new; // @var boolean
var $errormsg; // @var string
var $done=false; // @var boolean
//Tabellenspalten
Var $aufmerksamdurch_kurzbz; // @var string
var $beschreibung; // @var integer
var $ext_id; // @var integer
/**
* Konstruktor
* @param $conn Connection
* $aufmerksamdurch_kurzbz = ID (Default=null)
*/
function aufmerksamdurch($conn,$aufmerksamdurch_kurzbz=null, $unicode=false)
{
$this->conn = $conn;
if ($unicode)
{
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
}
else
{
$qry="SET CLIENT_ENCODING TO 'LATIN9';";
}
if(!pg_query($conn,$qry))
{
$this->errormsg = "Encoding konnte nicht gesetzt werden";
return false;
}
}
/**
* @param $aufmerksam_kurzbz ID
* @return true wenn ok, false im Fehlerfall
*/
function load($aufmerksam_kurzbz)
{
//noch nicht implementiert
}
// ************************************************
// * wenn $var '' ist wird "null" zurueckgegeben
// * wenn $var !='' ist werden datenbankkritische
// * Zeichen mit backslash versehen und das Ergebnis
// * unter Hochkomma gesetzt.
// ************************************************
function addslashes($var)
{
return ($var!=''?"'".addslashes($var)."'":'null');
}
/**
* Speichert den aktuellen Datensatz in die Datenbank
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
* andernfalls wird der Datensatz mit der ID in $schluessel_id aktualisiert
* @return true wenn ok, false im Fehlerfall
*/
function save()
{
$this->done=false;
if($this->new)
{
//Neuen Datensatz einfuegen
$qry='INSERT INTO tbl_aufmerksamdurch (aufmerksamdurch_kurzbz, beschreibung) VALUES('.
$this->addslashes($this->aufmerksamdurch_kurzbz).', '.
$this->addslashes($this->beschreibung).', '.
$this->addslashes($this->ext_id).');';
$this->done=true;
}
else
{
$qryz="SELECT * FROM tbl_aufmerksamdurch WHERE aufmerksamdurch_kurzbz='$this->aufmerksamdurch_kurzbz';";
if($resultz = pg_query($this->conn, $qryz))
{
while($rowz = pg_fetch_object($resultz))
{
$update=false;
if($rowz->beschreibung!=$this->beschreibung) $update=true;
if($rowz->beschreibung!=$this->ext_id) $update=true;
if($update)
{
$qry='UPDATE tbl_aufmerksamdurch SET '.
'beschreibung='.$this->addslashes($this->beschreibung).', '.
'ext_id='.$this->addslashes($this->ext_id).' '.
'WHERE aufmerksamdurch_kurzbz='.$this->addslashes($this->aufmerksamdurch_kurzbz).';';
$this->done=true;
}
}
}
}
if ($this->done)
{
if(pg_query($this->conn, $qry))
{
//Log schreiben
/*$sql = $qry;
$qry = "SELECT nextval('log_seq') as id;";
if(!$row = pg_fetch_object(pg_query($this->conn, $qry)))
{
$this->errormsg = 'Fehler beim Auslesen der Log-Sequence';
return false;
}
$qry = "INSERT INTO log(log_pk, creationdate, creationuser, sql) VALUES('$row->id', now(), '$this->updatevon', '".addslashes($sql)."')";
if(pg_query($this->conn, $qry))
return true;
else
{
$this->errormsg = 'Fehler beim Speichern des Log-Eintrages';
return false;
} */
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern der Daten';
return false;
}
}
else
{
return true;
}
}
/**
* Loescht den Datenensatz mit der ID die uebergeben wird
* @param $aufmerksamdurch_kurzbz ID die geloescht werden soll
* @return true wenn ok, false im Fehlerfall
*/
function delete($aufmerksamdurch_kurzbz)
{
//noch nicht implementiert!
}
}
?>
+6 -5
View File
@@ -187,8 +187,8 @@ class bankverbindung
$this->errormsg = 'person_id muss eine gueltige Zahl sein: '.$this->person_id.'';
return false;
}
$qry="SELECT * FROM tbl_bankverbindung WHERE bankverbindung_id='$this->bankverbindung_id';";
if($resultz = pg_query($this->conn, $qry))
$qryz="SELECT * FROM tbl_bankverbindung WHERE bankverbindung_id='$this->bankverbindung_id';";
if($resultz = pg_query($this->conn, $qryz))
{
while($rowz = pg_fetch_object($resultz))
{
@@ -206,7 +206,7 @@ class bankverbindung
if($update)
{
$qry='UPDATE bankverbindung SET '.
$qry='UPDATE tbl_bankverbindung SET '.
'person_id='.$this->addslashes($this->person_id).', '.
'name='.$this->addslashes($this->name).', '.
'anschrift='.$this->addslashes($this->anschrift).', '.
@@ -215,7 +215,7 @@ class bankverbindung
'kontonr='.$this->addslashes($this->kontonr).', '.
'iban='.$this->addslashes($this->iban).', '.
'typ='.$this->addslashes($this->typ).', '.
'zustellung='.($this->zustellung?'true':'false').', '.
'verrechnung='.($this->verrechnung?'true':'false').', '.
'ext_id='.$this->addslashes($this->ext_id).' '.
'WHERE bankverbindung_id='.$this->addslashes($this->bankverbindung_id).';';
$this->done=true;
@@ -223,9 +223,10 @@ class bankverbindung
}
}
}
//echo $qry;
if ($this->done)
{
//echo $qry."\n";
if(pg_query($this->conn, $qry))
{
//Log schreiben
+3 -1
View File
@@ -48,7 +48,9 @@ class fachbereich
{
$this->conn = $conn;
if($fachbereich_kurzbz != null)
{
$this->load($fachbereich_kurzbz);
}
}
/**
@@ -167,7 +169,7 @@ class fachbereich
//Pruefen ob fachbereich_kurzbz gueltig ist
if($this->fachbereich_kurzbz == '')
{
$this->errormsg = 'fachbereich_id ungueltig!';
$this->errormsg = 'fachbereich_id ungueltig! ('.$this->fachbereich_kurzbz.'/'.$this->ext_id.')';
return false;
}
//Neuen Datensatz anlegen
-1
View File
@@ -232,7 +232,6 @@ class lvinfo
}
$qry = 'BEGIN; UPDATE campus.tbl_lvinfo SET '.
//'lvinfo_id='.$this->addslashes($this->lvinfo_id).', '.
'lehrziele='.$this->addslashes($this->lehrziele).', '.
'lehrinhalte='.$this->addslashes($this->lehrinhalte).', '.
'voraussetzungen='.$this->addslashes($this->voraussetzungen).', '.
+2 -2
View File
@@ -212,11 +212,11 @@ class person
$this->errormsg = 'FotoOID ist ungueltig';
return false;
}
if(strlen($this->anmerkungen)>256)
/*if(strlen($this->anmerkungen)>256)
{
$this->errormsg = 'Anmerkungen darf nicht laenger als 256 Zeichen sein';
return false;
}
}*/
if(strlen($this->homepage)>256)
{
$this->errormsg = 'Homepage darf nicht laenger als 256 Zeichen sein';
+193
View File
@@ -0,0 +1,193 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Klasse Schüssel
* @create 22-12-2006
*/
class schluessel
{
var $conn; // @var resource DB-Handle
var $new; // @var boolean
var $errormsg; // @var string
var $done=false; // @var boolean
//Tabellenspalten
Var $schluessel_id; // @var integer
var $person_id; // @var integer
var $schluesseltyp; // @var string
var $nummer; // @var string
var $kaution; // @var numeric(5,2)
var $ausgegebenam; // @var date
var $ext_id; // @var integer
var $insertamum; // @var timestamp
var $insertvon; // @var bigint
var $updateamum; // @var timestamp
var $updatevon; // @var bigint
/**
* Konstruktor
* @param $conn Connection
* $kontakt_id ID der Adresse die geladen werden soll (Default=null)
*/
function schluessel($conn,$schluessel_id=null, $unicode=false)
{
$this->conn = $conn;
if ($unicode)
{
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
}
else
{
$qry="SET CLIENT_ENCODING TO 'LATIN9';";
}
if(!pg_query($conn,$qry))
{
$this->errormsg = "Encoding konnte nicht gesetzt werden";
return false;
}
}
/**
* Laedt den Schlüssel mit der ID $schluessel_id
* @param $schluessel_id ID dem zu ladenden Schlüssel
* @return true wenn ok, false im Fehlerfall
*/
function load($schluessel_id)
{
//noch nicht implementiert
}
// ************************************************
// * wenn $var '' ist wird "null" zurueckgegeben
// * wenn $var !='' ist werden datenbankkritische
// * Zeichen mit backslash versehen und das Ergebnis
// * unter Hochkomma gesetzt.
// ************************************************
function addslashes($var)
{
return ($var!=''?"'".addslashes($var)."'":'null');
}
/**
* Speichert den aktuellen Datensatz in die Datenbank
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
* andernfalls wird der Datensatz mit der ID in $schluessel_id aktualisiert
* @return true wenn ok, false im Fehlerfall
*/
function save()
{
$this->done=false;
if($this->new)
{
//Neuen Datensatz einfuegen
$qry='INSERT INTO tbl_schluessel (person_id, schluesseltyp, nummer, kaution, ausgegebenam,
ext_id, insertamum, insertvon, updateamum, updatevon) VALUES('.
$this->addslashes($this->person_id).', '.
$this->addslashes($this->schluesseltyp).', '.
$this->addslashes($this->nummer).', '.
$this->addslashes($this->kaution).', '.
$this->addslashes($this->ausgegebenam).', '.
$this->addslashes($this->ext_id).', now(), '.
$this->addslashes($this->insertvon).', now(), '.
$this->addslashes($this->updatevon).');';
$this->done=true;
}
else
{
$qryz="SELECT * FROM tbl_schluessel WHERE schluessel_id='$this->schluessel_id';";
if($resultz = pg_query($this->conn, $qryz))
{
while($rowz = pg_fetch_object($resultz))
{
$update=false;
if($rowz->person_id!=$this->person_id) $update=true;
if($rowz->schluesseltyp!=$this->schluesseltyp) $update=true;
if($rowz->nummer!=$this->nummer) $update=true;
if($rowz->kaution!=$this->kaution) $update=true;
if($rowz->ausgegebenam!=$this->ausgegebenam) $update=true;
if($rowz->ext_id!=$this->ext_id) $update=true;
if($update)
{
$qry='UPDATE tbl_schluessel SET '.
'person_id='.$this->addslashes($this->person_id).', '.
'schluesseltyp='.$this->addslashes($this->schluesseltyp).', '.
'nummer='.$this->addslashes($this->nummer).', '.
'kaution='.$this->addslashes($this->kaution).', '.
'ausgegebenam='.$this->addslashes($this->ausgegebenam).', '.
'ext_id='.$this->addslashes($this->ext_id).', '.
'updateamum= now(), '.
'updatevon='.$this->addslashes($this->updatevon).' '.
'WHERE schluessel_id='.$this->addslashes($this->schluessel_id).';';
$this->done=true;
}
}
}
}
if ($this->done)
{
if(pg_query($this->conn, $qry))
{
//Log schreiben
/*$sql = $qry;
$qry = "SELECT nextval('log_seq') as id;";
if(!$row = pg_fetch_object(pg_query($this->conn, $qry)))
{
$this->errormsg = 'Fehler beim Auslesen der Log-Sequence';
return false;
}
$qry = "INSERT INTO log(log_pk, creationdate, creationuser, sql) VALUES('$row->id', now(), '$this->updatevon', '".addslashes($sql)."')";
if(pg_query($this->conn, $qry))
return true;
else
{
$this->errormsg = 'Fehler beim Speichern des Log-Eintrages';
return false;
} */
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern der Daten';
return false;
}
}
else
{
return true;
}
}
/**
* Loescht den Datenensatz mit der ID die uebergeben wird
* @param $schluessel_id ID die geloescht werden soll
* @return true wenn ok, false im Fehlerfall
*/
function delete($schluessel_id)
{
//noch nicht implementiert!
}
}
?>
+117
View File
@@ -0,0 +1,117 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Klasse schluesseltyp (FAS-Online)
* @create 22-12-2006
*/
class schluesseltyp
{
var $conn; // resource DB-Handle
var $errormsg; // string
var $new; // boolean
//var $schluesseltyp = array(); // schluesseltyp Objekt
//Tabellenspalten
var $schluesseltyp; //string
var $beschreibung; //string
var $anzahl; //smallint
var $kaution; //numeric(5,2)
var $nummer; //string
var $ext_id; //bigint
/**
* Konstruktor
* @param $conn Connection
* $code Zu ladende Schluesseltyp
*/
function schluesseltyp($conn, $code=null, $unicode=false)
{
$this->conn = $conn;
if($unicode)
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
else
$qry = "SET CLIENT_ENCODING TO 'LATIN9';";
if(!pg_query($conn,$qry))
{
$this->errormsg = 'Encoding konnte nicht gesetzt werden';
return false;
}
}
/**
* Laedt die Funktion mit der ID $schluesseltyp
* @param $code code des zu ladenden schluesseltyps
* @return true wenn ok, false im Fehlerfall
*/
function load($code)
{
$this->errormsg = 'Noch nicht implementiert';
return false;
}
/**
* Laedt alle schluesseltypen
*/
function getAll()
{
$this->errormsg = 'Noch nicht implementiert';
return false;
}
function addslashes($var)
{
return ($var!=''?"'".addslashes($var)."'":'null');
}
// ************************************************************
// * Speichert die Daten in die Datenbank
// * @return true wenn erfolgreich, false im Fehlerfall
// ************************************************************
function save()
{
$qry='INSERT INTO tbl_schluesseltyp (schluesseltyp, beschreibung, anzahl, kaution, nummer, ext_id) VALUES('.
$this->addslashes($this->schluesseltyp).', '.
$this->addslashes($this->beschreibung).', '.
$this->addslashes($this->anzahl).', '.
$this->addslashes($this->kaution).', '.
$this->addslashes($this->nummer).', '.
$this->addslashes($this->ext_id).');';
if(pg_query($this->conn,$qry))
{
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern des Schluesseltypen-Datensatzes:'.$this->schluesseltyp.' '.$qry;
return false;
}
}
}
?>