From 9c83ee6b0609266df2bad0926556bcafd7c9d1cd Mon Sep 17 00:00:00 2001 From: cris-technikum <31620366+cris-technikum@users.noreply.github.com> Date: Mon, 30 Oct 2017 15:58:53 +0100 Subject: [PATCH] Coodle: optimized informations in infomail Automatically generated feedback mails from each participant responding contains now: . clear subject name . name of participant and name of meeting . linked URL goes to specific meeting overview plus . author doesn't get any redundant email anymore (after sending final date to all participants) --- cis/private/coodle/coodle_worker.php | 30 ++++++++++++------- cis/public/coodle.php | 18 +++++++----- include/coodle.class.php | 43 ++++++++++++++-------------- 3 files changed, 51 insertions(+), 40 deletions(-) diff --git a/cis/private/coodle/coodle_worker.php b/cis/private/coodle/coodle_worker.php index 000ae50a8..a16fe553c 100644 --- a/cis/private/coodle/coodle_worker.php +++ b/cis/private/coodle/coodle_worker.php @@ -47,7 +47,7 @@ switch($work) if(isset($_POST['id'])) $id=$_POST['id']; else - die('RessourceID Missing'); + die('RessourceID Missing'); if(isset($_POST['typ'])) $typ=$_POST['typ']; else @@ -62,7 +62,7 @@ switch($work) if($coodle->ersteller_uid!=$user) die('Diese Aktion ist nur durch den Ersteller der Umfrage möglich'); - + $uid=''; $ort=''; $email=''; @@ -74,7 +74,7 @@ switch($work) case 'Person': $uid = $id; break; case 'Extern': $email = $id; - $name=$bezeichnung; + $name = $bezeichnung; break; case 'Gruppe': $gruppe_kurzbz = $id; break; default: die('Ungueltiger Typ:'.$typ); break; @@ -85,14 +85,14 @@ switch($work) $gruppe = new gruppe(); if(!$gruppe->loadUser($gruppe_kurzbz)) die('Fehler: '.$gruppe->errormsg); - + foreach($gruppe->result as $row) { $coodle->coodle_id = $coodle_id; $coodle->uid = $row->uid; $coodle->ort_kurzbz = $ort; - $coodle->email = $email; - $coodle->name = $name; + $coodle->email = $row->uid .'@'.DOMAIN; + $coodle->name = $row->vorname . ' ' . $row->nachname; $coodle->zugangscode = uniqid(); $coodle->insertamum = date('Y-m-d H:i:s'); $coodle->insertvon = $user; @@ -114,18 +114,26 @@ switch($work) { if($coodle->RessourceExists($coodle_id, $uid, $ort, $email)) die('Ressource ist bereits zugeteilt'); - + $coodle->coodle_id = $coodle_id; $coodle->uid = $uid; - $coodle->ort_kurzbz = $ort; - $coodle->email = $email; - $coodle->name = $name; + $coodle->ort_kurzbz = $ort; + if ($typ == 'Person') + { + $coodle->email = $uid.'@'.DOMAIN; + $coodle->name = implode(' ', array_reverse(explode(' ', $bezeichnung))); + } + if ($typ == 'Extern') + { + $coodle->email = $email; + $coodle->name = $bezeichnung; + } $coodle->zugangscode = uniqid(); $coodle->insertamum = date('Y-m-d H:i:s'); $coodle->insertvon = $user; $coodle->updateamum = date('Y-m-d H:i:s'); $coodle->updatevon = $user; - + if($coodle->saveRessource(true)) echo 'true'; else diff --git a/cis/public/coodle.php b/cis/public/coodle.php index 5750880df..ac007146b 100755 --- a/cis/public/coodle.php +++ b/cis/public/coodle.php @@ -121,9 +121,9 @@ if(isset ($_POST['save'])) { $coodle_help->load($coodle_id); // email an ersteller senden wenn option aktiviert - if ($coodle_help->mailversand) + if ($coodle_help->mailversand && (!isset($_POST['auswahl_termin']))) sendBenachrichtigung($coodle_id,$teilnehmer_uid); - + $saveOk=true; } } @@ -665,7 +665,10 @@ echo '

