From 01826bf88abfa630808fbaef49d5d4989b77c4f5 Mon Sep 17 00:00:00 2001 From: Gerald Raab Date: Fri, 2 Nov 2018 15:29:53 +0100 Subject: [PATCH] show all contacts in profile display type firmenhandy if no extension available added bezeichnung_mehrsprachig to tbl_kontakttyp --- cis/private/profile/index.php | 42 ++++++++++++++++++++++++++++++++--- include/kontakt.class.php | 36 +++++++++++++++++------------- locale/de-AT/profil.php | 2 +- locale/en-US/profil.php | 1 + system/dbupdate_3.3.php | 33 ++++++++++++++++++++++++--- 5 files changed, 91 insertions(+), 23 deletions(-) mode change 100644 => 100755 include/kontakt.class.php mode change 100644 => 100755 locale/de-AT/profil.php mode change 100644 => 100755 locale/en-US/profil.php diff --git a/cis/private/profile/index.php b/cis/private/profile/index.php index 4c0c0d024..6f2848bdf 100755 --- a/cis/private/profile/index.php +++ b/cis/private/profile/index.php @@ -43,6 +43,7 @@ require_once('../../../include/fotostatus.class.php'); require_once('../../../include/addon.class.php'); require_once('../../../include/gruppe.class.php'); require_once('../../../include/adresse.class.php'); +require_once('../../../include/benutzerberechtigung.class.php'); $sprache = getSprache(); $p = new phrasen($sprache); @@ -52,14 +53,21 @@ if (!$db = new basis_db()) $uid = get_uid(); +$rechte = new benutzerberechtigung(); +$rechte->getBerechtigungen($uid); + $datum_obj = new datum(); -$ansicht = false; //Wenn ein anderer User sich das Profil ansieht (Bei Personensuche) -if (isset($_GET['uid'])) +// Wenn ein anderer User sich das Profil ansieht (Bei Personensuche) sollen bestimmte persönliche Daten nicht angezeigt werden +// außer der User selber oder berechtigte Personen +$ansicht = false; +if (isset($_GET['uid']) && $_GET['uid'] != $uid) { $uid = stripslashes($_GET['uid']); $ansicht = true; } +if ($rechte->isBerechtigt('basis/kontakt')) + $ansicht = false; if (!$ansicht && isset($_GET['action'])) { @@ -232,7 +240,8 @@ echo ''; echo ' '.($type == "student"?$p->t("profil/student"):$p->t('profil/mitarbeiter')).'

