Fixing style errors.

This commit is contained in:
stickler-ci 2020-09-01 08:17:19 +00:00
parent 86c6ef23e3
commit 763515a4ca

View File

@ -1989,22 +1989,19 @@ class ActionComm extends CommonObject
$sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE typeremind = 'email' AND status = 0"; $sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE typeremind = 'email' AND status = 0";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if($resql){ if ($resql){
while($obj = $this->db->fetch_object($resql)){ while ($obj = $this->db->fetch_object($resql)){
$actionCommReminder = new ActionCommReminder($this->db); $actionCommReminder = new ActionCommReminder($this->db);
$res = $actionCommReminder->fetch($obj->id); $res = $actionCommReminder->fetch($obj->id);
if($res < 0) { if ($res < 0) {
$error++; $error++;
$errorsMsg[] = "Failed to load invoice ActionComm Reminder"; $errorsMsg[] = "Failed to load invoice ActionComm Reminder";
} }
if(!$error) if (!$error)
{ {
if ($actionCommReminder->dateremind <= dol_now()) if ($actionCommReminder->dateremind <= dol_now())
{ {
//Select email template //Select email template
$formmail = new FormMail($this->db); $formmail = new FormMail($this->db);
$arraymessage = $formmail->getEMailTemplate($this->db, 'actioncomm_send', $user, $langs, (!empty($actionCommReminder->fk_email_template)) ? $actionCommReminder->fk_email_template : -1, 1); $arraymessage = $formmail->getEMailTemplate($this->db, 'actioncomm_send', $user, $langs, (!empty($actionCommReminder->fk_email_template)) ? $actionCommReminder->fk_email_template : -1, 1);
@ -2030,15 +2027,14 @@ class ActionComm extends CommonObject
$recipient = new User($this->db); $recipient = new User($this->db);
$res = $recipient->fetch($actionCommReminder->fk_user); $res = $recipient->fetch($actionCommReminder->fk_user);
if ($res > 0 && !empty($recipient->email)) $to = $recipient->email; if ($res > 0 && !empty($recipient->email)) $to = $recipient->email;
else else {
{
$errorsMsg[] = "Failed to load recipient"; $errorsMsg[] = "Failed to load recipient";
$error++; $error++;
} }
// Sender // Sender
$from = $conf->global->MAIN_MAIL_EMAIL_FROM; $from = $conf->global->MAIN_MAIL_EMAIL_FROM;
if(empty($from)) { if (empty($from)) {
$errorsMsg[] = "Failed to load recipient"; $errorsMsg[] = "Failed to load recipient";
$error++; $error++;
} }
@ -2061,14 +2057,12 @@ class ActionComm extends CommonObject
} }
else $nbMailSend++; else $nbMailSend++;
} }
else else {
{
$errorsMsg[] = $cMailFile->error.' : '.$to; $errorsMsg[] = $cMailFile->error.' : '.$to;
$error++; $error++;
} }
} }
else else {
{
$error++; $error++;
} }
} }
@ -2078,20 +2072,19 @@ class ActionComm extends CommonObject
$error++; $error++;
} }
if(!$error) if (!$error)
{ {
// Delete also very old past events (we do not keep more than 1 month record in past) // Delete also very old past events (we do not keep more than 1 month record in past)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if(!$resql) { if (!$resql) {
$errorsMsg[] = 'Failed to delete old reminders'; $errorsMsg[] = 'Failed to delete old reminders';
$error ++; $error ++;
} }
} }
if(!$error) { if (!$error) {
$this->db->commit(); $this->db->commit();
return 0; return 0;
} }