Fix phpcs
More secured sendEmailsReminder()
This commit is contained in:
parent
9868140693
commit
ed743c9dbb
@ -1965,6 +1965,8 @@ class ActionComm extends CommonObject
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$this->output = '';
|
$this->output = '';
|
||||||
$this->error = '';
|
$this->error = '';
|
||||||
|
$nbMailSend = 0;
|
||||||
|
$errorsMsg = array();
|
||||||
|
|
||||||
if (empty($conf->agenda->enabled)) // Should not happen. If module disabled, cron job should not be visible.
|
if (empty($conf->agenda->enabled)) // Should not happen. If module disabled, cron job should not be visible.
|
||||||
{
|
{
|
||||||
@ -2055,16 +2057,16 @@ class ActionComm extends CommonObject
|
|||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$errorsMsg[] = "Failed to update status of ActionComm Reminder";
|
$errorsMsg[] = "Failed to update status of ActionComm Reminder";
|
||||||
$error++;
|
//$error++; Do not add error here.
|
||||||
|
break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first.
|
||||||
|
} else {
|
||||||
|
$nbMailSend++;
|
||||||
}
|
}
|
||||||
else $nbMailSend++;
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
$errorsMsg[] = $cMailFile->error.' : '.$to;
|
$errorsMsg[] = $cMailFile->error.' : '.$to;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2087,12 +2089,14 @@ class ActionComm extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$this->output = 'Nb of emails sent : '.$nbMailSend;
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return (!empty($errorsMsg)) ? end($errorsMsg) : $error;
|
$this->error = (!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error;
|
||||||
|
return $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7977,6 +7977,7 @@ class Form
|
|||||||
*
|
*
|
||||||
* @param string $prefix Prefix
|
* @param string $prefix Prefix
|
||||||
* @param string $modelType Model type
|
* @param string $modelType Model type
|
||||||
|
* @param int $default 1=Show also Default mail template
|
||||||
* @return string HTML select string
|
* @return string HTML select string
|
||||||
*/
|
*/
|
||||||
public function selectModelMail($prefix, $modelType = '', $default = 0)
|
public function selectModelMail($prefix, $modelType = '', $default = 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user