MessageLib -> sendMessage: if no sender_id is specified the system default person_id will be used

This commit is contained in:
bison-paolo
2016-10-04 18:19:39 +02:00
parent 863d6af4eb
commit 1feec909cb
3 changed files with 5 additions and 6 deletions
+1
View File
@@ -4,6 +4,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
$config['msg_delivery'] = true;
$config['send_immediately'] = false; // If the message should be sent immediately
$config['system_person_id'] = 1; // Dummy sender, used for sending messages from the system
define('EMAIL_KONTAKT_TYPE', 'email'); // Email kontakt type
define('SENT_INFO_NEWLINE', '\n'); // tbl_msg_recipient->sentInfo separator
@@ -132,7 +132,7 @@ class Message extends APIv1_Controller
if (is_object($validation) && $validation->error == EXIT_SUCCESS)
{
$result = $this->messagelib->sendMessage(
$this->post()['person_id'],
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'],
@@ -204,10 +204,6 @@ class Message extends APIv1_Controller
{
return $this->_error('Parameter is null');
}
if (!isset($message['person_id']))
{
return $this->_error('person_id is not set');
}
if (!isset($message['subject']))
{
return $this->_error('subject is not set');
+3 -1
View File
@@ -199,7 +199,9 @@ class MessageLib
public function sendMessage($sender_id, $receiver_id, $subject, $body, $priority = PRIORITY_NORMAL, $relationmessage_id = null, $oe_kurzbz = null)
{
if (!is_numeric($sender_id))
return $this->_error('', MSG_ERR_INVALID_SENDER_ID);
{
$sender_id = $this->ci->config->item('system_person_id');
}
$receivers = null;