Notice email for all people allowed to receive messages for an organisation unit

This commit is contained in:
Paolo
2019-11-06 16:34:20 +01:00
parent 2a4360862a
commit ece06bc462
3 changed files with 21 additions and 7 deletions
+9 -3
View File
@@ -528,17 +528,23 @@ class MessageLib
if (isError($messageResult)) return $messageResult; // if an error occured then return it
if (!hasData($messageResult)) return error('No data found with the given message id'); // if no data found then return an error
// If the message was sent to an organisation unit, then retrives the allowed people to receive the notice email for that organisation unit
$messages = getData($messageResult);
if (count($messages) == 1 && $messages[0]->receiver_id == $this->_ci->config->item(self::CFG_SYSTEM_PERSON_ID))
if (count($messages) == 1
&& $messages[0]->receiver_id == $this->_ci->config->item(self::CFG_SYSTEM_PERSON_ID)
&& !isEmptyString($messages[0]->oe_kurzbz))
{
$messages = $this->_ci->RecipientModel->getReceivedMessagesByOE(
$messageResult = $this->_ci->RecipientModel->getMessagesToSentToOE(
$messages[0]->oe_kurzbz,
$this->_ci->config->item(MessageLib::CFG_OU_RECEIVERS),
self::EMAIL_KONTAKT_TYPE
);
}
return $this->_sendNotice($messages);
if (isError($messageResult)) return $messageResult;
if (!hasData($messageResult)) return error('It is not possible to retrieve the recipient for this message: '.$message_id);
return $this->_sendNotice(getData($messageResult));
}
/**