mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
This commit is contained in:
@@ -1,144 +0,0 @@
|
||||
<?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 EMaildatensaetze von FAS DB in PORTAL DB
|
||||
//*
|
||||
//*
|
||||
|
||||
include('../../../vilesci/config.inc.php');
|
||||
include('../../../include/kontakt.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 - EMail</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
/*************************
|
||||
* FAS-PORTAL - Synchronisation
|
||||
*/
|
||||
|
||||
//nation
|
||||
$qry = "SELECT * FROM email ORDER BY person_fk;";
|
||||
|
||||
if($result = pg_query($conn_fas, $qry))
|
||||
{
|
||||
echo nl2br("E-Mail Sync\n--------------\n");
|
||||
$anzahl_quelle=pg_num_rows($result);
|
||||
while($row = pg_fetch_object($result))
|
||||
{
|
||||
echo "- ";
|
||||
ob_flush();
|
||||
flush();
|
||||
|
||||
$error=false;
|
||||
$kontakt =new kontakt($conn);
|
||||
$kontakt->firma_id ='';
|
||||
$kontakt->kontakttyp ='email';
|
||||
$kontakt->anmerkung =$row->name;
|
||||
$kontakt->kontakt =$row->email;
|
||||
$kontakt->zustellung =$row->zustelladresse=='J'?true:false;
|
||||
$kontakt->updatevon ="SYNC";
|
||||
$kontakt->insertvon ="SYNC";
|
||||
$kontakt->ext_id =$row->email_pk;
|
||||
|
||||
//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))
|
||||
{
|
||||
$qry2="SELECT kontakt_id, ext_id FROM tbl_kontakt WHERE ext_id=".$row->email_pk." AND kontakttyp='email';";
|
||||
if($result2 = pg_query($conn, $qry2))
|
||||
{
|
||||
if(pg_num_rows($result2)>0) //eintrag gefunden
|
||||
{
|
||||
if($row2=pg_fetch_object($result2))
|
||||
{
|
||||
// update , wenn datensatz bereits vorhanden
|
||||
$kontakt->person_id=$row1->person_portal;
|
||||
$kontakt->kontakt_id=$row2->kontakt_id;
|
||||
$kontakt->new=false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert, wenn datensatz noch nicht vorhanden
|
||||
$kontakt->new=true;
|
||||
$kontakt->person_id=$row1->person_portal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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(!$kontakt->save())
|
||||
{
|
||||
$error_log.=$kontakt->errormsg."\n";
|
||||
$anzahl_fehler++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$anzahl_eingefuegt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//echo nl2br($text);
|
||||
echo nl2br("\n".$error_log);
|
||||
echo nl2br("\nGesamt: $anzahl_quelle / Eingefügt: $anzahl_eingefuegt / Fehler: $anzahl_fehler");
|
||||
$error_log.="\nGesamt: $anzahl_quelle / Eingefügt: $anzahl_eingefuegt / Fehler: $anzahl_fehler";
|
||||
mail($adress, 'SYNC Email', $error_log);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -18,8 +18,8 @@ include('../../../include/firma.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';
|
||||
//$adress='ruhan@technikum-wien.at';
|
||||
$adress='fas_sync@technikum-wien.at';
|
||||
|
||||
$error_log='';
|
||||
$text = '';
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
|
||||
//*
|
||||
//* Synchronisiert EMaildatensaetze von FAS DB in VILESCI DB
|
||||
//*
|
||||
//*benötigt: tbl_kontakttyp, tbl_syncperson
|
||||
|
||||
include('../../../vilesci/config.inc.php');
|
||||
include('../../../include/kontakt.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_update=0;
|
||||
$anzahl_fehler=0;
|
||||
$update=false;
|
||||
$ausgabe='';
|
||||
$ausgabe_email='';
|
||||
|
||||
function validate($row)
|
||||
{
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Synchro - FAS -> Vilesci - E-Mail</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
/*************************
|
||||
* FAS - VILESCI - Synchronisation
|
||||
*/
|
||||
|
||||
//nation
|
||||
$qry = "SELECT * FROM email ORDER BY person_fk;";
|
||||
|
||||
if($result = pg_query($conn_fas, $qry))
|
||||
{
|
||||
echo nl2br("E-Mail Sync\n-------------\n");
|
||||
$anzahl_quelle=pg_num_rows($result);
|
||||
while($row = pg_fetch_object($result))
|
||||
{
|
||||
//echo "- ";
|
||||
//ob_flush();
|
||||
//flush();
|
||||
|
||||
$error=false;
|
||||
$kontakt =new kontakt($conn);
|
||||
$kontakt->firma_id ='';
|
||||
$kontakt->kontakttyp ='email';
|
||||
$kontakt->anmerkung =$row->name;
|
||||
$kontakt->kontakt =$row->email;
|
||||
$kontakt->zustellung =$row->zustelladresse=='J'?true:false;
|
||||
$kontakt->updatevon ="SYNC";
|
||||
$kontakt->insertvon ="SYNC";
|
||||
$kontakt->ext_id =$row->email_pk;
|
||||
|
||||
$update=false;
|
||||
$ausgabe_email='';
|
||||
//Person_id feststellen
|
||||
$qry1="SELECT person_portal FROM sync.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))
|
||||
{
|
||||
$qry2="SELECT * FROM tbl_kontakt WHERE ext_id=".$row->email_pk." AND kontakttyp='email';";
|
||||
if($result2 = pg_query($conn, $qry2))
|
||||
{
|
||||
if(pg_num_rows($result2)>0) //eintrag gefunden
|
||||
{
|
||||
if($row2=pg_fetch_object($result2))
|
||||
{
|
||||
|
||||
if($row2->anmerkung!=$row->name)
|
||||
{
|
||||
$update=true;
|
||||
if(strlen(trim($ausgabe_email))>0)
|
||||
{
|
||||
$ausgabe_email.=", Name: '".trim($row->name)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ausgabe_email="Name: '".trim($row->name)."'";
|
||||
}
|
||||
}
|
||||
if($row2->kontakt!=$row->email)
|
||||
{
|
||||
$update=true;
|
||||
if(strlen(trim($ausgabe_email))>0)
|
||||
{
|
||||
$ausgabe_email.=", E-Mail: '".trim($row->email)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ausgabe_email="E-Mail: '".trim($row->email)."'";
|
||||
}
|
||||
}
|
||||
if($row2->zustellung!=($row->zustelladresse=='J'?'t':'f'))
|
||||
{
|
||||
$update=true;
|
||||
if(strlen(trim($ausgabe_email))>0)
|
||||
{
|
||||
$ausgabe_email.=", Zustelladresse: '".($row->zustelladresse=='J'?'true':'false')."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ausgabe_email="Zustelladresse: '".($row->zustelladresse=='J'?'true':'false')."'";
|
||||
}
|
||||
}
|
||||
// update , wenn datensatz bereits vorhanden
|
||||
$kontakt->person_id=$row1->person_portal;
|
||||
$kontakt->kontakt_id=$row2->kontakt_id;
|
||||
$kontakt->new=false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert, wenn datensatz noch nicht vorhanden
|
||||
$kontakt->new=true;
|
||||
$kontakt->person_id=$row1->person_portal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error=true;
|
||||
$error_log.="Person mit person_fk: $row->person_fk konnte in tbl_syncperson nicht gefunden werden!\n";
|
||||
$anzahl_fehler++;
|
||||
}
|
||||
}
|
||||
If (!$error)
|
||||
{
|
||||
if($kontakt->new || $update)
|
||||
{
|
||||
if(!$kontakt->save())
|
||||
{
|
||||
$error_log.=$kontakt->errormsg."\n";
|
||||
$anzahl_fehler++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($kontakt->new)
|
||||
{
|
||||
$ausgabe.="E-Mail $kontakt->kontakt eingefügt!\n";
|
||||
$anzahl_eingefuegt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($update)
|
||||
{
|
||||
$ausgabe.="E-Mail $kontakt->kontakt geändert: ".$ausgabe_email." !\n";
|
||||
$anzahl_update++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//echo nl2br($text);
|
||||
echo nl2br("\n".$error_log);
|
||||
echo nl2br("\n\nE-Mailsync:\nGesamt: $anzahl_quelle / Eingefügt: $anzahl_eingefuegt / Geändert: $anzahl_update / Fehler: $anzahl_fehler");
|
||||
$ausgabe="E-Mailsync:\nGesamt: $anzahl_quelle / Eingefügt: $anzahl_eingefuegt / Geändert: $anzahl_update / Fehler: $anzahl_fehler\n\n".$ausgabe;
|
||||
if(strlen(trim($error_log))>0)
|
||||
{
|
||||
mail($adress, 'SYNC-Fehler Email', $error_log,"From: vilesci@technikum-wien.at");
|
||||
}
|
||||
mail($adress, 'SYNC Email', $ausgabe,"From: vilesci@technikum-wien.at");
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -15,10 +15,10 @@ require_once('../../../vilesci/config.inc.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_plausi='ruhan@technikum-wien.at';
|
||||
//$adress='fas_sync@technikum-wien.at';
|
||||
//$adress_plausi='fas_sync@technikum-wien.at';
|
||||
//$adress='ruhan@technikum-wien.at';
|
||||
//$adress_plausi='ruhan@technikum-wien.at';
|
||||
$adress='fas_sync@technikum-wien.at';
|
||||
$adress_plausi='fas_sync@technikum-wien.at';
|
||||
|
||||
$error_log='';
|
||||
$error_log_fas='';
|
||||
|
||||
@@ -18,8 +18,8 @@ include('../../../include/betriebsmittelperson.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';
|
||||
//$adress='ruhan@technikum-wien.at';
|
||||
$adress='fas_sync@technikum-wien.at';
|
||||
|
||||
$error_log = '';
|
||||
$text = '';
|
||||
|
||||
@@ -56,8 +56,8 @@ foreach ($studiengangfk AS $stg)
|
||||
}
|
||||
|
||||
|
||||
$adress='ruhan@technikum-wien.at';
|
||||
//$adress='fas_sync@technikum-wien.at';
|
||||
//$adress='ruhan@technikum-wien.at';
|
||||
$adress='fas_sync@technikum-wien.at';
|
||||
|
||||
function myaddslashes($var)
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ include('../../../vilesci/config.inc.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';
|
||||
//$adress='ruhan@technikum-wien.at';
|
||||
$adress='fas_sync@technikum-wien.at';
|
||||
|
||||
$error_log1='';
|
||||
$error_log2='';
|
||||
|
||||
Reference in New Issue
Block a user