From 21e43d7a0894ec036591cfc1e6d088a77a6ceb73 Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:37:49 +0200 Subject: [PATCH 01/13] Created DB view public.vw.msg_vars_user (data of logged in user) This data will be used by the messaging system to provide data of the logged in user. --- system/dbupdate_3.3.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 64f4f490a..3112bacbb 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -196,6 +196,43 @@ if(!$result = @$db->db_query("SELECT 1 FROM public.vw_msg_vars_person LIMIT 1")) echo '
Granted privileges to vilesci on public.vw_msg_vars_person'; } +// CREATE OR REPLACE VIEW public.vw_msg_vars_user and grants privileges +if(!$result = @$db->db_query("SELECT 1 FROM public.vw_msg_vars_user LIMIT 1")) +{ + $qry = ' + CREATE OR REPLACE VIEW public.vw_msg_vars_user AS ( + SELECT DISTINCT ON + (b.uid) b.uid, + p.vorname, + p.nachname, + b.alias, + ma.telefonklappe AS "durchwahl" + FROM public.tbl_person p + JOIN public.tbl_benutzer b USING (person_id) + JOIN public.tbl_mitarbeiter ma ON ma.mitarbeiter_uid = b.uid + WHERE ma.personalnummer > 0 + );'; + + if(!$db->db_query($qry)) + echo 'public.vw_msg_vars_user: '.$db->db_last_error().'
'; + else + echo '
public.vw_msg_vars_user view created'; + + $qry = 'GRANT SELECT ON TABLE public.vw_msg_vars_user TO web;'; + + if(!$db->db_query($qry)) + echo 'public.vw_msg_vars_user: '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on public.vw_msg_vars_user'; + + $qry = 'GRANT SELECT ON TABLE public.vw_msg_vars_user TO vilesci;'; + + if(!$db->db_query($qry)) + echo 'public.vw_msg_vars_user: '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on public.vw_msg_vars_user'; +} + //Spalte anmerkung und rechnungsadresse in tbl_adresse if(!$result = @$db->db_query("SELECT rechnungsadresse FROM public.tbl_adresse LIMIT 1")) { From 1be1d1c8e9b32b8bb47798901fd58f139b0b81eb Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:48:05 +0200 Subject: [PATCH 02/13] Added GUI for 'Eigene Felder' + layout adaptations . GUI: added multidropdown 'Eigene Felder', which contains fields of the logged in user . Layout: Message text area has now min and max height; sending button now aligned correctly; multidropdowns now aligned to text area Signed-off-by: Cris --- .../system/messages/htmlWriteTemplate.php | 31 ++++++++++++++++--- public/js/messaging/messageWrite.js | 7 ++++- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/application/views/system/messages/htmlWriteTemplate.php b/application/views/system/messages/htmlWriteTemplate.php index 199a88cfa..95ab12630 100644 --- a/application/views/system/messages/htmlWriteTemplate.php +++ b/application/views/system/messages/htmlWriteTemplate.php @@ -83,19 +83,41 @@ 19 ? 19 : count($variables); echo $this->widgetlib->widget( 'MultipleDropdown_widget', array('elements' => success($variables)), array( 'name' => 'variables[]', 'id' => 'variables', - 'size' => count($variables), + 'size' => $size, 'multiple' => true ) ); ?> - +
+
+ + + 5 ? 5 : count($user_fields); + echo $this->widgetlib->widget( + 'MultipleDropdown_widget', + array('elements' => success($user_fields)), + array( + 'name' => 'user_fields[]', + 'id' => 'user_fields', + 'size' => $size, + 'multiple' => true + ) + ); + ?> +

@@ -111,14 +133,15 @@ ?> -
-
+

