From f613688b28c5b104d7816bc5ab5756d48a420b08 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 8 Apr 2021 13:37:09 +0200
Subject: [PATCH 1/6] add_option
---
htdocs/admin/notification.php | 17 +++++++++++++++++
htdocs/core/class/notify.class.php | 24 +++++++++++++++++++++---
htdocs/langs/en_US/admin.lang | 1 +
htdocs/langs/en_US/other.lang | 3 +++
htdocs/langs/fr_FR/admin.lang | 1 +
htdocs/langs/fr_FR/other.lang | 3 +++
6 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index e1cf115626f..6609021cc2a 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -97,6 +97,10 @@ if ($action == 'setvalue' && $user->admin) {
$error++;
}
+ $result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE", GETPOST("notif_disable", "alphawithlgt"), 'chaine', 0, '', $conf->entity);
+ if ($result < 0) {
+ $error++;
+ }
if (!$error) {
$db->commit();
@@ -198,6 +202,19 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
}
print '';
print '';
+$arrayofnotifto = array(
+'',
+$langs->trans('notiftouser'),
+$langs->trans('notiftofixedemail'),
+$langs->trans('notiftouserandtofixedemail')
+);
+var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+print '
| ';
+print $langs->trans("NotificationDisableConfirmMessage").' | ';
+print '';
+print $form->selectarray("notif_disable", $arrayofnotifto, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE, 0, 0, 0, '', 1, 0, 0, '', 'maxwidth400', 1);
+print ' | ';
+print '
';
print '';
print '';
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 345ec5b38e3..92555da891a 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -80,8 +80,8 @@ class Notify
'SHIPPING_VALIDATE',
'EXPENSE_REPORT_VALIDATE',
'EXPENSE_REPORT_APPROVE',
- 'HOLIDAY_VALIDATE',
- 'HOLIDAY_APPROVE',
+ 'HOLIDAY_VALIDATE',
+ 'HOLIDAY_APPROVE',
'ACTION_CREATE'
);
@@ -108,10 +108,28 @@ class Notify
*/
public function confirmMessage($action, $socid, $object)
{
- global $langs;
+ global $conf, $langs;
$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 ($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);
+ }
+ }
+ }
+ }
$texte = '';
$nb = -1;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 5d78f312917..73d2a5ca558 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1673,6 +1673,7 @@ 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
##### Sendings #####
SendingsSetup=Shipping module setup
SendingsReceiptModel=Sending receipt model
diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang
index 5ae6c7727b3..91f173850ff 100644
--- a/htdocs/langs/en_US/other.lang
+++ b/htdocs/langs/en_US/other.lang
@@ -35,6 +35,9 @@ OnlyOneFieldForXAxisIsPossible=Only 1 field is currently possible as X-Axis. Onl
AtLeastOneMeasureIsRequired=At least 1 field for measure is required
AtLeastOneXAxisIsRequired=At least 1 field for X-Axis is required
LatestBlogPosts=Latest Blog Posts
+notiftouser=To users
+notiftofixedemail=To fixed mail
+notiftouserandtofixedemail=To user and fixed mail
Notify_ORDER_VALIDATE=Sales order validated
Notify_ORDER_SENTBYMAIL=Sales order sent by mail
Notify_ORDER_SUPPLIER_SENTBYMAIL=Purchase order sent by email
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index ef48fc0a82d..02e0b27af5d 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1662,6 +1662,7 @@ MailingDelay=Temps d'attente, en seconde, avant d'envoyer le prochain message
NotificationSetup=Configuration du module Notification par email
NotificationEMailFrom=Adresse émettrice (From) des emails envoyés lors des notifications
FixedEmailTarget=Email fixe cible destinataires
+NotificationDisableConfirmMessage=Notifications desactivé dans les messages de confirmation
##### Sendings #####
SendingsSetup=Configuration du module Expédition/Livraison
SendingsReceiptModel=Modèles de bordereau d'expédition
diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang
index a8078129464..4e228ed50bd 100644
--- a/htdocs/langs/fr_FR/other.lang
+++ b/htdocs/langs/fr_FR/other.lang
@@ -35,6 +35,9 @@ OnlyOneFieldForXAxisIsPossible=1 seul champ est actuellement possible en tant qu
AtLeastOneMeasureIsRequired=Au moins 1 champ de mesure est requis
AtLeastOneXAxisIsRequired=Au moins 1 champ pour l'axe X est requis
LatestBlogPosts=Derniers articles du Blog
+notiftouser=Aux utilisateurs
+notiftofixedemail=Vers les courriers fixe
+notiftouserandtofixedemail=Aux utilisateurs et les courriers fixe
Notify_ORDER_VALIDATE=Validation commande client
Notify_ORDER_SENTBYMAIL=Envoi commande client par email
Notify_ORDER_SUPPLIER_SENTBYMAIL=Envoi commande fournisseur par email
From c2cd54325f43f01be686fd06cc8e9ff332c2f2d9 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Thu, 8 Apr 2021 11:44:24 +0000
Subject: [PATCH 2/6] Fixing style errors.
---
htdocs/admin/notification.php | 2 +-
htdocs/core/class/notify.class.php | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6609021cc2a..d467b6bb62d 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -208,7 +208,7 @@ $langs->trans('notiftouser'),
$langs->trans('notiftofixedemail'),
$langs->trans('notiftouserandtofixedemail')
);
-var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+var_dump($arrayofnotifto, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
print '| ';
print $langs->trans("NotificationDisableConfirmMessage").' | ';
print '';
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 92555da891a..695a17a75d8 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -112,18 +112,18 @@ 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'){
+ 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 ($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 2 || $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE == 3){
- foreach($listofnotiftodo as $val){
- if ($val['type'] == 'tofixedemail'){
+ 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);
}
From 822d9b227bdd2eb7e8b304f8fa501fe1d03adfb7 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 8 Apr 2021 13:50:55 +0200
Subject: [PATCH 3/6] Update notification.php
---
htdocs/admin/notification.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6609021cc2a..85e097dceb3 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -202,13 +202,14 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
}
print ' | ';
print '
';
+
$arrayofnotifto = array(
'',
$langs->trans('notiftouser'),
$langs->trans('notiftofixedemail'),
$langs->trans('notiftouserandtofixedemail')
);
-var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
+
print '| ';
print $langs->trans("NotificationDisableConfirmMessage").' | ';
print '';
From d3053c0c1b8ffaac71253bc12d6f3f0f249280f0 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Wed, 28 Apr 2021 23:35:47 +0200
Subject: [PATCH 4/6] delete_fr_lang
---
htdocs/langs/fr_FR/admin.lang | 1 -
htdocs/langs/fr_FR/other.lang | 3 ---
2 files changed, 4 deletions(-)
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 02e0b27af5d..ef48fc0a82d 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1662,7 +1662,6 @@ MailingDelay=Temps d'attente, en seconde, avant d'envoyer le prochain message
NotificationSetup=Configuration du module Notification par email
NotificationEMailFrom=Adresse émettrice (From) des emails envoyés lors des notifications
FixedEmailTarget=Email fixe cible destinataires
-NotificationDisableConfirmMessage=Notifications desactivé dans les messages de confirmation
##### Sendings #####
SendingsSetup=Configuration du module Expédition/Livraison
SendingsReceiptModel=Modèles de bordereau d'expédition
diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang
index 4e228ed50bd..a8078129464 100644
--- a/htdocs/langs/fr_FR/other.lang
+++ b/htdocs/langs/fr_FR/other.lang
@@ -35,9 +35,6 @@ OnlyOneFieldForXAxisIsPossible=1 seul champ est actuellement possible en tant qu
AtLeastOneMeasureIsRequired=Au moins 1 champ de mesure est requis
AtLeastOneXAxisIsRequired=Au moins 1 champ pour l'axe X est requis
LatestBlogPosts=Derniers articles du Blog
-notiftouser=Aux utilisateurs
-notiftofixedemail=Vers les courriers fixe
-notiftouserandtofixedemail=Aux utilisateurs et les courriers fixe
Notify_ORDER_VALIDATE=Validation commande client
Notify_ORDER_SENTBYMAIL=Envoi commande client par email
Notify_ORDER_SUPPLIER_SENTBYMAIL=Envoi commande fournisseur par email
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 5/6] 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
From b6ddea57f3e462dd2ffa312e5252b78f7571323d Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Thu, 29 Apr 2021 00:17:55 +0200
Subject: [PATCH 6/6] update
---
htdocs/admin/notification.php | 7 -------
1 file changed, 7 deletions(-)
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index 6b17b9134f7..bf4928dc5a4 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -203,13 +203,6 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
print '';
print '';
-$arrayofnotifto = array(
--1 => '',
-1 => $langs->trans('notiftouser'),
-2 => $langs->trans('notiftofixedemail'),
-3 => $langs->trans('notiftouserandtofixedemail')
-);
-
print '| ';
print $langs->trans("NotificationDisableConfirmMessageUser").' | ';
print '';
|