From 8091cff0094b213093d252467b2c1bcdc2e78401 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Apr 2019 15:44:16 +0200 Subject: [PATCH] Can edit param of operation for email collector --- htdocs/admin/emailcollector_card.php | 36 +++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 31a8520505d..e71299b65e3 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -48,6 +48,8 @@ $cancel = GETPOST('cancel', 'aZ09'); $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$operationid = GETPOST('operationid', 'int'); + // Initialize technical objects $object = new EmailCollector($db); $extrafields = new ExtraFields($db); @@ -64,6 +66,7 @@ foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); } +if (GETPOST('saveoperation2')) $action = 'updateoperation'; if (empty($action) && empty($id) && empty($ref)) $action='view'; // Load object @@ -165,6 +168,24 @@ if (GETPOST('addoperation', 'alpha')) } } +if ($action == 'updateoperation') +{ + $emailcollectoroperation = new EmailCollectorAction($db); + $emailcollectoroperation->fetch(GETPOST('rowidoperation2', 'int')); + + $emailcollectoroperation->actionparam = GETPOST('operationparam2', 'none'); + + $result = $emailcollectoroperation->update($user); + + if ($result > 0) + { + $object->fetchActions(); + } + else + { + setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + } +} if ($action == 'deleteoperation') { $emailcollectoroperation = new EmailCollectorAction($db); @@ -564,7 +585,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked')); } print ''; - print ''.$ruleaction['actionparam'].''; + print ''; + if ($action == 'editoperation' && $ruleaction['id'] == $operationid) + { + print '
'; + print '
'; + print ' '; + } + else + { + print $ruleaction['actionparam']; + } + print ''; // Move up/down print ''; if ($i > 0) @@ -577,6 +609,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Delete print ''; + print ' '.img_edit().''; + print '   '; print ' '.img_delete().''; print ''; print '';