diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index 7c0d7fdbf9c..2484df559e2 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -622,9 +622,29 @@ else
}
print '';
-
print '
';
+
+/*
+ * Notifications
+ */
+
+print_titre($langs->trans("Notifications"));
+print '
| '.$langs->trans("Parameter").' | '; +print ''; +print ' | '; +print " |
| ';
+print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").' '; +print ' | '; +print " | |
| '.$langs->trans("Parameter").' | '; +print ''; +print ' | '; +print " |
| ';
+print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").' '; +print ' | '; +print " | |
| '.$langs->trans("Module").' | '; + print ''.$langs->trans("Code").' | '; + print ''.$langs->trans("Label").' | '; + print ''.$langs->trans("NbOfTargetedContacts").' | '; + print ''.' | '; + print "
| '.$elementLabel.' | '; + print ''.$notifiedevent['code'].' | '; + print ''.$label.' | '; + print ''; + $nb = $notify->countDefinedNotifications($notifiedevent['code'], 0); + print $nb; + print ' | '; + print '
| '.$langs->trans("Module").' | '; print ''.$langs->trans("Code").' | '; print ''.$langs->trans("Label").' | '; print ''.$langs->trans("FixedEmailTarget").' | '; +print ''.$langs->trans("Threshold").' | '; +print ''.' | '; print "'.$notifiedevent['code'].' | '; print ''.$label.' | '; print '';
- $param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'];
- $value=GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param;
- $s=''; // Do not use type="email" here, we must be able to enter a list of email with , separator.
- $arrayemail=explode(',',$value);
- $showwarning=0;
- foreach($arrayemail as $key=>$valuedet)
- {
- $valuedet=trim($valuedet);
- if (! empty($valuedet) && ! isValidEmail($valuedet)) $showwarning++;
- }
- if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
- print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
+ // Notification with threshold
+ foreach($conf->global as $key => $val)
+ {
+ if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
+
+ $param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_'.$reg[1];
+ $value=GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key')?GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key','alpha'):$conf->global->$param;
+
+ $s=''; // Do not use type="email" here, we must be able to enter a list of email with , separator.
+ $arrayemail=explode(',',$value);
+ $showwarning=0;
+ foreach($arrayemail as $key=>$valuedet)
+ {
+ $valuedet=trim($valuedet);
+ if (! empty($valuedet) && ! isValidEmail($valuedet)) $showwarning++;
+ }
+ if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
+ print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"),1,'help','',0,2);
+ print ' '; + } + // New entry input fields + $s=''; // Do not use type="email" here, we must be able to enter a list of email with , separator. + print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"),1,'help','',0,2); + print ' | ';
+
+ print '';
+ // Notification with threshold
+ foreach($conf->global as $key => $val)
+ {
+ if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
+
+ print $langs->trans("AmountHT").' >= ';
+ print ' '; + } + // New entry input fields + print $langs->trans("AmountHT").' >= '; + print ' | ';
+
+ print ''; + // TODO Add link to show message content + print ' | '; print ''; } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 30ae7e71ab3..55a6ec749b6 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -643,6 +643,27 @@ print "\n"; print "
| ".$langs->trans("PathDirectory")." | \n".$conf->propal->dir_output." | \n
| '.$langs->trans("Parameter").' | '; +print ''; +print ' | '; +print " |
| ';
+print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").' '; +print ' | '; +print " | |
| '.$langs->trans("Parameter").' | '; +print ''; +print ' | '; +print " |
| ';
+print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").' '; +print ' | '; +print " | |
| '.$langs->trans("Value").' | '; print ''; print " | |
| ';
print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").') '; print ''; print ' | '; print ''; print " | |
| '.$langs->trans("Parameter").' | '; +print ''; +print ' | '; +print " |
| ';
+print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").' '; +print ' | '; +print " | |
| ';
print $langs->trans('IncotermLabel');
@@ -1207,7 +1207,7 @@ else if ($id || $ref)
{
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
}
- else
+ else
{
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
}
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 3f6877d8d14..a9a824a8b5d 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1657,7 +1657,7 @@ elseif (! empty($object->id))
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
$notify=new Notify($db);
$text.=' '; - $text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid); + $text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid, $object); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index cd6a9f64abd..a48534b4c24 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1664,7 +1664,7 @@ else require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; $notify=new Notify($db); $text.=' '; - $text.=$notify->confirmMessage('BILL_SUPPLIER_VALIDATE',$object->socid); + $text.=$notify->confirmMessage('BILL_SUPPLIER_VALIDATE',$object->socid, $object); }*/ $formquestion=array(); diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index d4e56a980a6..633b13f9ad2 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -373,3 +373,45 @@ INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('DDP', 'Delivered Du -- Extrafields fk_object must be unique (1-1 relation) ALTER TABLE llx_societe_extrafields DROP INDEX idx_societe_extrafields; ALTER TABLE llx_societe_extrafields ADD UNIQUE INDEX uk_societe_extrafields (fk_object); + + +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION','Member subscribed','Executed when a member is subscribed','member',23); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',30); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',35); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',36); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37); + diff --git a/htdocs/install/mysql/tables/llx_c_action_trigger.sql b/htdocs/install/mysql/tables/llx_c_action_trigger.sql index fa8052d77f9..cbec0c81437 100644 --- a/htdocs/install/mysql/tables/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/tables/llx_c_action_trigger.sql @@ -22,9 +22,9 @@ create table llx_c_action_trigger ( rowid integer AUTO_INCREMENT PRIMARY KEY, + elementtype varchar(16) NOT NULL, code varchar(32) NOT NULL, label varchar(128) NOT NULL, description varchar(255), - elementtype varchar(16) NOT NULL, rang integer DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b8590a1fc38..7bb08ba2c0f 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1107,7 +1107,7 @@ ModuleCompanyCodeAquarium=Return an accountancy code built by: %s followed by ModuleCompanyCodePanicum=Return an empty accountancy code. ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code. UseNotifications=Use notifications -NotificationsDesc=EMails notifications feature allows you to silently send automatic mail, for some Dolibarr events. Targets of notifications can be defined: * per third parties contacts (customers or suppliers), one third party at time. * or by setting a global target email address on module setup page. +NotificationsDesc=EMails notifications feature allows you to silently send automatic mail, for some Dolibarr events. Targets of notifications can be defined: * per third parties contacts (customers or suppliers), one contact at time. * or by setting a global target email address on module setup page. ModelModules=Documents templates DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT or .ODS files for OpenOffice, KOffice, TextEdit,...) WatermarkOnDraft=Watermark on draft document @@ -1601,3 +1601,8 @@ ExpenseReportsSetup=Setup of module Expense Reports TemplatePDFExpenseReports=Document templates to generate expense report document NoModueToManageStockDecrease=No module able to manage automatic stock decrease has been activated. Stock decrease 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". +ListOfNotificationsPerContact=List of notifications per contact* +ListOfFixedNotifications=List of fixed notifications +GoOntoContactCardToAddMore=Go on the tab "Notifications" of a thirdparty contact to add or remove notifications for contact +Threshold=Threshold diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index e84c7653712..b1cf1d714af 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -12,6 +12,7 @@ Notify_FICHINTER_VALIDATE=Intervention validated Notify_FICHINTER_SENTBYMAIL=Intervention sent by mail Notify_BILL_VALIDATE=Customer invoice validated Notify_BILL_UNVALIDATE=Customer invoice unvalidated +Notify_ORDER_SUPPLIER_VALIDATE=Supplier order recorded Notify_ORDER_SUPPLIER_APPROVE=Supplier order approved Notify_ORDER_SUPPLIER_REFUSE=Supplier order refused Notify_ORDER_VALIDATE=Customer order validated @@ -170,6 +171,7 @@ EMailTextInvoiceValidated=The invoice %s has been validated. EMailTextProposalValidated=The proposal %s has been validated. EMailTextOrderValidated=The order %s has been validated. EMailTextOrderApproved=The order %s has been approved. +EMailTextOrderValidatedBy=The order %s has been recorded by %s. EMailTextOrderApprovedBy=The order %s has been approved by %s. EMailTextOrderRefused=The order %s has been refused. EMailTextOrderRefusedBy=The order %s has been refused by %s. diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 0a2a4d35032..69920a7e5ce 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -24,6 +24,7 @@ */ require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.php'; @@ -173,33 +174,8 @@ if ($result > 0) print ' | |||
| '.$langs->trans("NbOfActiveNotifications").' | '; print ''; - $nb=0; - // List of per contact notifications - $sql = "SELECT COUNT(n.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; - $sql.= " WHERE fk_soc = ".$object->id; - $resql=$db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $nb=$obj->nb; - $i++; - } - } - else { - dol_print_error($db); - } - // List of notifications enabled for fixed email - foreach($conf->global as $key => $val) - { - if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; - $listtmp=explode(',',$val); - $nb+=count($listtmp); - } + $notify=new Notify($db); + $nb = $notify->countDefinedNotifications('', $object->id); print $nb; print ' | ||