mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 07:52:16 +00:00
Notice email for all people allowed to receive messages for an organisation unit
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -379,9 +379,9 @@ class Recipient_model extends DB_Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets only the recieved messages from an organisation unit where this person plays a role given by the parameter functions
|
||||
* Get all the messages to sent to an organisation unit
|
||||
*/
|
||||
public function getReceivedMessagesByOE($oe_kurzbz, $functions, $kontaktType)
|
||||
public function getMessagesToSentToOE($oe_kurzbz, $functions, $kontaktType)
|
||||
{
|
||||
// Messages sent to a person that belongs to the recipient organisation unit
|
||||
$sql = 'SELECT mm.message_id,
|
||||
@@ -427,7 +427,7 @@ class Recipient_model extends DB_Model
|
||||
) mb ON (mb.person_id = mm.person_id)
|
||||
WHERE bf.oe_kurzbz = ?
|
||||
AND mrou.sent IS NULL
|
||||
AND mrou.sentinfo IS NOT NULL
|
||||
AND mrou.sentinfo IS NULL
|
||||
GROUP BY mm.message_id,
|
||||
mm.subject,
|
||||
mm.body,
|
||||
|
||||
@@ -22,7 +22,15 @@ function sendMessageToOU()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
FHC_DialogLib.alertSuccess("Message sent succesfully");
|
||||
|
||||
if (FHC_AjaxClient.isSuccess(data))
|
||||
{
|
||||
FHC_DialogLib.alertSuccess("Message sent succesfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
FHC_DialogLib.alertError("Error");
|
||||
}
|
||||
},
|
||||
errorCallback: function() {
|
||||
FHC_DialogLib.alertError("Error");
|
||||
|
||||
Reference in New Issue
Block a user