diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index adfaaf4f816..6525013c6bc 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -153,13 +153,21 @@ if (GETPOST('addoperation', 'alpha')) $emailcollectoroperation->status = 1; $emailcollectoroperation->position = 50; - $result = $emailcollectoroperation->create($user); + if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty')) + && empty($emailcollectoroperation->actionparam)) { + $error++; + setEventMessages($langs->trans("ErrorAParameterIsRequiredForThisOperation"), null, 'errors'); + } - if ($result > 0) - { - $object->fetchActions(); - } else { - setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + if (!$error) { + $result = $emailcollectoroperation->create($user); + + if ($result > 0) { + $object->fetchActions(); + } else { + $error++; + setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + } } } @@ -170,13 +178,22 @@ if ($action == 'updateoperation') $emailcollectoroperation->actionparam = GETPOST('operationparam2', 'restricthtml'); - $result = $emailcollectoroperation->update($user); + if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty')) + && empty($emailcollectoroperation->actionparam)) { + $error++; + setEventMessages($langs->trans("ErrorAParameterIsRequiredForThisOperation"), null, 'errors'); + } - if ($result > 0) - { - $object->fetchActions(); - } else { - setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + if (!$error) { + $result = $emailcollectoroperation->update($user); + + if ($result > 0) + { + $object->fetchActions(); + } else { + $error++; + setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + } } } if ($action == 'deleteoperation') @@ -458,7 +475,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
| '.$langs->trans("Filters").' | '; + print ' | '.$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).' | '; print ' | ||