From 185ed8cf8e6f4279792c69f0c4c03b3758c47b51 Mon Sep 17 00:00:00 2001 From: Rudolf Hangl Date: Tue, 20 Nov 2007 17:00:40 +0000 Subject: [PATCH] --- system/sync/stp/stp_staat.txt | 84 +++++++++++++++++++++ system/sync/stp/sync_stp_vilesci_person.php | 42 +++++++++-- 2 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 system/sync/stp/stp_staat.txt diff --git a/system/sync/stp/stp_staat.txt b/system/sync/stp/stp_staat.txt new file mode 100644 index 000000000..ce4a59fbf --- /dev/null +++ b/system/sync/stp/stp_staat.txt @@ -0,0 +1,84 @@ +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('1', 'Österreich', 'A', '++43', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('2', 'Deutschland', 'D', '++49', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('3', 'Schweiz', 'CH', '++41', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('4', 'Chile', 'RCH', '++56', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('5', 'Argentinien', 'RA', '++51', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('6', 'Brasilien', 'BR', '++59', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('14', 'Großbritanien', 'GB', '44', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('15', 'Bosnien', 'BSH', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('16', 'Türkei', 'TR', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('17', 'Slowakei', 'SQ', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('20', 'China', 'CHF', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('21', 'Ecuador', 'EC', '', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('24', 'Tschechische Republik', 'TCH', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('25', 'Kanada', 'KA', '001-613', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('28', 'Schweden', 'S', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('29', 'Jugoslawien', 'YU', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('30', 'Rumänien', 'RO', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('31', 'Kalifornien', 'Kal', '1', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('32', 'Polen', 'PL', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('33', 'Iran', 'IR', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('34', 'Kroatien', 'CRO', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('35', 'Australien', 'AUS', '', 'Australien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('36', 'Vietnam', 'VN', '', 'Asien', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('37', 'Bulgarien', 'BG', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('38', 'Slowenien', 'SLO', '386', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('39', 'Vereinigte Staaten von Amerika', 'USA', '', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('40', 'Bolivien', 'BOL', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('41', 'Mexiko', 'MEX', '', 'Amerika', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('42', 'Russland', 'RU', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('43', 'Frankreich', 'F', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('44', 'Kuwait', 'KW', '', 'Asien', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('45', 'Ukraine', 'UKR', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('46', 'Mazedonien', 'MAZ', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('47', 'Italien', 'I', '39', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('48', 'Indien', 'IND', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('49', 'Spanien', 'E', '34', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('50', 'Neuseeland', 'NZ', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('51', 'Irland', 'IRL', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('52', 'Finnland', 'SF', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('53', 'Bangladesh', 'BANG', '880', 'Asien', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('55', 'Marokko', 'MAR', '00 212', 'Afrika', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('56', 'Nigeria', 'WAN', '', 'Afrika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('57', 'Niederlande', 'NL', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('58', 'Litauen', 'LIT', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('59', 'Ungarn', 'H', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('60', 'Griechenland', 'GR', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('61', 'Kenia', 'EAK', '', 'Afrika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('62', 'Costa Rica', 'CR', '', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('63', 'Luxembourg', 'L', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('64', 'Tunesien', 'TN', '', 'Afrika', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('65', 'Algerien', 'ALG', '', 'Afrika', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('66', 'Zypern', 'CY', '', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('68', 'Dänemark', 'DK', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('69', 'Norwegen', 'N', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('70', 'Belgien', 'B', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('71', 'Lettland', 'LV', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('72', 'Japan', 'J', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('73', 'Island', 'IS', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('74', 'Lichtenstein', 'FL', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('76', 'Usbekistan', 'UZBE', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('77', 'Mongolei', 'MO', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('78', 'Ägypten', 'EYG', '', 'Afrika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('79', 'EE', 'EE', '', '', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('81', 'Kasachstan', 'KAS', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('82', 'Netherland Antilles', 'NA', '', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('83', 'Ghana', 'GH', '', 'Afrika', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('84', 'Panama', 'PA', '', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('85', 'Albanien', 'AL', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('86', 'Venezuela', 'YV', '', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('87', 'Thailand', 'T', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('88', 'Peru', 'PE', '', 'Amerika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('89', 'Mauretanien', 'RIM', '222', 'Afrika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('90', 'Simbabwe', 'RSR', '', 'Afrika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('91', 'Georgien', 'GG', '', 'Asien', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('92', 'Senegal', 'SN', '', 'Afrika', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('97', 'Portugal', 'PT', '351', 'Europa', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('98', 'Indonesien', 'RI', '', 'Asien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('99', 'Serbien', 'SB', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('100', 'Papua-Neuguinea', 'PNG', '', 'Australien', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('101', 'Vereinigte Arabische Emirate', 'VE', '', 'Asien', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('102', 'Kamerun', 'CAM', '', 'Afrika', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('103', 'Weißrussland', 'BLR', '', 'Europa', '0'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('107', 'Israel', 'IL', '972', 'Asien', '1'); +insert into sync.stp_staat (__staat, chbezeichnung, chkurzbez, chvorwahl, chkontinent, boeu) values ('108', 'Laos', 'LA', '', 'Asien', '0'); diff --git a/system/sync/stp/sync_stp_vilesci_person.php b/system/sync/stp/sync_stp_vilesci_person.php index cbae2c44e..1a1b58102 100644 --- a/system/sync/stp/sync_stp_vilesci_person.php +++ b/system/sync/stp/sync_stp_vilesci_person.php @@ -11,7 +11,7 @@ //* Synchronisiert Personendatensaetze von FAS DB in PORTAL DB //* //* -//* setzt voraus: sync von sync.stp_person +//* setzt voraus: sync von sync.stp_person, sync.stp_staat //* benoetigt: tbl_syncperson require_once('sync_config.inc.php'); @@ -38,14 +38,15 @@ if (!@pg_query($conn,'SELECT * FROM sync.tbl_syncperson LIMIT 1;')) Grant delete on sync.tbl_syncperson to group "admin"; Grant insert on sync.tbl_syncperson to group "admin";'; if (!@pg_query($conn,$sql)) - echo 'sync.stp_person: '.pg_last_error($conn).'
'; + echo 'sync.tbl_syncperson: '.pg_last_error($conn).'
'; else - echo 'sync.stp_person wurde angelegt!
'; + echo 'sync.tbl_syncperson wurde angelegt!
'; } $error_log=''; +$error_log1=''; $error_log_ext=''; $ausgabe=""; $text = ''; @@ -55,7 +56,7 @@ $anzahl_eingefuegt=0; $anzahl_update=0; $anzahl_fehler=0; $plausi=''; - +$staat=array(); /************************* * FAS-PORTAL - Synchronisation @@ -69,6 +70,16 @@ $plausi=''; __staat]=$row_staat->chkurzbez; + } +} + //*********** Neue Daten holen ***************** $qry='SELECT __Person,_Staatsbuerger,_GebLand,Briefanrede,chTitel,chNachname,chVorname,daGebDat,chGebOrt,chAdrBemerkung,chHomepage,chSVNr,chErsatzKZ,_cxFamilienstand,_cxGeschlecht,inKinder FROM sync.stp_person @@ -89,6 +100,23 @@ if($result = pg_query($conn, $qry)) $row->_cxgeschlecht='w'; else $row->_cxgeschlecht=''; + if($row->_staatsbuerger==NULL) + { + $error_log1.="\nKeine Staatsbürgerschaft eingetragen"; + $error=true; + } + if($row->_gebland==NULL) + { + $error_log1.="\nKein Geburtsland eingetragen"; + $error=true; + } + if($error) + { + $error_log.="\n*****\n".$row->chtitel." ".$row->chnachname.", ".$row->chvorname." :".$error_log1; + $error_log1=''; + $error=false; + continue; + } // Check auf Doppelgaenger if ($row->chsvnr!='' || $row->dagebdat!='' ) { @@ -109,8 +137,8 @@ if($result = pg_query($conn, $qry)) familienstand,geschlecht,anzahlkinder,aktiv,insertamum,insertvon,updateamum,updatevon, ext_id) VALUES - (".myaddslashes($row->_staatsbuerger).", ". - myaddslashes($row->_gebland).", ". + (".myaddslashes($staat[$row->_staatsbuerger]).", ". + myaddslashes($staat[$row->_gebland]).", ". "NULL, ". myaddslashes($row->briefanrede).", ". "NULL, ". @@ -160,7 +188,7 @@ if($result = pg_query($conn, $qry)) 'VALUES ('.$row->__person.', '.$person_id.');'; $resulti = pg_query($conn, $qry); } - $ausgabe.="\n------------------\nÜbertragen: ".$row->chtitel." ".$row->chnachname.", ".$row->chvorname; + $ausgabe.="\n------------------\nÜbertragen: ".$row->chtitel." ".$row->chnachname.", ".$row->chvorname." / ".$row->_staatsbuerger.", ".$row->_gebland; pg_query($conn, "COMMIT"); } else