mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
SYSNC Raumtyp
This commit is contained in:
@@ -53,7 +53,7 @@ $qry = "SELECT * FROM tbl_ortraumtyp";
|
|||||||
|
|
||||||
if($result = pg_query($conn_vilesci, $qry))
|
if($result = pg_query($conn_vilesci, $qry))
|
||||||
{
|
{
|
||||||
echo nl2br("OrtRaumtyp Sync\n----------------\n");
|
echo nl2br("OrtRaumtyp Sync\n------------------\n");
|
||||||
$anzahl_quelle=pg_num_rows($result);
|
$anzahl_quelle=pg_num_rows($result);
|
||||||
while($row = pg_fetch_object($result))
|
while($row = pg_fetch_object($result))
|
||||||
{
|
{
|
||||||
@@ -62,12 +62,12 @@ if($result = pg_query($conn_vilesci, $qry))
|
|||||||
$ortraumtyp->ort_kurzbz=$row->ort_kurzbz;
|
$ortraumtyp->ort_kurzbz=$row->ort_kurzbz;
|
||||||
$ortraumtyp->hierarchie=$row->hierarchie;
|
$ortraumtyp->hierarchie=$row->hierarchie;
|
||||||
$ortraumtyp->raumtyp_kurzbz=$row->raumtyp_kurzbz;
|
$ortraumtyp->raumtyp_kurzbz=$row->raumtyp_kurzbz;
|
||||||
//$ort->insertamum='';
|
//$ortraumtyp->insertamum='';
|
||||||
$ortraumtyp->insertvon='SYNC';
|
$ortraumtyp->insertvon='SYNC';
|
||||||
//ort->updateamum='';
|
//ortraumtyp->updateamum='';
|
||||||
//$ort->updatevon=$row->updatevon;
|
//$ortraumtyp->updatevon=$row->updatevon;
|
||||||
|
|
||||||
$qry = "SELECT ort_kurzbz, hierarchie FROM tbl_ortraumtyp WHERE ort_kurzbz='$row->ort_kurzbz' AND hierarchie='$row->hierarchie'";
|
$qry = "SELECT ort_kurzbz, hierarchie FROM tbl_ortraumtyp WHERE ort_kurzbz = '$row->ort_kurzbz' AND hierarchie = '$row->hierarchie'";
|
||||||
if($result1 = pg_query($conn, $qry))
|
if($result1 = pg_query($conn, $qry))
|
||||||
{
|
{
|
||||||
if(pg_num_rows($result1)>0) //wenn dieser eintrag schon vorhanden ist
|
if(pg_num_rows($result1)>0) //wenn dieser eintrag schon vorhanden ist
|
||||||
@@ -86,13 +86,13 @@ if($result = pg_query($conn_vilesci, $qry))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//OrtRaumtyp neu anlegen
|
//OrtRaumtyp neu anlegen
|
||||||
$ort->new=true;
|
$ortraumtyp->new=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$error)
|
if(!$error)
|
||||||
if(!$ortraumtyp->save())
|
if(!$ortraumtyp->save())
|
||||||
{
|
{
|
||||||
$error_log.=$ort->errormsg."\n";
|
$error_log.=$ortraumtyp->errormsg."\n";
|
||||||
$anzahl_fehler++;
|
$anzahl_fehler++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?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 Funktiondatensaetze von Vilesci DB in PORTAL DB
|
||||||
|
//*
|
||||||
|
//*
|
||||||
|
|
||||||
|
include('../../vilesci/config.inc.php');
|
||||||
|
include('../../include/fas/raumtyp.class.php');
|
||||||
|
|
||||||
|
$conn=pg_connect(CONN_STRING) or die("Connection zur Portal Datenbank fehlgeschlagen");
|
||||||
|
$conn_vilesci=pg_connect(CONN_STRING_VILESCI) 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
//funktion
|
||||||
|
$qry = "SELECT * FROM tbl_raumtyp";
|
||||||
|
|
||||||
|
if($result = pg_query($conn_vilesci, $qry))
|
||||||
|
{
|
||||||
|
echo nl2br("Raumtyp Sync\n---------------\n");
|
||||||
|
$anzahl_quelle=pg_num_rows($result);
|
||||||
|
while($row = pg_fetch_object($result))
|
||||||
|
{
|
||||||
|
$error=false;
|
||||||
|
$raumtyp = new raumtyp($conn);
|
||||||
|
$raumtyp->beschreibung=$row->beschreibung;
|
||||||
|
$raumtyp->raumtyp_kurzbz=$row->raumtyp_kurzbz;
|
||||||
|
//$raumtyp->insertamum='';
|
||||||
|
$raumtyp->insertvon='SYNC';
|
||||||
|
//raumtyp->updateamum='';
|
||||||
|
//$raumtyp->updatevon=$row->updatevon;
|
||||||
|
|
||||||
|
$qry = "SELECT raumtyp_kurzbz FROM tbl_raumtyp WHERE raumtyp_kurzbz = '$row->raumtyp_kurzbz'";
|
||||||
|
if($result1 = pg_query($conn, $qry))
|
||||||
|
{
|
||||||
|
if(pg_num_rows($result1)>0) //wenn dieser eintrag schon vorhanden ist
|
||||||
|
{
|
||||||
|
if($row1=pg_fetch_object($result1))
|
||||||
|
{
|
||||||
|
//Raumtypdaten updaten
|
||||||
|
$raumtyp->new=false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error_log.="ort_kurzbz von $row->ort_kurzbz konnte nicht ermittelt werden\n";
|
||||||
|
$error=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Raumtyp neu anlegen
|
||||||
|
$raumtyp->new=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$error)
|
||||||
|
if(!$raumtyp->save())
|
||||||
|
{
|
||||||
|
$error_log.=$ort->errormsg."\n";
|
||||||
|
$anzahl_fehler++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$anzahl_eingefuegt++;
|
||||||
|
else
|
||||||
|
$anzahl_fehler++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo nl2br("abgeschlossen\n\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$error_log .= 'Funktiondatensaetze konnten nicht geladen werden';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Synchro - Vilesci -> Portal - Raumtyp</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>
|
||||||
@@ -175,7 +175,7 @@ class ortraumtyp
|
|||||||
if($this->new)
|
if($this->new)
|
||||||
{
|
{
|
||||||
//Pruefen ob id gültig ist
|
//Pruefen ob id gültig ist
|
||||||
if($this->ort_kurzbz == '' || !is_numeric($this->hierarchie) || $this_hierarchie=='')
|
if($this->ort_kurzbz == '' || !is_numeric($this->hierarchie) || $this->hierarchie=='')
|
||||||
{
|
{
|
||||||
$this->errormsg = 'Keine gültige ID';
|
$this->errormsg = 'Keine gültige ID';
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user