Qual: Use a code instead of key.

This commit is contained in:
Laurent Destailleur 2009-06-30 11:59:46 +00:00
parent e518bbc540
commit 9938f159b0
2 changed files with 10 additions and 9 deletions

View File

@ -104,7 +104,7 @@ class InterfaceNotification
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 2; $action_notify = 'NOTIFY_VAL_FAC';
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La facture '.$object->ref." a été validée.\n"; $mesg = 'La facture '.$object->ref." a été validée.\n";
@ -117,7 +117,7 @@ class InterfaceNotification
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 1; $action_notify = 'NOTIFY_VAL_FICHINTER';
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La fiche intervention '.$object->ref." a été validée.\n"; $mesg = 'La fiche intervention '.$object->ref." a été validée.\n";
@ -130,7 +130,7 @@ class InterfaceNotification
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 3; $action_notify = 'NOTIFY_VAL_ORDER_SUPPLIER';
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La commande fournisseur '.$object->ref." a été validée.\n"; $mesg = 'La commande fournisseur '.$object->ref." a été validée.\n";

View File

@ -67,14 +67,14 @@ class Notify
{ {
global $langs; global $langs;
$langs->load("mails"); $langs->load("mails");
$nb=$this->countDefinedNotifications($action,$socid); $nb=$this->countDefinedNotifications($action,$socid);
if ($nb <= 0) $texte=$langs->trans("NoNotificationsWillBeSent"); if ($nb <= 0) $texte=$langs->trans("NoNotificationsWillBeSent");
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent"); if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb); if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
return $texte; return $texte;
} }
/** /**
* \brief Renvoie le nombre de notifications configures pour l'action et la societe donnee * \brief Renvoie le nombre de notifications configures pour l'action et la societe donnee
* \return int <0 si ko, sinon nombre de notifications definies * \return int <0 si ko, sinon nombre de notifications definies
@ -82,7 +82,7 @@ class Notify
function countDefinedNotifications($action,$socid) function countDefinedNotifications($action,$socid)
{ {
$num=-1; $num=-1;
$sql = "SELECT n.rowid, c.email, c.rowid, c.name, c.firstname, a.titre, s.nom"; $sql = "SELECT n.rowid, c.email, c.rowid, c.name, c.firstname, a.titre, s.nom";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; $sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
@ -102,7 +102,7 @@ class Notify
$this->error=$this->db->error.' sql='.$sql; $this->error=$this->db->error.' sql='.$sql;
return -1; return -1;
} }
return $num; return $num;
} }
@ -117,7 +117,8 @@ class Notify
$sql = "SELECT s.nom, c.email, c.rowid, c.name, c.firstname, a.titre,n.rowid"; $sql = "SELECT s.nom, c.email, c.rowid, c.name, c.firstname, a.titre,n.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; $sql .= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
$sql .= " AND n.fk_soc = s.rowid AND n.fk_action = ".$action; $sql .= " AND n.fk_soc = s.rowid";
$sql .= " AND a.code = 'NOTIFY_".$action."'";
$sql .= " AND s.rowid = ".$socid; $sql .= " AND s.rowid = ".$socid;
dol_syslog("Notify.class::send $action, $socid, $texte, $objet_type, $objet_id, $file"); dol_syslog("Notify.class::send $action, $socid, $texte, $objet_type, $objet_id, $file");
@ -139,7 +140,7 @@ class Notify
$message = $texte; $message = $texte;
$filename = split("/",$file); $filename = split("/",$file);
$msgishtml=0; $msgishtml=0;
$replyto = $conf->notification->email_from; $replyto = $conf->notification->email_from;
$mailfile = new CMailFile($subject, $mailfile = new CMailFile($subject,