SYNC Schluesseltyp

This commit is contained in:
Rudolf Hangl
2007-01-05 11:00:37 +00:00
parent ad82194175
commit bfd9f42365
4 changed files with 49 additions and 28 deletions
@@ -80,6 +80,7 @@ if($result = pg_query($conn_fas, $qry))
$person->svnr=$row->svnr;
$person->ersatzkennzeichen=$row->ersatzkennzeichen;
$person->familienstand=$row->familienstand;
$person->anzahlkinder=$row->anzahlderkinder;
$person->staatsbuergerschaft=$row->staatsbuergerschaft;
$person->geschlecht=strtolower($row->geschlecht);
$person->ext_id=$row->person_pk;
@@ -90,7 +90,7 @@ if($result = pg_query($conn_fas, $qry))
{
$schluessel->person_id=$row1->person_portal;
//Schlüsseltyp feststellen
$qry2="SELECT schluesseltyp FROM tbl_schluesseltyp WHERE ext_id=".$row->schluessel_fk.";";
$qry2="SELECT schluesseltyp FROM tbl_schluesseltyp WHERE schluesseltyp=".$row->name.";";
if($result2 = pg_query($conn, $qry2))
{
if(pg_num_rows($result2)>0) //eintrag gefunden
@@ -99,7 +99,7 @@ if($result = pg_query($conn_fas, $qry))
{
$schluessel->schluesseltyp=$row2->schluesseltyp;
//Insert oder Update
$qry3="SELECT schluessel_id FROM tbl_schluessel WHERE ext_id=".$row->schluessel_fk.";";
$qry3="SELECT schluessel_id FROM tbl_schluessel WHERE beschreibung=".$row->name.";";
if($result3 = pg_query($conn, $qry3))
{
if(pg_num_rows($result3)>0) //eintrag gefunden
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
/* 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
@@ -72,19 +72,13 @@ if($result = pg_query($conn_fas, $qry))
$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;
$schluesseltyp->anzahl =$row->anzahl==''?'0':$row->anzahl;
$schluesseltyp->kaution =$row->betrag==''?'0':$row->betrag;
if($row->name=='Gaderobenschlüssel')
{
$schluesseltyp->schluesseltyp='Gaderobe';
}
elseif($row->name=='Zutrittskarte')
{
$schluesseltyp->schluesseltyp='Zutritt'.$row->nummer;
}
else
{
$schluesseltyp->schluesseltyp=$row->name;
@@ -99,6 +93,19 @@ if($result = pg_query($conn_fas, $qry))
}
else
{
//überprüfen, ob sync-eintrag schon vorhanden
$qryz="SELECT * FROM tbl_syncschluesseltyp WHERE fas_typ='$row->schluesseltyp_pk' AND portal_typ='$schluesseltyp->schluesseltyp'";
if($resultz = pg_query($conn, $qryz))
{
if(pg_num_rows($resultz)==0) //wenn dieser eintrag noch nicht vorhanden ist
{
$qry='INSERT INTO tbl_syncschluesseltyp (fas_typ, portal_typ)'.
'VALUES ('.$row->schluesseltyp_pk.', '.$person->schluesseltyp.');';
$resulti = pg_query($conn, $qry);
}
}
$anzahl_eingefuegt++;
}
}