Fix notification setup page.

This commit is contained in:
Laurent Destailleur 2021-12-23 15:12:35 +01:00
parent 0fd386a450
commit 4eb9a7625a
3 changed files with 85 additions and 64 deletions

View File

@ -204,6 +204,18 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageContact").'</td>';
print '<td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT);
}
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageUser").'</td>'; print $langs->trans("NotificationDisableConfirmMessageUser").'</td>';
print '<td>'; print '<td>';
@ -215,6 +227,7 @@ if ($conf->use_javascript_ajax) {
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageFix").'</td>'; print $langs->trans("NotificationDisableConfirmMessageFix").'</td>';
print '<td>'; print '<td>';
@ -241,21 +254,17 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="settemplates">'; print '<input type="hidden" name="action" value="settemplates">';
// Notification per contacts // Notification per contacts
$title = $langs->trans("ListOfNotificationsPerUser"); $title = $langs->trans("TemplatesForNotifications");
if (!empty($conf->societe->enabled)) {
$title = $langs->trans("ListOfNotificationsPerUserOrContact"); print load_fiche_titre($title, '', 'email');
}
print load_fiche_titre($title, '', '');
// Load array of available notifications // Load array of available notifications
$notificationtrigger = new InterfaceNotification($db); $notificationtrigger = new InterfaceNotification($db);
$listofnotifiedevents = $notificationtrigger->getListOfManagedEvents(); $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents();
// Editing global variables not related to a specific theme
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { $constantes = array();
// Editing global variables not related to a specific theme foreach ($listofnotifiedevents as $notifiedevent) {
$constantes = array();
foreach ($listofnotifiedevents as $notifiedevent) {
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
@ -295,25 +304,18 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
} }
$constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label); $constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label);
} }
$helptext = ''; $helptext = '';
form_constantes($constantes, 3, $helptext, 'EmailTemplate'); form_constantes($constantes, 3, $helptext, 'EmailTemplate');
print '<div class="opacitymedium">'; print $form->buttonsSaveCancel("Save", '');
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
}
print '</div>';
print $form->buttonsSaveCancel("Save", ''); /*
} else { } else {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
/*print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>';*/
//print '<td class="right">'.$langs->trans("NbOfTargetedContacts").'</td>'; //print '<td class="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
print "</tr>\n"; print "</tr>\n";
@ -359,6 +361,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
} }
print '</div>'; print '</div>';
} }
*/
print '</form>'; print '</form>';
@ -371,7 +374,15 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setfixednotif">'; print '<input type="hidden" name="action" value="setfixednotif">';
print '<input type="hidden" name="page_y" value="">'; print '<input type="hidden" name="page_y" value="">';
print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', ''); print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', 'email');
print '<div class="info">';
print $langs->trans("Note").':<br>';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
}
print '</div>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -488,8 +499,6 @@ foreach ($listofnotifiedevents as $notifiedevent) {
} }
print '</table>'; print '</table>';
print '<br>';
print $form->buttonsSaveCancel("Save", ''); print $form->buttonsSaveCancel("Save", '');
print '</form>'; print '</form>';

View File

@ -108,7 +108,9 @@ class Notify
global $conf, $langs; global $conf, $langs;
$langs->load("mails"); $langs->load("mails");
// Get full list of all notifications subscribed for $action, $socid and $object
$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0); $listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) { if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) {
foreach ($listofnotiftodo as $val) { foreach ($listofnotiftodo as $val) {
if ($val['type'] == 'touser') { if ($val['type'] == 'touser') {
@ -117,6 +119,14 @@ class Notify
} }
} }
} }
if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT)) {
foreach ($listofnotiftodo as $val) {
if ($val['type'] == 'tocontact') {
unset($listofnotiftodo[$val['email']]);
//$listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) { if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) {
foreach ($listofnotiftodo as $val) { foreach ($listofnotiftodo as $val) {
if ($val['type'] == 'tofixedemail') { if ($val['type'] == 'tofixedemail') {

View File

@ -1712,8 +1712,9 @@ MailingDelay=Seconds to wait after sending next message
NotificationSetup=Email Notification module setup NotificationSetup=Email Notification module setup
NotificationEMailFrom=Sender email (From) for emails sent by the Notifications module NotificationEMailFrom=Sender email (From) for emails sent by the Notifications module
FixedEmailTarget=Recipient FixedEmailTarget=Recipient
NotificationDisableConfirmMessageFix=Disable the information about targets into the confirmation message before sending the notifications to the global emails NotificationDisableConfirmMessageContact=Hide the list of recipients (subscribed as contact) of notifications into the confirmation message
NotificationDisableConfirmMessageUser=Disable the information about targets into the confirmation message before sending the notifications to the user emails NotificationDisableConfirmMessageUser=Hide the list of recipients (subscribed as user) of notifications into the confirmation message
NotificationDisableConfirmMessageFix=Hide the list of recipients (subscribed as global email) of notifications into the confirmation message
##### Sendings ##### ##### Sendings #####
SendingsSetup=Shipping module setup SendingsSetup=Shipping module setup
SendingsReceiptModel=Sending receipt model SendingsReceiptModel=Sending receipt model
@ -1905,6 +1906,7 @@ ExpenseReportsRulesSetup=Setup of module Expense Reports - Rules
ExpenseReportNumberingModules=Expense reports numbering module ExpenseReportNumberingModules=Expense reports numbering module
NoModueToManageStockIncrease=No module able to manage automatic stock increase has been activated. Stock increase will be done on manual input only. NoModueToManageStockIncrease=No module able to manage automatic stock increase has been activated. Stock increase will be done on manual input only.
YouMayFindNotificationsFeaturesIntoModuleNotification=You may find options for email notifications by enabling and configuring the module "Notification". YouMayFindNotificationsFeaturesIntoModuleNotification=You may find options for email notifications by enabling and configuring the module "Notification".
TemplatesForNotifications=Templates for notifications
ListOfNotificationsPerUser=List of automatic notifications per user* ListOfNotificationsPerUser=List of automatic notifications per user*
ListOfNotificationsPerUserOrContact=List of possible automatic notifications (on business event) available per user* or per contact** ListOfNotificationsPerUserOrContact=List of possible automatic notifications (on business event) available per user* or per contact**
ListOfFixedNotifications=List of automatic fixed notifications ListOfFixedNotifications=List of automatic fixed notifications