From 9126d0dce1b1e11eb1810cb4ccc8aca3e66004a7 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 8 Oct 2007 11:31:33 +0000 Subject: [PATCH] Gere la suppression --- htdocs/telephonie/workflowtel.class.php | 33 ++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/htdocs/telephonie/workflowtel.class.php b/htdocs/telephonie/workflowtel.class.php index 41125ff8cdb..783fdef1e0d 100644 --- a/htdocs/telephonie/workflowtel.class.php +++ b/htdocs/telephonie/workflowtel.class.php @@ -60,7 +60,7 @@ class WorkflowTelephonie { return $res; } - function Notify($module, $statut_id, $numero) + function Notify($module, $statut_id, $numero, $commentaire='') { dolibarr_syslog("WorkflowTelephonie::Notify statut_id=$statut_id",LOG_DEBUG); @@ -73,7 +73,7 @@ class WorkflowTelephonie { { while ($row = $this->db->fetch_row($resql)) { - $this->SendMail($row[0],$statut_id, $numero); + $this->SendMail($row[0],$statut_id, $numero, $commentaire); } $this->db->free($resql); } @@ -84,7 +84,7 @@ class WorkflowTelephonie { } - function SendMail($user_id, $statut_id, $numero) + function SendMail($user_id, $statut_id, $numero, $commentaire='') { dolibarr_syslog("WorkflowTelephonie::SendMail user_id=$user_id,statut_id=$statut_id",LOG_DEBUG); @@ -103,6 +103,8 @@ class WorkflowTelephonie { $message .= "Ligne numéro : ".$numero."\n"; $message .= "Evénement : ".$ligne->statuts[$statut_id]."\n"; + if (strlen(trim($commentaire))) + $message .= "Commentaire : ".$commentaire."\n"; $message .= "\n\n--\n"; $message .= "Ceci est un message automatique envoyé par Dolibarr\n"; @@ -114,6 +116,31 @@ class WorkflowTelephonie { $message); $mailfile->sendfile(); } + /** + * + * + */ + function Delete($module, $user_id, $statut_id) + { + // $module contient une des valeurs du champs de type enum de la table + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_workflow"; + $sql .= " WHERE module='".$module."'"; + $sql .= " AND fk_user = '".$user_id."'"; + $sql .= " AND fk_statut = '".$statut_id."';"; + + if ($this->db->query($sql) ) + { + $res = 0; + } + else + { + dolibarr_syslog("WorkflowTelephonie::Delete ".$this->db->error,LOG_ERR); + $res = -1; + } + + return $res; + } } ?>