mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 16:32:20 +00:00
SYNC Schluesseltyp
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
/**
|
||||
* Klasse schluesseltyp (FAS-Online)
|
||||
* @create 22-12-2006
|
||||
* @create 03-01-2006
|
||||
*/
|
||||
|
||||
class schluesseltyp
|
||||
@@ -37,9 +37,6 @@ class schluesseltyp
|
||||
var $beschreibung; //string
|
||||
var $anzahl; //smallint
|
||||
var $kaution; //numeric(5,2)
|
||||
var $nummer; //string
|
||||
var $ext_id; //bigint
|
||||
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
@@ -93,23 +90,39 @@ class schluesseltyp
|
||||
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))
|
||||
$qry1='SELECT * FROM tbl_schluesseltyp WHERE beschreibung='.$this->addslashes($this->beschreibung).';';
|
||||
if($result1=pg_query($this->conn,$qry1))
|
||||
{
|
||||
return true;
|
||||
if(pg_num_rows($result1)>0) //eintrag gefunden
|
||||
{
|
||||
if($row1 = pg_fetch_object($result1))
|
||||
{
|
||||
$qry='UPDATE tbl_schluesseltyp SET '.
|
||||
'anzahl =anzahl+'.$this->anzahl.' '.
|
||||
'WHERE beschreibung='.$this->addslashes($this->beschreibung).';';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry='INSERT INTO tbl_schluesseltyp (schluesseltyp, beschreibung, anzahl, kaution) VALUES('.
|
||||
$this->addslashes($this->schluesseltyp).', '.
|
||||
$this->addslashes($this->beschreibung).', '.
|
||||
$this->addslashes($this->anzahl).', '.
|
||||
$this->addslashes($this->kaution).');';
|
||||
}
|
||||
if(pg_query($this->conn,$qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Schluesseltypen-Datensatzes: '.$this->schluesseltyp.' '.$qry;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Schluesseltypen-Datensatzes:'.$this->schluesseltyp.' '.$qry;
|
||||
$this->errormsg = 'Fehler beim Zugriff auf den Schluesseltypen-Datensatz: '.$this->schluesseltyp.' '.$qry;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user