From 63b7f070fc3a190ccf3e055d94b73d79a5b9b364 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 4 Jun 2011 23:31:29 +0000 Subject: [PATCH] New: unified action and event with trigger name --- ...face_modNotification_Notification.class.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/htdocs/includes/triggers/interface_modNotification_Notification.class.php b/htdocs/includes/triggers/interface_modNotification_Notification.class.php index bec590720c1..2410a715a33 100644 --- a/htdocs/includes/triggers/interface_modNotification_Notification.class.php +++ b/htdocs/includes/triggers/interface_modNotification_Notification.class.php @@ -103,7 +103,6 @@ class InterfaceNotification { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $action_notify = 'NOTIFY_VAL_FAC'; $ref = dol_sanitizeFileName($object->ref); $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; if (! file_exists($filepdf)) $filepdf=''; @@ -112,14 +111,13 @@ class InterfaceNotification $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); $notify = new Notify($this->db); - $notify->send($action_notify, $object->socid, $mesg, 'facture', $object->id, $filepdf); + $notify->send($action, $object->socid, $mesg, 'facture', $object->id, $filepdf); } elseif ($action == 'ORDER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $action_notify = 'NOTIFY_VAL_ORDER'; $ref = dol_sanitizeFileName($object->ref); $filepdf = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; if (! file_exists($filepdf)) $filepdf=''; @@ -128,14 +126,13 @@ class InterfaceNotification $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); $notify = new Notify($this->db); - $notify->send($action_notify, $object->socid, $mesg, 'order', $object->id, $filepdf); + $notify->send($action, $object->socid, $mesg, 'order', $object->id, $filepdf); } elseif ($action == 'PROPAL_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $action_notify = 'NOTIFY_VAL_PROPAL'; $ref = dol_sanitizeFileName($object->ref); $filepdf = $conf->propale->dir_output . '/' . $ref . '/' . $ref . '.pdf'; if (! file_exists($filepdf)) $filepdf=''; @@ -144,14 +141,13 @@ class InterfaceNotification $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); $notify = new Notify($this->db); - $notify->send($action_notify, $object->socid, $mesg, 'propal', $object->id, $filepdf); + $notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf); } elseif ($action == 'FICHEINTER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $action_notify = 'NOTIFY_VAL_FICHINTER'; $ref = dol_sanitizeFileName($object->ref); $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; if (! file_exists($filepdf)) $filepdf=''; @@ -160,14 +156,13 @@ class InterfaceNotification $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); $notify = new Notify($this->db); - $notify->send($action_notify, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf); + $notify->send($action, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf); } elseif ($action == 'ORDER_SUPPLIER_APPROVE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $action_notify = 'NOTIFY_APP_ORDER_SUPPLIER'; $ref = dol_sanitizeFileName($object->ref); $filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf'; if (! file_exists($filepdf)) $filepdf=''; @@ -176,14 +171,13 @@ class InterfaceNotification $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $notify = new Notify($this->db); - $notify->send($action_notify, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); + $notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); } elseif ($action == 'ORDER_SUPPLIER_REFUSE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $action_notify = 'NOTIFY_REF_ORDER_SUPPLIER'; $ref = dol_sanitizeFileName($object->ref); $filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf'; if (! file_exists($filepdf)) $filepdf=''; @@ -192,7 +186,7 @@ class InterfaceNotification $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $notify = new Notify($this->db); - $notify->send($action_notify, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); + $notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); } // If not found