- Renamed public/js/messaging/messageClient.js to public/js/messaging/read.js

- Added new JS public/js/messaging/write.js used in view application/views/system/messages/ajaxWrite.php
- Added new public method write, listReceivedMessages, listSentMessages and sendMessageToOU to controller system/messages/MessageClient.php
- Removed private method _getReceiversByOekurzbz from MessageLib
- Fixed method sendMessageOU of MessageLib
- Added new public method prepareAjaxWrite to model CL/Messages_model
- Fixed method prepareAjaxReadReceived of model CL/Messages_model
- Added new public method prepareAjaxReadSent to model CL/Messages_model
- Changed method CL/Messages_model->_personLog interface
- Added new public method getOrganisationunitsByPersonId to crm/Prestudent_model
- Added new public method getReceivedMessages to model system/Recipient_model
- Changed getReceivedMessages method of model system/Recipient_model
- Changed view system/messages/ajaxRead.php
- Added new view system/messages/ajaxWrite.php
This commit is contained in:
Paolo
2019-06-28 19:01:25 +02:00
parent 27ccd086ac
commit 34dc82766a
11 changed files with 449 additions and 120 deletions
+3 -19
View File
@@ -128,7 +128,9 @@ class MessageLib
// If the recipient is an organisation unit that would be possible to send the same message (same message id)
// to the entire organisation unit (one to many functionality)
// In this case the receiver id is a the one present in message configuration
$receivers = success(array($this->_ci->config->item(self::CFG_SYSTEM_PERSON_ID)));
$receiver = new stdClass();
$receiver->person_id = $this->_ci->config->item(self::CFG_SYSTEM_PERSON_ID);
$receivers = success(array($receiver));
// Send the message and return the result
return $this->_sendMessage($receivers, $receiversOU, $subject, $body, $sender_id, $senderOU, $relationmessage_id, $priority, $multiPartMime);
@@ -373,24 +375,6 @@ class MessageLib
}
}
/**
* Gets the receivers id that are enabled to read messages for that oe_kurzbz
*/
private function _getReceiversByOekurzbz($oe_kurzbz)
{
// Load Benutzerfunktion_model
$this->_ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
// Join with table public.tbl_benutzer on field uid
$this->_ci->BenutzerfunktionModel->addJoin('public.tbl_benutzer', 'uid');
// Get all the valid receivers id using the oe_kurzbz
$receivers = $this->_ci->BenutzerfunktionModel->loadWhere(
'oe_kurzbz = '.$this->_ci->db->escape($oe_kurzbz).
' AND funktion_kurzbz = '.$this->_ci->db->escape($this->_ci->config->item(self::CFG_OU_RECEIVERS)).
' AND (NOW() BETWEEN COALESCE(datum_von, NOW()) AND COALESCE(datum_bis, NOW()))'
);
return $receivers;
}
/**
* Save a new message in DB
*/