Merge pull request #17185 from bb2a/formconfirm_notification

[NEW]  Add option for notification in message form
This commit is contained in:
Laurent Destailleur 2021-10-24 13:00:39 +02:00 committed by GitHub
commit 8076357f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 1 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();
@ -199,6 +203,29 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
}
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageUser").'</td>';
print '<td>';
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 '</td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageFix").'</td>';
print '<td>';
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 '</td>';
print '</tr>';
print '</table>';
print $form->buttonsSaveCancel("Save", '');

View File

@ -108,10 +108,26 @@ 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_USER)) {
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_FIX)) {
foreach ($listofnotiftodo as $val) {
if ($val['type'] == 'tofixedemail') {
unset($listofnotiftodo[$val['email']]);
$listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
$texte = '';
$nb = -1;

View File

@ -1699,6 +1699,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
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

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