From c1e6109c4bfecda86c9ae06be638196729b2b616 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 29 Apr 2021 00:03:16 +0200 Subject: [PATCH] Update --- htdocs/admin/notification.php | 28 ++++++++++++++++++++++------ htdocs/core/class/notify.class.php | 24 +++++++++++------------- htdocs/langs/en_US/admin.lang | 3 ++- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 85e097dceb3..93263998cbe 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -204,16 +204,32 @@ print ''; print ''; $arrayofnotifto = array( -'', -$langs->trans('notiftouser'), -$langs->trans('notiftofixedemail'), -$langs->trans('notiftouserandtofixedemail') +-1 => '', +1 => $langs->trans('notiftouser'), +2 => $langs->trans('notiftofixedemail'), +3 => $langs->trans('notiftouserandtofixedemail') ); print ''; -print $langs->trans("NotificationDisableConfirmMessage").''; +print $langs->trans("NotificationDisableConfirmMessageUser").''; print ''; -print $form->selectarray("notif_disable", $arrayofnotifto, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE, 0, 0, 0, '', 1, 0, 0, '', 'maxwidth400', 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER); +} +print ''; +print ''; +print ''; +print $langs->trans("NotificationDisableConfirmMessageFix").''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX); +} print ''; print ''; print ''; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 695a17a75d8..11ca1c43d3e 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -112,21 +112,19 @@ class Notify $langs->load("mails"); $listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0); - if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE)) { - if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 1 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) { - foreach ($listofnotiftodo as $val) { - if ($val['type'] == 'touser') { - unset($listofnotiftodo[$val['email']]); - $listofnotiftodo = array_merge($listofnotiftodo); - } + if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) { + foreach ($listofnotiftodo as $val) { + if ($val['type'] == 'touser') { + unset($listofnotiftodo[$val['email']]); + $listofnotiftodo = array_merge($listofnotiftodo); } } - if ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 2 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3) { - foreach ($listofnotiftodo as $val) { - if ($val['type'] == 'tofixedemail') { - unset($listofnotiftodo[$val['email']]); - $listofnotiftodo = array_merge($listofnotiftodo); - } + } + if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) { + foreach ($listofnotiftodo as $val) { + if ($val['type'] == 'tofixedemail') { + unset($listofnotiftodo[$val['email']]); + $listofnotiftodo = array_merge($listofnotiftodo); } } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 73d2a5ca558..2154539939c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1673,7 +1673,8 @@ MailingDelay=Seconds to wait after sending next message NotificationSetup=Email Notification module setup NotificationEMailFrom=Sender email (From) for emails sent by the Notifications module FixedEmailTarget=Recipient -NotificationDisableConfirmMessage=Notification disable in confirm message +NotificationDisableConfirmMessageFix=Disable notification info in confirm message for fix notification +NotificationDisableConfirmMessageUser=Disable notification info in confirm message for user notification ##### Sendings ##### SendingsSetup=Shipping module setup SendingsReceiptModel=Sending receipt model