Error management

This commit is contained in:
atm-lena 2020-08-26 17:02:34 +02:00
parent cc29654f47
commit efe60ebc58
3 changed files with 12 additions and 2 deletions

View File

@ -387,7 +387,7 @@ if (empty($reshook) && $action == 'add')
$moreparam = '';
if ($user->id != $object->userownerid) $moreparam = "filtert=-1"; // We force to remove filter so created record is visible when going back to per user view.
//Reminder
//Create eminder
if($addreminder == 'on'){
$actionCommReminder = new ActionCommReminder($db);
@ -416,6 +416,15 @@ if (empty($reshook) && $action == 'add')
if($remindertype == 'email') $actionCommReminder->fk_email_template = $modelmail;
$res = $actionCommReminder->create($user);
if($res <= 0){
// If error
$db->rollback();
$langs->load("errors");
$error = $langs->trans('ErrorReminderActionCommCreation');
setEventMessages($error, null, 'errors');
$action = 'create'; $donotclearsession = 1;
}
}
$db->commit();

View File

@ -1082,3 +1082,4 @@ MODIFYInDolibarr=Record %s modified
DELETEInDolibarr=Record %s deleted
VALIDATEInDolibarr=Record %s validated
APPROVEDInDolibarr=Record %s approved
ErrorReminderActionCommCreation=Error creating the reminder notification for this event

View File

@ -1043,4 +1043,4 @@ AmountMustBePositive=Le montant doit être positif.
ByStatus=Par statut
InformationMessage=Information
ASAP=Dès que possible
ErrorReminderActionCommCreation=Erreur lors de la création de la notification de rappel de cet événement