diff --git a/public/js/messaging/messageWrite.js b/public/js/messaging/messageWrite.js index 3a3a23792..1978fc08c 100644 --- a/public/js/messaging/messageWrite.js +++ b/public/js/messaging/messageWrite.js @@ -46,7 +46,12 @@ $(document).ready(function () { tinymce.init({ selector: "#bodyTextArea", - plugins: "autoresize" + plugins: "autoresize", + autoresize_on_init: false, + autoresize_min_height: 400, + autoresize_max_height: 400, + autoresize_bottom_margin: 10, + auto_focus: "bodyTextArea" }); tinymce.init({ From 7ab2155d6a0098b3127e353ad4ed29a85170f63c Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:49:35 +0200 Subject: [PATCH 03/13] Added method to retrieve data of logged in user in Message model Signed-off-by: Cris --- application/models/system/Message_model.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 764c3ae14..5ebcc5ee9 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -191,4 +191,23 @@ class Message_model extends DB_Model return $this->execQuery(sprintf($query, is_array($person_id) ? 'IN' : '='), array($person_id)); } + + /** + * Get message vars for logged in user + * @param string $uid + * @return array|null + */ + public function getMsgVarsDataLoggedInUser() + { + $result = $this->db->query('SELECT * FROM public.vw_msg_vars_user WHERE uid = \''. getAuthUID(). '\''); + + if ($result) + { + return success($result->list_fields()); + } + else + { + return error($this->db->error(), FHC_DB_ERROR); + } + } } From a5e0c9ca5a89020cf0796f00bba657400a147a34 Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:52:12 +0200 Subject: [PATCH 04/13] Added logic to provide fields of logged in user in Messaging system Signed-off-by: Cris --- application/libraries/MessageLib.php | 25 ++++++++++++++++++++++++ application/models/CL/Messages_model.php | 21 ++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index fd2051f48..31d33eda4 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -215,6 +215,31 @@ class MessageLib return $messageVars; // otherwise returns the error } + + /** + * Retrieves message vars of the logged in user from view vw_msg_vars_user + */ + public function getMessageVarsLoggedInUser() + { + // Retrieves message vars from view vw_msg_vars + $messageVars = $this->_ci->MessageModel->getMsgVarsDataLoggedInUser(); + if (isSuccess($messageVars)) // if everything is ok + { + $variablesArray = array(); + $tmpVariablesArray = getData($messageVars); + + // Starts from 1 to skip the first element which is uid + for ($i = 1; $i < count($tmpVariablesArray); $i++) + { + $variablesArray['{my_'.str_replace(' ', '_', strtolower($tmpVariablesArray[$i])).'}'] + = 'my_'. strtoupper($tmpVariablesArray[$i]); + } + + return success($variablesArray); + } + + return $messageVars; // otherwise returns the error + } /** * Retrieves organisation units for each role that a user plays inside that organisation unit diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index 67e7ff969..2bec3dd9c 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -833,6 +833,26 @@ class Messages_model extends CI_Model $variables[] = $tmpVar; } + + // --------------------------------------------------------------------------------------- + // Retrieves message vars of logged in user from database view vw_msg_vars_person + $result = null; + + // If data contains a prestudent id + $result = $this->messagelib->getMessageVarsLoggedInUser(); + + if (isError($result)) show_error(getError($result)); + + // Then builds an array that contains objects with field name and field description of logged in user data + $user_fields = array(); + foreach (getData($result) as $id => $description) + { + $obj = new stdClass(); + $obj->id = $id; + $obj->description = $description; + + $user_fields[] = $obj; + } // --------------------------------------------------------------------------------------- // Retrieves the sender id @@ -853,6 +873,7 @@ class Messages_model extends CI_Model 'subject' => $replySubject, 'body' => $replyBody, 'variables' => $variables, + 'user_fields' => $user_fields, 'organisationUnits' => getData($organisationUnits), 'senderIsAdmin' => getData($senderIsAdmin), 'recipientsArray' => $recipientsArray, From 046994f14b667effcd07e120eaf153b3b508954e Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:53:56 +0200 Subject: [PATCH 05/13] Added phrase 'meineFelder' Signed-off-by: Cris --- system/phrasesupdate.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 14af8e733..2672d5b91 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -6766,6 +6766,26 @@ When on hold, the date is only a reminder.', ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'meineFelder', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Meine Felder', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'My fields', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From 634401485a5f857842e8a08a6431e7a7f1191526 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 28 May 2020 09:42:51 +0200 Subject: [PATCH 06/13] Renamed 'Meine Felder'-msg names and small method adaptation to retrieve fields Signed-off-by: Cris --- application/libraries/MessageLib.php | 6 +++--- application/models/system/Message_model.php | 17 +++++++++++++++++ system/dbupdate_3.3.php | 10 +++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index 31d33eda4..e0622e664 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -222,7 +222,7 @@ class MessageLib public function getMessageVarsLoggedInUser() { // Retrieves message vars from view vw_msg_vars - $messageVars = $this->_ci->MessageModel->getMsgVarsDataLoggedInUser(); + $messageVars = $this->_ci->MessageModel->getMsgVarsLoggedInUser(); if (isSuccess($messageVars)) // if everything is ok { $variablesArray = array(); @@ -231,8 +231,8 @@ class MessageLib // Starts from 1 to skip the first element which is uid for ($i = 1; $i < count($tmpVariablesArray); $i++) { - $variablesArray['{my_'.str_replace(' ', '_', strtolower($tmpVariablesArray[$i])).'}'] - = 'my_'. strtoupper($tmpVariablesArray[$i]); + $variablesArray['{'.str_replace(' ', '_', strtolower($tmpVariablesArray[$i])).'}'] + = strtoupper($tmpVariablesArray[$i]); } return success($variablesArray); diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 5ebcc5ee9..0972f127f 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -171,6 +171,23 @@ class Message_model extends DB_Model return error($this->db->error(), FHC_DB_ERROR); } } + + /** + * Get message variables for logged in user + */ + public function getMsgVarsLoggedInUser() + { + $result = $this->db->query('SELECT * FROM public.vw_msg_vars_user WHERE 0 = 1'); + + if ($result) + { + return success($result->list_fields()); + } + else + { + return error($this->db->error(), FHC_DB_ERROR); + } + } /** * getMsgVarsDataByPrestudentId diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 3112bacbb..f0da8fab6 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -202,11 +202,11 @@ if(!$result = @$db->db_query("SELECT 1 FROM public.vw_msg_vars_user LIMIT 1")) $qry = ' CREATE OR REPLACE VIEW public.vw_msg_vars_user AS ( SELECT DISTINCT ON - (b.uid) b.uid, - p.vorname, - p.nachname, - b.alias, - ma.telefonklappe AS "durchwahl" + (b.uid) b.uid AS "my_uid", + p.vorname AS "my_vorname", + p.nachname AS "my_nachname", + b.alias AS "my_alias", + ma.telefonklappe AS "my_durchwahl" FROM public.tbl_person p JOIN public.tbl_benutzer b USING (person_id) JOIN public.tbl_mitarbeiter ma ON ma.mitarbeiter_uid = b.uid From ebd9c2c0ba8fc1efe22f3e0933c20d165e5a8b6e Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 28 May 2020 09:46:15 +0200 Subject: [PATCH 07/13] Added method to retrieve message vars data of the logged in user This method retrieves the specific data of the logged in user to be used in 'Meine Felder' Signed-off-by: Cris --- application/models/system/Message_model.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 0972f127f..6f2a3c7ed 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -210,21 +210,13 @@ class Message_model extends DB_Model } /** - * Get message vars for logged in user - * @param string $uid + * Get message vars data for logged in user * @return array|null */ - public function getMsgVarsDataLoggedInUser() + public function getMsgVarsDataByLoggedInUser() { - $result = $this->db->query('SELECT * FROM public.vw_msg_vars_user WHERE uid = \''. getAuthUID(). '\''); + $query = 'SELECT * FROM public.vw_msg_vars_user WHERE my_uid = ?'; - if ($result) - { - return success($result->list_fields()); - } - else - { - return error($this->db->error(), FHC_DB_ERROR); - } + return $this->execQuery($query, array(getAuthUID())); } } From 4f1796ee9d969812273f1e637d9ad5ad3c657a39 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 28 May 2020 09:48:31 +0200 Subject: [PATCH 08/13] Added logic to add message vars data of logged in user into message body Signed-off-by: Cris --- application/models/CL/Messages_model.php | 39 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index 2bec3dd9c..d0676c5dd 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -393,7 +393,10 @@ class Messages_model extends CI_Model // Looping on receivers data foreach (getData($msgVarsData) as $receiver) { - $msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)$receiver); // replaces array keys + // Merge receivers data with logged in user data + $msgVarsDataArray = $this->_addMsgVarsDataOfLoggedInUser($receiver); + + $msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)getData($msgVarsDataArray)[0]); // replaces array keys $parsedSubject = parseText($subject, $msgVarsDataArray); $parsedBody = parseText($body, $msgVarsDataArray); @@ -600,6 +603,9 @@ class Messages_model extends CI_Model $parseMessageText = error('The given person_id is not a valid number'); if (is_numeric($person_id)) $parseMessageText = $this->MessageModel->getMsgVarsDataByPersonId($person_id); + + // Add message vars data of the logged in user + $parseMessageText = $this->_addMsgVarsDataOfLoggedInUser($parseMessageText); if (hasData($parseMessageText)) { @@ -623,7 +629,10 @@ class Messages_model extends CI_Model $parseMessageText = error('The given prestudent_id is not a valid number'); if (is_numeric($prestudent_id)) $parseMessageText = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); - + + // Add message vars data of the logged in user + $parseMessageText = $this->_addMsgVarsDataOfLoggedInUser($parseMessageText); + if (hasData($parseMessageText)) { $parseMessageText = success( @@ -882,4 +891,30 @@ class Messages_model extends CI_Model 'type' => $type ); } + + /** + * Adds message vars data of the logged in user to the given object (that should also have message vars data) + * @param object $otherMsgVarsDataObj Can be success object or simple object. + * @return object Returns success object. + */ + public function _addMsgVarsDataOfLoggedInUser($otherMsgVarsDataObj) + { + // First check if param type is object + if (!is_object($otherMsgVarsDataObj)) show_error('Must pass an object to merge with data of logged in user'); + + // If it is a return object, extract the simple data object + if (isSuccess($otherMsgVarsDataObj)) + { + $otherMsgVarsDataObj = getData($otherMsgVarsDataObj)[0]; + } + + // Retrieve message vars data of the logged in user + if (!$msgVarsDataLoggedInUser = getData($this->MessageModel->getMsgVarsDataByLoggedInUser())[0]) + { + return success($otherMsgVarsDataObj); // If failed, return at least given object as expected success object + } + + return success(array((object)(array_merge((array) $otherMsgVarsDataObj, (array) $msgVarsDataLoggedInUser)))); + + } } From 8b80f2226e63c3b3471082946cdd91113a7540e5 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 15:03:31 +0200 Subject: [PATCH 09/13] Added logic for cronjob to add senders fields into message body Signed-off-by: Cris --- application/models/CL/Messages_model.php | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index d0676c5dd..ac3a16e3e 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -48,6 +48,9 @@ class Messages_model extends CI_Model $this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel'); // Loads model Prestudent_model $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + // Loads model Benutzer_model + $this->load->model('person/Benutzer_model', 'BenutzerModel'); + } //------------------------------------------------------------------------------------------------------------------ @@ -463,6 +466,14 @@ class Messages_model extends CI_Model if (!hasData($msgVarsData)) show_error('No recipients were given'); $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents); + + // Get the senders uid + $this->BenutzerModel->addSelect('uid'); + if (!$result = getData($this->BenutzerModel->getFromPersonId($sender_id))) + { + show_error('No sender_uid found'); + } + $sender_uid = $result[0]->uid; // Adds the organisation unit to each prestudent if (isEmptyString($oe_kurzbz) && hasData($msgVarsData) && hasData($prestudentsData)) @@ -472,7 +483,15 @@ class Messages_model extends CI_Model foreach (getData($msgVarsData) as $receiver) { - $msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)$receiver); // replaces array keys + /** + * Merge receivers data with senders data + * NOTE: _addMsgVarsDataOfLoggedInUser usually retrieves data of the logged in user that is set in the + * templates user fields. As sendExplicitTemplateSenderId is run by a job, a sender uid is passed to be used + * instead the logged in user. + */ + $msgVarsDataArray = $this->_addMsgVarsDataOfLoggedInUser($receiver, $sender_uid); + + $msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)getData($msgVarsDataArray)[0]); // replaces array keys // Additional message variables if (is_array($msgVars)) $msgVarsDataArray = array_merge($msgVarsDataArray, $msgVars); @@ -897,7 +916,7 @@ class Messages_model extends CI_Model * @param object $otherMsgVarsDataObj Can be success object or simple object. * @return object Returns success object. */ - public function _addMsgVarsDataOfLoggedInUser($otherMsgVarsDataObj) + public function _addMsgVarsDataOfLoggedInUser($otherMsgVarsDataObj, $uid = null) { // First check if param type is object if (!is_object($otherMsgVarsDataObj)) show_error('Must pass an object to merge with data of logged in user'); @@ -909,7 +928,7 @@ class Messages_model extends CI_Model } // Retrieve message vars data of the logged in user - if (!$msgVarsDataLoggedInUser = getData($this->MessageModel->getMsgVarsDataByLoggedInUser())[0]) + if (!$msgVarsDataLoggedInUser = getData($this->MessageModel->getMsgVarsDataByLoggedInUser($uid))[0]) { return success($otherMsgVarsDataObj); // If failed, return at least given object as expected success object } From d35ee0c834becab5700ba448284864d4b49f749e Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 15:06:22 +0200 Subject: [PATCH 10/13] Adapted method to retrieve user fields when method is called by a cronjob Signed-off-by: Cris --- application/models/system/Message_model.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 6f2a3c7ed..d9f8585ed 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -211,12 +211,23 @@ class Message_model extends DB_Model /** * Get message vars data for logged in user + * @param string uid The UID should ONLY be passed if this method is called by a cronjob. + * This is to enable jobs to use templates which use logged-in-user fields ('Eigene Felder'). * @return array|null */ - public function getMsgVarsDataByLoggedInUser() + public function getMsgVarsDataByLoggedInUser($uid = null) { + if (is_string($uid)) + { + $params = array($uid); + } + else + { + $params = array(getAuthUID()); + } + $query = 'SELECT * FROM public.vw_msg_vars_user WHERE my_uid = ?'; - return $this->execQuery($query, array(getAuthUID())); + return $this->execQuery($query, $params); } } From 2906c1803e9d0caf5cac630730eb1de18ce2cdac Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 16:29:51 +0200 Subject: [PATCH 11/13] Changed 'Eigene Felder'-Alias: if alias is NULL, uid is used as alias This is to ensure the email is built correctly. Signed-off-by: Cris --- system/dbupdate_3.3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index f0da8fab6..f03718116 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -205,7 +205,7 @@ if(!$result = @$db->db_query("SELECT 1 FROM public.vw_msg_vars_user LIMIT 1")) (b.uid) b.uid AS "my_uid", p.vorname AS "my_vorname", p.nachname AS "my_nachname", - b.alias AS "my_alias", + COALESCE(b.alias, b.uid) AS "my_alias", ma.telefonklappe AS "my_durchwahl" FROM public.tbl_person p JOIN public.tbl_benutzer b USING (person_id) From 8304b4a1ae50668156b127e17bda2948a70057aa Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 16:31:52 +0200 Subject: [PATCH 12/13] Adapted GUI: display user fields in tinymce-editor on doubleclick Signed-off-by: Cris --- public/js/messaging/messageWrite.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/public/js/messaging/messageWrite.js b/public/js/messaging/messageWrite.js index 1978fc08c..8b1d73bdf 100644 --- a/public/js/messaging/messageWrite.js +++ b/public/js/messaging/messageWrite.js @@ -78,6 +78,21 @@ $(document).ready(function () }); } + if ($("#user_fields")) + { + $("#user_fields").dblclick(function () + { + if ($("#bodyTextArea")) + { + //if editor active add at cursor position, otherwise at end + if (tinymce.activeEditor.id === "bodyTextArea") + tinymce.activeEditor.execCommand('mceInsertContent', false, $(this).children(":selected").val()); + else + tinyMCE.get("bodyTextArea").setContent(tinyMCE.get("bodyTextArea").getContent() + $(this).children(":selected").val()); + } + }); + } + if ($("#recipients")) { $("#recipients").change(tinymcePreviewSetContent); From 742c9fa8572745b9f7c4a570bf6bb4550eac30df Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 4 Jun 2020 11:33:58 +0200 Subject: [PATCH 13/13] Check that user is an active employee in message-cronjob Signed-off-by: Cris --- application/models/CL/Messages_model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index ac3a16e3e..f24e16086 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -467,8 +467,9 @@ class Messages_model extends CI_Model $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents); - // Get the senders uid + // Get the senders uid (if user is an active employee) $this->BenutzerModel->addSelect('uid'); + $this->BenutzerModel->addJoin('public.tbl_mitarbeiter ma', 'ma.mitarbeiter_uid = uid'); if (!$result = getData($this->BenutzerModel->getFromPersonId($sender_id))) { show_error('No sender_uid found');