From 196fb07830e154f017639a45c35a9e10705549f7 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 21 Dec 2020 18:47:43 +0100 Subject: [PATCH 1/9] Fix edit variant v13+ after add, edit have same mistakes --- htdocs/variants/card.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 6cda745056a..9355b62f83b 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -44,7 +44,7 @@ if ($object->fetch($id) < 1) { if ($cancel) $action = ''; if ($action) { - if ($action == 'edit') { + if ($action == 'update') { $object->ref = $ref; $object->label = $label; @@ -55,7 +55,7 @@ if ($action) { header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2)); exit(); } - } elseif ($action == 'update') { + } elseif ($action == 'update_value') { if ($objectval->fetch($valueid) > 0) { $objectval->ref = $ref; $objectval->value = GETPOST('value', 'alpha'); @@ -139,8 +139,13 @@ $h++; print dol_get_fiche_head($head, 'variant', $langs->trans('ProductAttributeName'), -1, 'generic'); if ($action == 'edit') { - print '
'; -} + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } if ($action != 'edit') { @@ -232,7 +237,7 @@ if ($action == 'edit') { if ($action == 'edit_value') { print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; From 0e629204f29397125f0b76773921066c06a370e3 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 21 Dec 2020 17:49:49 +0000 Subject: [PATCH 2/9] Fixing style errors. --- htdocs/variants/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 9355b62f83b..986db1b14bc 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -145,7 +145,7 @@ if ($action == 'edit') { print ''; print ''; print ''; - } +} if ($action != 'edit') { From 0068c1fb78138fdad96dea92911ac36aed3f2636 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Dec 2020 10:56:27 +0100 Subject: [PATCH 3/9] Trans --- htdocs/langs/en_US/admin.lang | 1 - htdocs/langs/en_US/main.lang | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 537da1102e8..e3512280644 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -87,7 +87,6 @@ ShowPreview=Show preview ShowHideDetails=Show-Hide details PreviewNotAvailable=Preview not available ThemeCurrentlyActive=Theme currently active -CurrentTimeZone=TimeZone PHP (server) MySQLTimeZone=TimeZone MySql (database) TZHasNoEffect=Dates are stored and returned by database server as if they were kept as submitted string. The timezone has effect only when using the UNIX_TIMESTAMP function (that should not be used by Dolibarr, so database TZ should have no effect, even if changed after data was entered). Space=Space diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c2eae911053..c6ce8ca9be0 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -28,6 +28,7 @@ NoTemplateDefined=No template available for this email type AvailableVariables=Available substitution variables NoTranslation=No translation Translation=Translation +CurrentTimeZone=TimeZone PHP (server) EmptySearchString=Enter non empty search criterias EnterADateCriteria=Enter a date criteria NoRecordFound=No record found From ef2bd563e281a629ea5325f42ef12b39290d4090 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Dec 2020 16:55:51 +0100 Subject: [PATCH 4/9] trans --- htdocs/langs/en_US/admin.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e3512280644..6fb096be175 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1988,8 +1988,8 @@ EmailcollectorOperations=Operations to do by collector MaxEmailCollectPerCollect=Max number of emails collected per collect CollectNow=Collect now ConfirmCloneEmailCollector=Are you sure you want to clone the Email collector %s ? -DateLastCollectResult=Date latest collect tried -DateLastcollectResultOk=Date latest collect successfull +DateLastCollectResult=Date of latest collect try +DateLastcollectResultOk=Date of latest collect success LastResult=Latest result EmailCollectorConfirmCollectTitle=Email collect confirmation EmailCollectorConfirmCollect=Do you want to run the collection for this collector now ? From 6fad9c2d3bb633d503f2274149ce4e7375ad5750 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Dec 2020 16:29:21 +0100 Subject: [PATCH 5/9] Fix edition of operation into email collector --- htdocs/admin/emailcollector_card.php | 57 ++++++++++++------- .../class/emailcollector.class.php | 5 +- htdocs/langs/en_US/admin.lang | 3 +- htdocs/langs/en_US/errors.lang | 3 +- htdocs/langs/en_US/mails.lang | 1 + htdocs/langs/en_US/main.lang | 1 + 6 files changed, 46 insertions(+), 24 deletions(-) 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 '
'; print ''; print ''; - print ''; + print ''; print ''; // Add filter print ''; @@ -491,7 +508,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 'isnotanswer'=>array('label'=>'IsNotAnAnswer', 'data-noparam'=>1), 'isanswer'=>array('label'=>'IsAnAnswer', 'data-noparam'=>1) ); - print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 0, '', 2); + print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 1, '', 2); print "\n"; print '
'.$langs->trans("Filters").''.$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'