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;