From 91d1740ef75adb70b4d80f8a837e2c3ff13bdce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Thu, 4 Oct 2007 15:50:45 +0000 Subject: [PATCH] --- include/person.class.php | 17 +++++---- vilesci/kommunikation/erinnerungsmail.php | 45 +++++++++++++++++++++++ 2 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 vilesci/kommunikation/erinnerungsmail.php diff --git a/include/person.class.php b/include/person.class.php index 5713ed1fb..e7e440a05 100644 --- a/include/person.class.php +++ b/include/person.class.php @@ -243,16 +243,19 @@ class person } } - //Pruefen ob bereits ein Eintrag mit dieser SVNR vorhanden ist - $qry = "SELECT person_id FROM public.tbl_person WHERE svnr='$this->svnr'"; - if($result = pg_query($this->conn, $qry)) + if($this->svnr!='') { - if($row = pg_fetch_object($result)) + //Pruefen ob bereits ein Eintrag mit dieser SVNR vorhanden ist + $qry = "SELECT person_id FROM public.tbl_person WHERE svnr='$this->svnr'"; + if($result = pg_query($this->conn, $qry)) { - if($row->person_id!=$this->person_id) + if($row = pg_fetch_object($result)) { - $this->errormsg = 'Es existiert bereits eine Person mit dieser SVNR'; - return false; + if($row->person_id!=$this->person_id) + { + $this->errormsg = 'Es existiert bereits eine Person mit dieser SVNR'; + return false; + } } } } diff --git a/vilesci/kommunikation/erinnerungsmail.php b/vilesci/kommunikation/erinnerungsmail.php new file mode 100644 index 000000000..fc78b5f4c --- /dev/null +++ b/vilesci/kommunikation/erinnerungsmail.php @@ -0,0 +1,45 @@ +, + * Andreas Oesterreicher and + * Rudolf Hangl . + */ +require_once('../config.inc.php'); + +if(!$conn = pg_pconnect(CONN_STRING)) + die('Fehler beim Connecten zur DB'); + +$qry = "SELECT distinct email FROM public.tbl_studiengang WHERE studiengang_kz!=0 AND email is not null"; + +$headers = "From: vilesci@technikum-wien.at"; +$message = "Dies ist eine automatische eMail!\nBitte überprüfen Sie die Lehrauftragsliste"; + +if($result = pg_query($conn, $qry)) +{ + while($row = pg_fetch_object($result)) + { + $to = "oesi@technikum-wien.at"; + $subject = "Erinnerung $row->email"; + + if(mail($to, $subject, $message, $headers)) + echo "Email an $to versandt\n"; + else + echo "Fehler beim Versenden des Erinnerungsmails an $to\n"; + } +} +?> \ No newline at end of file