- MessageLib: Better error messages when sending messages

- Added a new constant for the messaging system
- Added a new phrase for the messaging system
This commit is contained in:
bison-paolo
2016-10-12 13:45:06 +02:00
parent 56cb58ca5e
commit 9df9ec8f41
4 changed files with 21 additions and 4 deletions
+1
View File
@@ -50,6 +50,7 @@ define('MSG_ERR_BODY_EMPTY', 41);
define('MSG_ERR_TEMPLATE_NOT_FOUND', 42);
define('MSG_ERR_DELIVERY_MESSAGE', 43);
define('MSG_ERR_CONTACT_NOT_FOUND', 44);
define('MSG_ERR_OU_CONTACTS_NOT_FOUND', 45);
define('MSG_ERR_INVALID_USER_ID', 100);
define('MSG_ERR_INVALID_MSG_ID', 101);
+2 -1
View File
@@ -24,4 +24,5 @@ $lang['message_' . MSG_STATUS_UPDATE] = 'Status updated';
$lang['message_' . MSG_PARTICIPANT_ADDED] = 'Participant added';
$lang['message_' . MSG_ERR_PARTICIPANT_EXISTS] = 'User is already participating in this thread';
$lang['message_' . MSG_ERR_PARTICIPANT_NONSYSTEM] = 'This user id is not in the system';
$lang['message_' . MSG_PARTICIPANT_REMOVED] = 'Participant removed from thread';
$lang['message_' . MSG_PARTICIPANT_REMOVED] = 'Participant removed from thread';
$lang['message_' . MSG_ERR_OU_CONTACTS_NOT_FOUND] = 'No receivers found for this organization unit';
+2 -1
View File
@@ -24,4 +24,5 @@ $lang['message_' . MSG_STATUS_UPDATE] = 'Status updated';
$lang['message_' . MSG_PARTICIPANT_ADDED] = 'Participant added';
$lang['message_' . MSG_ERR_PARTICIPANT_EXISTS] = 'User is already participating in this thread';
$lang['message_' . MSG_ERR_PARTICIPANT_NONSYSTEM] = 'This user id is not in the system';
$lang['message_' . MSG_PARTICIPANT_REMOVED] = 'Participant removed from thread';
$lang['message_' . MSG_PARTICIPANT_REMOVED] = 'Participant removed from thread';
$lang['message_' . MSG_ERR_OU_CONTACTS_NOT_FOUND] = 'No receivers found for this organization unit';
+16 -2
View File
@@ -217,6 +217,12 @@ class MessageLib
// If everything went ok
if (is_object($receivers) && $receivers->error == EXIT_SUCCESS && is_array($receivers->retval))
{
// If no receivers were found for this organization unit
if (count($receivers->retval) == 0)
{
$result = $this->_error($receivers->retval, MSG_ERR_OU_CONTACTS_NOT_FOUND);
}
// Looping on receivers
for ($i = 0; $i < count($receivers->retval); $i++)
{
@@ -341,8 +347,16 @@ class MessageLib
// If everything went ok
if (is_object($receivers) && $receivers->error == EXIT_SUCCESS && is_array($receivers->retval))
{
// Load reveiver data to get its relative language
$this->ci->load->model('person/Person_model', 'PersonModel');
// If no receivers were found for this organization unit
if (count($receivers->retval) == 0)
{
$result = $this->_error($receivers->retval, MSG_ERR_OU_CONTACTS_NOT_FOUND);
}
else
{
// Load reveiver data to get its relative language
$this->ci->load->model('person/Person_model', 'PersonModel');
}
// Looping on receivers
for ($i = 0; $i < count($receivers->retval); $i++)