From e939eded65277260384584de31a9d10cf639d117 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 4 Oct 2021 09:55:21 +0200 Subject: [PATCH] neuer adresstyp fuer homeoffice und dynmaischen adressentyp im FAS --- cis/private/profile/index.php | 29 +-------------- content/adressedialog.xul.php | 12 ++++--- include/adresse.class.php | 34 ++++++++++++++++-- rdf/adressentyp.rdf.php | 67 +++++++++++++++++++++++++++++++++++ system/dbupdate_3.3.php | 37 +++++++++++++++++++ 5 files changed, 143 insertions(+), 36 deletions(-) create mode 100644 rdf/adressentyp.rdf.php diff --git a/cis/private/profile/index.php b/cis/private/profile/index.php index 80062a932..1f1330839 100644 --- a/cis/private/profile/index.php +++ b/cis/private/profile/index.php @@ -293,36 +293,9 @@ if (!$ansicht) $adresse = new adresse(); $adresse->load_pers($user->person_id); - function sortAdresse($a , $b) - { - if ($a->typ === $b->typ) - return 0; - - return ($a->typ < $b->typ) ? -1 : 1; - } - usort($adresse->result, "sortAdresse"); foreach($adresse->result as $a) { - if ($a->zustelladresse) - { - switch ($a->typ) - { - case "h": - $typ = $p->t("global/hauptwohnsitz"); - break; - case "n": - $typ = $p->t("global/nebenwohnsitz"); - break; - default: - $typ = NULL; - break; - } - if ($typ !== NULL) - { - echo "".$typ.":
"; - echo $a->strasse."
".$a->plz." ".$a->ort."

"; - } - } + echo $a->strasse . " (" . $a->bezeichnung_mehrsprachig[$sprache] .") " . "
".$a->plz." ".$a->ort."

"; } } diff --git a/content/adressedialog.xul.php b/content/adressedialog.xul.php index f4f530bf0..50fb92b00 100644 --- a/content/adressedialog.xul.php +++ b/content/adressedialog.xul.php @@ -70,13 +70,15 @@ else diff --git a/include/adresse.class.php b/include/adresse.class.php index ffdb08582..801a95650 100644 --- a/include/adresse.class.php +++ b/include/adresse.class.php @@ -53,6 +53,9 @@ class adresse extends basis_db public $rechnungsadresse=false; // boolean public $anmerkung; // string public $co_name; + public $adressentyp; + public $bezeichnung; + public $bezeichnung_mehrsprachig; /** * Konstruktor @@ -133,10 +136,10 @@ class adresse extends basis_db $this->errormsg = 'person_id muss eine gültige Zahl sein'; return false; } - + $sprache = new sprache(); //Lesen der Daten aus der Datenbank - $qry = "SELECT * FROM public.tbl_adresse WHERE person_id=".$this->db_add_param($pers_id, FHC_INTEGER, false); - $qry.=" ORDER BY zustelladresse DESC"; + $qry = "SELECT *, ". $sprache->getSprachQuery('bezeichnung_mehrsprachig') ." FROM public.tbl_adresse JOIN public.tbl_adressentyp ON typ = adressentyp_kurzbz WHERE person_id=".$this->db_add_param($pers_id, FHC_INTEGER, false); + $qry.=" ORDER BY zustelladresse DESC, sort"; if(!$this->db_query($qry)) { @@ -167,6 +170,7 @@ class adresse extends basis_db $adr_obj->co_name = $row->co_name; $adr_obj->rechnungsadresse = $this->db_parse_bool($row->rechnungsadresse); $adr_obj->anmerkung = $row->anmerkung; + $adr_obj->bezeichnung_mehrsprachig = $sprache->parseSprachResult('bezeichnung_mehrsprachig',$row); $this->result[] = $adr_obj; } @@ -519,5 +523,29 @@ class adresse extends basis_db } return true; } + + public function getAdressentyp() + { + $qry = "SELECT * FROM public.tbl_adressentyp ORDER BY sort;"; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $obj = new adresse(); + + $obj->adressentyp = $row->adressentyp_kurzbz; + $obj->bezeichnung = $row->bezeichnung; + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } } ?> diff --git a/rdf/adressentyp.rdf.php b/rdf/adressentyp.rdf.php new file mode 100644 index 000000000..b34a96cc6 --- /dev/null +++ b/rdf/adressentyp.rdf.php @@ -0,0 +1,67 @@ +, + * Andreas Oesterreicher and + * Rudolf Hangl . + */ +// header für no cache +header("Cache-Control: no-cache"); +header("Cache-Control: post-check=0, pre-check=0",false); +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Pragma: no-cache"); +// content type setzen +header("Content-type: application/xhtml+xml"); +// xml +echo ''; +// DAO +require_once('../config/vilesci.config.inc.php'); +require_once('../include/adresse.class.php'); + +$adresse = new adresse(); + +$rdf_url='http://www.technikum-wien.at/adressentyp'; +echo ' + + + +'; + +if ($adresse->getAdressentyp()) +{ + foreach ($adresse->result as $row) + { + echo ' + + + adressentyp.']]> + bezeichnung.']]> + + + '; + } +} +else +{ + echo $adresse->errormsg; +} +?> + + diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 45c9e9e42..7d16dad1b 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4916,6 +4916,42 @@ if(!$result = @$db->db_query("SELECT 1 FROM public.tbl_zgvpruefungstatus_status echo ' public.tbl_zgvpruefungstatus_status: Tabelle hinzugefuegt
'; } +// Add table adressentyp +if(!$result = @$db->db_query("SELECT 1 FROM public.tbl_adressentyp LIMIT 1;")) +{ + $qry = " + CREATE TABLE public.tbl_adressentyp + ( + adressentyp_kurzbz varchar(32), + bezeichnung varchar(256), + bezeichnung_mehrsprachig varchar(256)[], + sort smallint + ); + + COMMENT ON TABLE public.tbl_adressentyp IS 'Types of Addresses'; + ALTER TABLE public.tbl_adressentyp ADD CONSTRAINT pk_tbl_adressentyp PRIMARY KEY (adressentyp_kurzbz); + + INSERT INTO public.tbl_adressentyp(adressentyp_kurzbz, bezeichnung, bezeichnung_mehrsprachig, sort) VALUES ('h', 'Hauptwohnsitz', '{\"Hauptwohnsitz\", \"Principal residence\"}', 1); + INSERT INTO public.tbl_adressentyp(adressentyp_kurzbz, bezeichnung, bezeichnung_mehrsprachig, sort) VALUES ('n', 'Nebenwohnsitz', '{\"Nebenwohnsitz\", \"Secondary residence\"}', 2); + INSERT INTO public.tbl_adressentyp(adressentyp_kurzbz, bezeichnung, bezeichnung_mehrsprachig, sort) VALUES ('ho', 'Homeoffice', '{\"Homeoffice\", \"Homeoffice\"}', 3); + INSERT INTO public.tbl_adressentyp(adressentyp_kurzbz, bezeichnung, bezeichnung_mehrsprachig, sort) VALUES ('r', 'Rechnungsadresse', '{\"Rechnungsadresse\", \"Billing address\"}', 4); + INSERT INTO public.tbl_adressentyp(adressentyp_kurzbz, bezeichnung, bezeichnung_mehrsprachig, sort) VALUES ('f', 'Firma', '{\"Firma\", \"Company\"}', 5); + + UPDATE public.tbl_adresse SET typ = 'f' WHERE person_id IS NULL AND (typ IS NULL OR typ = ''); + UPDATE public.tbl_adresse SET typ = 'h' WHERE person_id IS NOT NULL AND typ IS NULL; + + ALTER TABLE public.tbl_adresse ADD CONSTRAINT fk_tbl_adresse_adressentyp FOREIGN KEY (typ) REFERENCES public.tbl_adressentyp (adressentyp_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + + GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_adressentyp TO vilesci; + GRANT SELECT ON public.tbl_adressentyp TO web; + "; + + if(!$db->db_query($qry)) + echo 'public.tbl_adressentyp: '.$db->db_last_error().'
'; + else + echo ' public.tbl_adressentyp: Tabelle hinzugefuegt
'; +} + // Add index to lehre.tbl_pruefung if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_pruefung_student_uid'")) { @@ -5181,6 +5217,7 @@ $tabellen=array( "lehre.tbl_zeugnisnote" => array("lehrveranstaltung_id","student_uid","studiensemester_kurzbz","note","uebernahmedatum","benotungsdatum","bemerkung","updateamum","updatevon","insertamum","insertvon","ext_id","punkte"), "public.ci_apikey" => array("apikey_id","key","level","ignore_limits","date_created"), "public.tbl_adresse" => array("adresse_id","person_id","name","strasse","plz","ort","gemeinde","nation","typ","heimatadresse","zustelladresse","firma_id","updateamum","updatevon","insertamum","insertvon","ext_id","rechnungsadresse","anmerkung", "co_name"), + "public.tbl_adressentyp" => array("adressentyp_kurzbz", "bezeichnung", "bezeichnung_mehrsprachig", "sort"), "public.tbl_akte" => array("akte_id","person_id","dokument_kurzbz","uid","inhalt","mimetype","erstelltam","gedruckt","titel","bezeichnung","updateamum","updatevon","insertamum","insertvon","ext_id","dms_id","nachgereicht","anmerkung","titel_intern","anmerkung_intern","nachgereicht_am","ausstellungsnation","formal_geprueft_amum","archiv","signiert","stud_selfservice","akzeptiertamum"), "public.tbl_ampel" => array("ampel_id","kurzbz","beschreibung","benutzer_select","deadline","vorlaufzeit","verfallszeit","insertamum","insertvon","updateamum","updatevon","email","verpflichtend","buttontext"), "public.tbl_ampel_benutzer_bestaetigt" => array("ampel_benutzer_bestaetigt_id","ampel_id","uid","insertamum","insertvon"),