mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
- Fixed query building in method getMessages of model models/system/Recipient_model.php
- Better code in controller api/v1/system/Message.php - Adapted controller api/v1/system/Message.php to use sendMessageUser and sendMessageUserTemplate methods from MessageLib - Adapted model models/CL/Messages_model.php to use sendMessageUser and sendMessageUserTemplate methods from MessageLib - Adapted model models/CL/Messages_model.php to use function parseText - Removed constant MSG_INDX_PREFIX from MessageLib - Added constants to MessageLib: CFG_SYSTEM_PERSON_ID, CFG_SEND_IMMEDIATELY, CFG_MESSAGE_SERVER, CFG_MESSAGE_HTML_VIEW_URL, CFG_OU_RECEIVERS, NOTICE_TEMPLATE_HTML, NOTICE_TEMPLATE_TXT, NOTICE_TEMPLATE_FALLBACK_HTML, NOTICE_TEMPLATE_FALLBACK_TXT, EMAIL_KONTAKT_TYPE and SENT_INFO_NEWLINE - MessageLib does not load anymore library parser - Improved MessageLib code - Added private methodis _sendMessage, _getSender, _getNoticeBody, _getNoticeHTMLBody, _getNoticeTXTBody and _ouExists to MessageLib - Added public methods sendMessageUser, sendMessageUserTemplate and sendMessageOU to MessageLib - Renamed method sendAll to sendAllNotices in MessageLib - Renamed method sendOne to _sendNotice and changed it from public to private - Renamed method _checkReceiverId to _getReceiversByPersonId
This commit is contained in:
@@ -144,26 +144,26 @@ class Message extends APIv1_Controller
|
||||
*/
|
||||
public function postMessage()
|
||||
{
|
||||
$validation = $this->_validatePostMessage($this->post());
|
||||
$postMessage = $this->_validatePostMessage($this->post());
|
||||
|
||||
if (isSuccess($validation))
|
||||
if (isSuccess($postMessage))
|
||||
{
|
||||
$result = $this->messagelib->sendMessage(
|
||||
isset($this->post()['person_id']) ? $this->post()['person_id'] : null,
|
||||
isset($this->post()['receiver_id']) ? $this->post()['receiver_id'] : null,
|
||||
$this->post()['subject'],
|
||||
$this->post()['body'],
|
||||
PRIORITY_NORMAL,
|
||||
isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null,
|
||||
isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null, // Sender organisation unit
|
||||
isset($this->post()['multiPartMime']) ? $this->post()['multiPartMime'] : true
|
||||
$result = $this->messagelib->sendMessageUser(
|
||||
$this->post()['receiver_id']), // receiverPersonId
|
||||
$this->post()['subject'], // subject
|
||||
$this->post()['body'], // body
|
||||
$this->post()['person_id']) ? $this->post()['person_id'] : null, // sender_id
|
||||
isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null, // senderOU
|
||||
isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null, // relationmessage_id
|
||||
MSG_PRIORITY_NORMAL, // priority
|
||||
isset($this->post()['multiPartMime']) ? $this->post()['multiPartMime'] : true // multiPartMime
|
||||
);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response($validation, REST_Controller::HTTP_OK);
|
||||
$this->response($postMessage, REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,26 +172,27 @@ class Message extends APIv1_Controller
|
||||
*/
|
||||
public function postMessageVorlage()
|
||||
{
|
||||
$validation = $this->_validatePostMessageVorlage($this->post());
|
||||
$postMessage = $this->_validatePostMessageVorlage($this->post());
|
||||
|
||||
if (isSuccess($validation))
|
||||
if (isSuccess($postMessage))
|
||||
{
|
||||
$result = $this->messagelib->sendMessageVorlage(
|
||||
isset($this->post()['sender_id']) ? $this->post()['sender_id'] : null,
|
||||
isset($this->post()['receiver_id']) ? $this->post()['receiver_id'] : null,
|
||||
$this->post()['vorlage_kurzbz'],
|
||||
isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null, // Sender organisation unit
|
||||
$this->post()['data'],
|
||||
isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null,
|
||||
isset($this->post()['orgform_kurzbz']) ? $this->post()['orgform_kurzbz'] : null,
|
||||
isset($this->post()['multiPartMime']) ? $this->post()['multiPartMime'] : true
|
||||
$result = $this->messagelib->sendMessageUserTemplate(
|
||||
isset($this->post()['receiver_id']) ? $this->post()['receiver_id'] : null, // receiversPersonId
|
||||
$this->post()['vorlage_kurzbz'], // vorlage
|
||||
$this->post()['data'], // parseData
|
||||
isset($this->post()['orgform_kurzbz']) ? $this->post()['orgform_kurzbz'] : null, // orgform
|
||||
isset($this->post()['sender_id']) ? $this->post()['sender_id'] : null, // sender_id
|
||||
isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null, // senderOU
|
||||
isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null, // relationmessage_id
|
||||
MSG_PRIORITY_NORMAL, // priority
|
||||
isset($this->post()['multiPartMime']) ? $this->post()['multiPartMime'] : true // multiPartMime
|
||||
);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response($validation, REST_Controller::HTTP_OK);
|
||||
$this->response($postMessage, REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,26 +221,26 @@ class Message extends APIv1_Controller
|
||||
/**
|
||||
* _validatePostMessage
|
||||
*/
|
||||
private function _validatePostMessage($message = null)
|
||||
private function _validatePostMessage($post = null)
|
||||
{
|
||||
if (!isset($message))
|
||||
if (!isset($post))
|
||||
{
|
||||
return error('Parameter is null');
|
||||
}
|
||||
if (!isset($message['subject']))
|
||||
if (!isset($post['subject']))
|
||||
{
|
||||
return error('subject is not set');
|
||||
}
|
||||
if( !isset($message['body']))
|
||||
if (!isset($post['body']))
|
||||
{
|
||||
return error('body is not set');
|
||||
}
|
||||
if (!isset($message['receiver_id']) && !isset($message['oe_kurzbz']))
|
||||
if (!isset($post['receiver_id']))
|
||||
{
|
||||
return error('If a receiver_id is not given a oe_kurzbz must be specified');
|
||||
return error('receiver_id is not set');
|
||||
}
|
||||
|
||||
return success('Input data are valid');
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user