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

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) // 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' || if ($_SERVER['REQUEST_METHOD'] == 'POST' ||
((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) || ((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 (!GETPOSTISSET('token')) {
if (GETPOST('uploadform', 'int')) { if (GETPOST('uploadform', 'int')) {