'.$p->t('global/username').': '.$user->uid.'
'; - echo ($type == 'student') ? $p->t('global/matrikelnummer'). ": ". $user->matrikelnr. "
" : ''; +if ($type == 'student' && $person->matr_nr) + echo $p->t('global/matrikelnummer'). ": ". $person->matr_nr. "
"; echo ' '.$p->t('global/anrede').': '.$user->anrede.'
'.$p->t('global/titel').': '.$user->titelpre.'
'; @@ -329,6 +338,16 @@ if ($type == 'mitarbeiter') echo $p->t('profil/telefonTw').": $vorwahl - $user->telefonklappe
"; //echo $p->t('profil/faxTw').": $vorwahl - 99 $user->telefonklappe
"; } + else { + $kontakt = new kontakt(); + $kontakt->load_pers($user->person_id); + foreach($kontakt->result as $k) + { + if ($k->kontakttyp == 'firmenhandy') + echo $p->t('profil/telefonTw').': '.$k->kontakt.'
'; + } + + } if ($user->ort_kurzbz != '') echo $p->t('profil/buero').': '.$user->ort_kurzbz.'
'; } @@ -403,9 +422,24 @@ if (!$ansicht) $kontakt = new kontakt(); $kontakt->load_pers($user->person_id); usort($kontakt->result, "sortKontakt"); + echo ''; foreach($kontakt->result as $k) { + if ($k->kontakttyp != 'firmenhandy' && $k->kontakttyp != 'hidden') + { + if ($k->zustellung) + $zustellung = '✓'; + else + $zustellung = '✗'; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + /* if ($k->zustellung === TRUE) { switch($k->kontakttyp) @@ -423,7 +457,9 @@ if (!$ansicht) break; } } + */ } + echo '
'.$k->bezeichnung_mehrsprachig[$sprache].''.$k->kontakt.''.$k->anmerkung.''.$zustellung.'
'; } if ($user->homepage != '') diff --git a/include/kontakt.class.php b/include/kontakt.class.php old mode 100644 new mode 100755 index d3f43e09e..b09bf6683 --- a/include/kontakt.class.php +++ b/include/kontakt.class.php @@ -24,6 +24,7 @@ * @create 20-12-2006 */ require_once(dirname(__FILE__).'/basis_db.class.php'); +require_once(dirname(__FILE__).'/sprache.class.php'); class kontakt extends basis_db { @@ -281,7 +282,7 @@ class kontakt extends basis_db $qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id FROM public.tbl_kontakt LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER)." AND kontakttyp =".$this->db_add_param($kontakttyp, FHC_STRING); - + if ($order != null) $qry .= " ORDER BY ".$order; @@ -332,9 +333,10 @@ class kontakt extends basis_db $this->errormsg = 'Person_id ist ungueltig'; return false; } - - $qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id - FROM public.tbl_kontakt LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER).';'; + $sprache = new sprache(); + $bezeichnung_mehrsprachig = $sprache->getSprachQuery('bezeichnung_mehrsprachig'); + $qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id, tbl_kontakttyp.beschreibung as kontakttyp_name, $bezeichnung_mehrsprachig + FROM public.tbl_kontakt JOIN tbl_kontakttyp USING (kontakttyp) LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER).';'; if($this->db_query($qry)) { @@ -356,6 +358,8 @@ class kontakt extends basis_db $obj->insertamum = $row->insertamum; $obj->insertvon = $row->insertvon; $obj->ext_id = $row->ext_id; + $obj->kontakttyp_name = $row->kontakttyp_name; + $obj->bezeichnung_mehrsprachig = $sprache->parseSprachResult('bezeichnung_mehrsprachig',$row); $this->result[] = $obj; } @@ -512,15 +516,15 @@ class kontakt extends basis_db return false; } } - + /** * Sucht nach Kontaktdaten, die den Suchkriterien entsprechen - * @param string $searchstring String, nach dem gesucht werden soll. + * @param string $searchstring String, nach dem gesucht werden soll. * Wenn $typ = nummer ist, werden eventuelle nicht-numerische Zeichen mit preg_replace entfernt, * und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht * @param string $typ Optional. Kontakttyp. Möglich sind "nummer","telefon","mobil","so.tel","firmenhandy","firmenhandy","email","fax" und "homepage". * Wenn $typ = nummer ist, werden eventuelle nicht-numerische Zeichen mit preg_replace entfernt, - * und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht + * und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht * @return boolean */ public function searchKontakt ($searchstring, $typ = '') @@ -534,18 +538,18 @@ class kontakt extends basis_db return false; } } - $qry = "SELECT + $qry = "SELECT * - FROM + FROM public.tbl_kontakt - WHERE + WHERE 1=1"; - + if ($typ == 'nummer') $qry .= " AND regexp_replace(kontakt , '[^0-9]', '', 'g') LIKE ('%".$this->db_escape($searchstring)."%')"; else $qry .= " AND LOWER (kontakt) LIKE LOWER ('%".$this->db_escape($searchstring)."%')"; - + if ($typ != '' && $typ != 'nummer') $qry .= " AND kontakttyp=".$this->db_add_param($typ); @@ -554,7 +558,7 @@ class kontakt extends basis_db while($row = $this->db_fetch_object()) { $obj = new kontakt(); - + $obj->kontakt_id = $row->kontakt_id; $obj->person_id = $row->person_id; $obj->standort_id = $row->standort_id; @@ -567,10 +571,10 @@ class kontakt extends basis_db $obj->insertamum = $row->insertamum; $obj->insertvon = $row->insertvon; $obj->ext_id = $row->ext_id; - + $this->result[] = $obj; } - + return true; } else @@ -580,4 +584,4 @@ class kontakt extends basis_db } } } -?> \ No newline at end of file +?> diff --git a/locale/de-AT/profil.php b/locale/de-AT/profil.php old mode 100644 new mode 100755 index a761b8764..52f1c439d --- a/locale/de-AT/profil.php +++ b/locale/de-AT/profil.php @@ -5,7 +5,7 @@ $this->phrasen['profil/home']='HOME'; $this->phrasen['profil/meinCis']='Mein CIS'; $this->phrasen['profil/bildHochladen']='Profilfoto hochladen'; $this->phrasen['profil/email']='eMail'; -$this->phrasen['profil/kontaktPrivat']='Privat'; +$this->phrasen['profil/kontaktPrivat']='Private Kontakte'; $this->phrasen['profil/mobil']='Mobil'; $this->phrasen['profil/telefon']='Telefon'; $this->phrasen['profil/intern']='Intern'; diff --git a/locale/en-US/profil.php b/locale/en-US/profil.php old mode 100644 new mode 100755 index 10f490264..30ea23f1a --- a/locale/en-US/profil.php +++ b/locale/en-US/profil.php @@ -5,6 +5,7 @@ $this->phrasen['profil/mitarbeiter']='Employee'; $this->phrasen['profil/meinCis']='My CIS'; $this->phrasen['profil/bildHochladen']='Upload picture'; $this->phrasen['profil/email']='eMail'; +$this->phrasen['profil/kontaktPrivat']='Private Contacts'; $this->phrasen['profil/intern']='Intern'; $this->phrasen['profil/alias']='Alias'; $this->phrasen['profil/homepage']='Homepage'; diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 99fba7203..856a55922 100755 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -1522,6 +1522,33 @@ if (!$result = @$db->db_query("SELECT 1 FROM system.tbl_person_lock LIMIT 1")) echo ' system.tbl_person_lock hinzugefügt
'; } +// Spalte bezeichnung_mehrsprachig in public.tbl_kontakttyp +if(!$result = @$db->db_query("SELECT bezeichnung_mehrsprachig FROM public.tbl_kontakttyp LIMIT 1")) +{ + $qry = "ALTER TABLE public.tbl_kontakttyp ADD COLUMN bezeichnung_mehrsprachig varchar(128)[];"; + + if(!$db->db_query($qry)) + echo 'public.tbl_kontakttyp '.$db->db_last_error().'
'; + else + echo 'public.tbl_kontakttyp: Spalte bezeichnung_mehrsprachig hinzugefuegt!
'; + + // Bezeichnung_mehrsprachig aus existierender Bezeichnung vorausfuellen. Ein Eintrag fuer jede Sprache mit Content aktiv. + $qry_help = "SELECT index FROM public.tbl_sprache WHERE content=TRUE;"; + if(!$result = $db->db_query($qry_help)) + echo 'tbl_kontakttyp bezeichnung_mehrsprachig: Fehler beim ermitteln der Sprachen: '.$db->db_last_error().''; + else + { + $qry=''; + while($row = $db->db_fetch_object($result)) + $qry.= "UPDATE public.tbl_kontakttyp set bezeichnung_mehrsprachig[".$row->index."] = beschreibung;"; + + if(!$db->db_query($qry)) + echo 'Setzen der bezeichnung_mehrsprachig fehlgeschlagen: '.$db->db_last_error().'
'; + else + echo 'public.tbl_kontakttyp: bezeichnung_mehrprachig automatisch aus existierender Beschreibung uebernommen
'; + } +} + // INSERT Berechtigungen fuer web User erteilen fuer tbl_msg_status if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants WHERE table_name='tbl_msg_status' AND table_schema='public' AND grantee='web' AND privilege_type='INSERT'")) { @@ -2456,14 +2483,14 @@ if(!$result = @$db->db_query("SELECT lieferant FROM public.tbl_firma LIMIT 1")) echo '
public.tbl_firma: Spalte lieferant hinzugefuegt'; } -// INSERT, UPDATE und DELETE Berechtigungen fuer web User erteilen fuer tbl_rt_person und SEQUENCE public.tbl_rt_person_rt_person_id_seq +// INSERT, UPDATE und DELETE Berechtigungen fuer web User erteilen fuer tbl_rt_person und SEQUENCE public.tbl_rt_person_rt_person_id_seq if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants WHERE table_name='tbl_rt_person' AND table_schema='public' AND grantee='web' AND privilege_type='INSERT'")) { if($db->db_num_rows($result)==0) { $qry = "GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_rt_person TO web; GRANT SELECT, UPDATE ON SEQUENCE public.tbl_rt_person_rt_person_id_seq TO web;"; - + if(!$db->db_query($qry)) echo 'public.tbl_rt_person Berechtigungen: '.$db->db_last_error().'
'; else @@ -2648,7 +2675,7 @@ $tabellen=array( "public.tbl_gruppe" => array("gruppe_kurzbz","studiengang_kz","semester","bezeichnung","beschreibung","sichtbar","lehre","aktiv","sort","mailgrp","generiert","updateamum","updatevon","insertamum","insertvon","ext_id","orgform_kurzbz","gid","content_visible","gesperrt","zutrittssystem","aufnahmegruppe"), "public.tbl_kontakt" => array("kontakt_id","person_id","kontakttyp","anmerkung","kontakt","zustellung","updateamum","updatevon","insertamum","insertvon","ext_id","standort_id"), "public.tbl_kontaktmedium" => array("kontaktmedium_kurzbz","beschreibung"), - "public.tbl_kontakttyp" => array("kontakttyp","beschreibung"), + "public.tbl_kontakttyp" => array("kontakttyp","beschreibung","bezeichnung_mehrsprachig"), "public.tbl_konto" => array("buchungsnr","person_id","studiengang_kz","studiensemester_kurzbz","buchungstyp_kurzbz","buchungsnr_verweis","betrag","buchungsdatum","buchungstext","mahnspanne","updateamum","updatevon","insertamum","insertvon","ext_id","credit_points", "zahlungsreferenz", "anmerkung"), "public.tbl_lehrverband" => array("studiengang_kz","semester","verband","gruppe","aktiv","bezeichnung","ext_id","orgform_kurzbz","gid"), "public.tbl_log" => array("log_id","executetime","mitarbeiter_uid","beschreibung","sql","sqlundo"),