Adapted to send mails only if config['mail'] is TRUE

This commit is contained in:
Cris
2022-12-06 13:40:58 +01:00
parent 0197e5b175
commit d3a1ed222c
4 changed files with 44 additions and 20 deletions
@@ -264,7 +264,10 @@ class approveAnrechnungDetail extends Auth_Controller
* */
if (!isEmptyArray($retval))
{
self::_sendSanchoMailToLectors($retval);
if ($this->config->item('send_mail') === TRUE)
{
$this->_sendSanchoMailToLectors($anrechnung_id);
}
// Output json to ajax
return $this->outputJsonSuccess($retval);
@@ -235,13 +235,16 @@ class approveAnrechnungUebersicht extends Auth_Controller
}
/**
* Send mails to lectors
* Send mails
* NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
* even if they are required for more recommendations
* */
if (!isEmptyArray($retval))
{
self::_sendSanchoMailToLectors($retval);
if ($this->config->item('send_mail') === TRUE)
{
$this->_sendSanchoMail($retval);
}
}
// Output json to ajax
@@ -28,6 +28,9 @@ class reviewAnrechnungDetail extends Auth_Controller
)
);
// Load configs
$this->load->config('anrechnung');
// Load models
$this->load->model('education/Anrechnung_model', 'AnrechnungModel');
$this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
@@ -140,10 +143,13 @@ class reviewAnrechnungDetail extends Auth_Controller
* Send mails to STGL (if not present STGL, send to STGL assistance)
* NOTE: mails are sent at the end to ensure sending only one mail to each STGL
* */
if (!$this->_sendSanchoMails($json, true))
{
return $this->outputJsonError('Failed sending emails');
}
if ($this->config->item('send_mail') === TRUE)
{
if (!$this->_sendSanchoMails($json, true))
{
return $this->outputJsonError('Failed sending emails');
}
}
return $this->outputJsonSuccess($json);
}
@@ -191,10 +197,13 @@ class reviewAnrechnungDetail extends Auth_Controller
if (isset($json) && !isEmptyArray($json))
{
// Send mails to STGL (if not present STGL, send to STGL assistance)
if (!$this->_sendSanchoMails($json, false))
{
return $this->outputJsonError('Failed sending emails');
}
if ($this->config->item('send_mail') === TRUE)
{
if (!$this->_sendSanchoMails($json, false))
{
return $this->outputJsonError('Failed sending emails');
}
}
return $this->outputJsonSuccess($json);
}
@@ -26,6 +26,9 @@ class reviewAnrechnungUebersicht extends Auth_Controller
)
);
// Load configs
$this->load->config('anrechnung');
// Load models
$this->load->model('education/Anrechnung_model', 'AnrechnungModel');
$this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
@@ -111,16 +114,19 @@ class reviewAnrechnungUebersicht extends Auth_Controller
* Send mails to STGL (if not present STGL, send to STGL assistance)
* NOTE: mails are sent at the end to ensure sending only one mail to each STGL
* */
if (!$this->_sendSanchoMails($json, true))
{
show_error('Failed sending emails');
}
if ($this->config->item('send_mail') === TRUE)
{
if (!$this->_sendSanchoMails($json, true))
{
show_error('Failed sending emails');
}
}
return $this->outputJsonSuccess($json);
}
else
{
return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt'));
$this->terminateWithJsonError($this->p->t('ui', 'errorNichtAusgefuehrt'));
}
}
@@ -154,10 +160,13 @@ class reviewAnrechnungUebersicht extends Auth_Controller
if (isset($json) && !isEmptyArray($json))
{
// Send mails to STGL (if not present STGL, send to STGL assistance)
if (!$this->_sendSanchoMails($json, false))
{
show_error('Failed sending emails');
}
if ($this->config->item('send_mail') === TRUE)
{
if (!$this->_sendSanchoMails($json, false))
{
show_error('Failed sending emails');
}
}
return $this->outputJsonSuccess($json);
}