*/ function sendBenachrichtigung($coodle_id,$teilnehmer_id) { + global $uid; + global $coodle; $coodle_send = new coodle(); + if(!$coodle_send->load($coodle_id)) { die("Fehler beim senden aufgetreten"); @@ -686,7 +689,7 @@ function sendBenachrichtigung($coodle_id,$teilnehmer_id) } $mitarbeiter->load($coodle_send->ersteller_uid); $person->load($mitarbeiter->person_id); - + $email = ''; $name = ''; @@ -699,13 +702,14 @@ function sendBenachrichtigung($coodle_id,$teilnehmer_id) $email.= 'Sehr geehrte Frau '.$name."!

"; else $email.="Sehr geehrter Herr ".$name."!

"; - - $email.= $tn." hat einen Termin Ihrer Coodle-Umfrage ausgewählt
Link zu Ihrer Coodle Übersicht

Mit freundlichen Grüßen

+ + $link = APP_ROOT.'cis/public/coodle.php?coodle_id='.urlencode($coodle_id).'&uid='.urlencode($uid); + $email.= $tn.' hat einen Termin zu Ihrer Coodle-Umfrage mit dem Thema "'.$coodle->titel.'" ausgewählt.
Link zu Ihrer Coodle Umfrage

Mit freundlichen Grüßen

Fachhochschule Technikum Wien
Höchstädtplatz 6
- 1200 Wien"; + 1200 Wien'; - $mail = new mail($coodle_send->ersteller_uid.'@'.DOMAIN, 'no-reply', 'Coodle Umfrage', 'Bitte sehen Sie sich die Nachricht in HTML Sicht an, um den Link vollständig darzustellen.'); + $mail = new mail($coodle_send->ersteller_uid.'@'.DOMAIN, 'no-reply', 'Feedback zu Ihrer Coodle Umfrage "' . $coodle->titel . '"', 'Bitte sehen Sie sich die Nachricht in HTML Sicht an, um den Link vollständig darzustellen.'); $mail->setHTMLContent($email); if(!$mail->send()) die("Fehler beim senden des Mails aufgetreten"); diff --git a/include/coodle.class.php b/include/coodle.class.php index 739a8ed25..deee3ef63 100755 --- a/include/coodle.class.php +++ b/include/coodle.class.php @@ -567,6 +567,7 @@ class coodle extends basis_db */ public function getRessourceFromUser($coodle_id, $uid='', $zugangscode='') { + $qry ="SELECT * FROM campus.tbl_coodle_ressource WHERE coodle_id =".$this->db_add_param($coodle_id, FHC_INTEGER, false); @@ -575,36 +576,34 @@ class coodle extends basis_db if ($zugangscode != '') $qry.= " AND zugangscode = ".$this->db_add_param($zugangscode, FHC_STRING, false); - $qry.= ';'; - if($result = $this->db_query($qry)) + if(!$this->db_query($qry)) { - if($row = $this->db_fetch_object($result)) - { - $this->coodle_ressource_id = $row->coodle_ressource_id; - $this->coodle_id = $row->coodle_id; - $this->uid = $row->uid; - $this->ort_kurzbz = $row->ort_kurzbz; - $this->email = $row->email; - $this->name = $row->name; - $this->zugangscode = $row->zugangscode; - $this->insertamum = $row->insertamum; - $this->insertvon = $row->insertvon; - $this->updateamum = $row->updateamum; - $this->updatevon = $row->updatevon; - } - else - { - return false; - } - return true; + $this->errormsg = 'Fehler bei einer Datenbankabfrage'; + return false; + } + + if ($row = $this->db_fetch_object()) + { + $this->coodle_ressource_id = $row->coodle_ressource_id; + $this->coodle_id = $row->coodle_id; + $this->uid = $row->uid; + $this->ort_kurzbz = $row->ort_kurzbz; + $this->email = $row->email; + $this->name = $row->name; + $this->zugangscode = $row->zugangscode; + $this->insertamum = $row->insertamum; + $this->insertvon = $row->insertvon; + $this->updateamum = $row->updateamum; + $this->updatevon = $row->updatevon; } else { $this->errormsg = "Fehler bei der Abfrage aufgetreten"; return false; - } + } + return true; } /**