Merge pull request #10705 from atm-gauthier/8.0_fix_best_error_msg

FIX : if empty error message, we just see "error" displayed
This commit is contained in:
Laurent Destailleur 2019-02-28 11:25:13 +01:00 committed by GitHub
commit 74dec41496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -188,8 +188,8 @@ class MailingTargets // This can't be abstract as it is used for some method
if ($this->db->errno() != 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
// Si erreur autre que doublon
dol_syslog($this->db->error());
$this->error=$this->db->error();
dol_syslog($this->db->error().' : '.$targetarray['email']);
$this->error=$this->db->error().' : '.$targetarray['email'];
$this->db->rollback();
return -1;
}

View File

@ -179,7 +179,9 @@ class mailing_xinputfile extends MailingTargets
{
$i++;
$langs->load("errors");
$this->error = $langs->trans("ErrorFoundBadEmailInFile",$i,$cpt,$email);
$msg = $langs->trans("ErrorFoundBadEmailInFile", $i, $cpt, $email);
if (!empty($msg)) $this->error = $msg;
else $this->error = 'ErrorFoundBadEmailInFile '.$i.' '.$cpt.' '.$email; // We experience case where $langs->trans return an empty string.
}
}
}