add_option

This commit is contained in:
Anthony Berton 2021-04-08 13:37:09 +02:00
parent aef164a7ee
commit f613688b28
6 changed files with 46 additions and 3 deletions

View File

@ -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 '</td>';
print '</tr>';
$arrayofnotifto = array(
'',
$langs->trans('notiftouser'),
$langs->trans('notiftofixedemail'),
$langs->trans('notiftouserandtofixedemail')
);
var_dump($arrayofnotifto,$conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE);
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessage").'</td>';
print '<td>';
print $form->selectarray("notif_disable", $arrayofnotifto, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE, 0, 0, 0, '', 1, 0, 0, '', 'maxwidth400', 1);
print '</td>';
print '</tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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