Error management on emailcollector edition

This commit is contained in:
Laurent Destailleur 2020-12-22 17:22:24 +01:00
parent 083b6a8c87
commit 4fcf606d04
2 changed files with 15 additions and 13 deletions

View File

@ -135,12 +135,13 @@ if ($action == 'deletefilter')
{
$emailcollectorfilter = new EmailCollectorFilter($db);
$emailcollectorfilter->fetch(GETPOST('filterid', 'int'));
$result = $emailcollectorfilter->delete($user);
if ($result > 0)
{
$object->fetchFilters();
} else {
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
if ($emailcollectorfilter->id > 0) {
$result = $emailcollectorfilter->delete($user);
if ($result > 0) {
$object->fetchFilters();
} else {
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
}
}
}
@ -204,12 +205,13 @@ if ($action == 'deleteoperation')
{
$emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->fetch(GETPOST('operationid', 'int'));
$result = $emailcollectoroperation->delete($user);
if ($result > 0)
{
$object->fetchActions();
} else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
if ($emailcollectoroperation->id > 0) {
$result = $emailcollectoroperation->delete($user);
if ($result > 0) {
$object->fetchActions();
} else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
}
}
}

View File

@ -417,7 +417,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl
// Check all cases that need a token (all POST actions, all actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set, all sensitive GET actions)
if ($_SERVER['REQUEST_METHOD'] == 'POST' ||
((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) ||
in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof', 'deletepayment', 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_reject_check')))
in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_reject_check')))
{
if (!GETPOSTISSET('token')) {
if (GETPOST('uploadform', 'int')) {