Trigger interface does not set error eventmessage.
Improvement:
Show both trigger error and mail send succesful, so you know mail was
send succesful bot some trigger action after sending mail failed.
This commit is contained in:
fappels 2017-12-30 12:12:13 +01:00
parent 77be56ff74
commit b6e3d312ad

View File

@ -392,8 +392,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$error=0;
// FIXME This must be moved into the trigger for action $trigger_name // FIXME This must be moved into the trigger for action $trigger_name
if (! empty($conf->dolimail->enabled)) if (! empty($conf->dolimail->enabled))
{ {
@ -438,17 +436,11 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $errors=$interface->errors; setEventMessages($interface->error, $interface->errors, 'errors');
} }
} }
} }
if ($error)
{
// error message event set by trigger interface
}
else
{
// Redirect here // Redirect here
// This avoid sending mail twice if going out and then back to page // This avoid sending mail twice if going out and then back to page
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
@ -461,7 +453,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'')); header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:''));
exit; exit;
} }
}
else else
{ {
$langs->load("other"); $langs->load("other");