From d35f728fad377c80bf54c5d6715e15a8886ca22a Mon Sep 17 00:00:00 2001 From: abb Date: Fri, 11 Mar 2016 21:07:38 +0100 Subject: [PATCH] added handle to trigger FICHINTER_ADD_CONTACT in notify module --- htdocs/admin/notification.php | 3 +++ htdocs/core/class/notify.class.php | 15 ++++++++++++++- ...face_50_modNotification_Notification.class.php | 1 + htdocs/langs/en_US/other.lang | 2 ++ htdocs/langs/fr_FR/other.lang | 2 ++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index a7699db4292..e8ac153bea7 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2005-2015 Laurent Destailleur * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Bahfir Abbes * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -169,6 +170,7 @@ if ($conf->societe->enabled) elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); + elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); print ''; print ''.$elementLabel.''; @@ -213,6 +215,7 @@ foreach($listofnotifiedevents as $notifiedevent) elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); + elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); print ''; print ''.$elementLabel.''; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 98a06174595..61446dca4b7 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -238,6 +238,7 @@ class Notify 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'FICHINTER_VALIDATE', + 'FICHINTER_ADD_CONTACT', 'ORDER_SUPPLIER_VALIDATE', 'ORDER_SUPPLIER_APPROVE', 'ORDER_SUPPLIER_REFUSE', @@ -315,6 +316,12 @@ class Notify $object_type = 'propal'; $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); break; + case 'FICHINTER_ADD_CONTACT': + $link='/fichinter/card.php?id='.$object->id; + $dir_output = $conf->facture->dir_output; + $object_type = 'ficheinter'; + $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref); + break; case 'FICHINTER_VALIDATE': $link='/fichinter/card.php?id='.$object->id; $dir_output = $conf->facture->dir_output; @@ -427,7 +434,7 @@ class Notify if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue; $threshold = (float) $reg[1]; - if ($object->total_ht <= $threshold) + if (!empty($object->total_ht) && $object->total_ht <= $threshold) { dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification"); continue; @@ -468,6 +475,12 @@ class Notify $object_type = 'propal'; $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); break; + case 'FICHINTER_ADD_CONTACT': + $link='/fichinter/card.php?id='.$object->id; + $dir_output = $conf->facture->dir_output; + $object_type = 'ficheinter'; + $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$newref); + break; case 'FICHINTER_VALIDATE': $link='/fichinter/card.php?id='.$object->id; $dir_output = $conf->facture->dir_output; diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 70719006c5c..3206948e118 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -41,6 +41,7 @@ class InterfaceNotification extends DolibarrTriggers 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'FICHINTER_VALIDATE', + 'FICHINTER_ADD_CONTACT', 'ORDER_SUPPLIER_VALIDATE', 'ORDER_SUPPLIER_APPROVE', 'ORDER_SUPPLIER_REFUSE', diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index eb9628aa4c0..3000eecf33b 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -8,6 +8,7 @@ BirthdayDate=Birthday DateToBirth=Date of birth BirthdayAlertOn= birthday alert active BirthdayAlertOff= birthday alert inactive +Notify_FICHINTER_ADD_CONTACT=Added contact to Intervention Notify_FICHINTER_VALIDATE=Intervention validated Notify_FICHINTER_SENTBYMAIL=Intervention sent by mail Notify_ORDER_VALIDATE=Customer order validated @@ -164,6 +165,7 @@ NumberOfUnitsCustomerOrders=Number of units on customer orders on last 12 month NumberOfUnitsCustomerInvoices=Number of units on customer invoices on last 12 month NumberOfUnitsSupplierOrders=Number of units on supplier orders on last 12 month NumberOfUnitsSupplierInvoices=Number of units on supplier invoices on last 12 month +EMailTextInterventionAddedContact=A newintervention %s has been assigned to you. EMailTextInterventionValidated=The intervention %s has been validated. EMailTextInvoiceValidated=The invoice %s has been validated. EMailTextProposalValidated=The proposal %s has been validated. diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 2868420bc94..f2af45a7bb7 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -8,6 +8,7 @@ BirthdayDate=Date anniversaire DateToBirth=Date de naissance BirthdayAlertOn= alerte anniversaire active BirthdayAlertOff= alerte anniversaire inactive +Notify_FICHINTER_ADD_CONTACT=Ajout contact à Intervention Notify_FICHINTER_VALIDATE=Validation fiche intervention Notify_FICHINTER_SENTBYMAIL=Envoi fiche d'intervention par email Notify_ORDER_VALIDATE=Validation commande client @@ -164,6 +165,7 @@ NumberOfUnitsCustomerOrders=Nombre d'unités sur les commandes clients des 12 de NumberOfUnitsCustomerInvoices=Nombre d'unités sur les factures clients des 12 derniers mois NumberOfUnitsSupplierOrders=Nombre d'unités sur les commandes fournisseur des 12 derniers mois NumberOfUnitsSupplierInvoices=Nombre d'unités sur les factures fournisseurs des 12 derniers mois +EMailTextInterventionAddedContact=Une nouvelle intervention %s vous a été assignée. EMailTextInterventionValidated=La fiche intervention %s vous concernant a été validée. EMailTextInvoiceValidated=La facture %s vous concernant a été validée. EMailTextProposalValidated=La proposition commerciale %s vous concernant a été validée.