From f1ee1d40d6ce563d43f21ce1dea7809bdab69ae2 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 23 Apr 2007 12:33:09 +0000 Subject: [PATCH] Ajoute la suppression d'une grille de tarif --- .../telephonie.tarif.grille.class.php | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/htdocs/telephonie/telephonie.tarif.grille.class.php b/htdocs/telephonie/telephonie.tarif.grille.class.php index 640060000c6..37b547fbf2d 100644 --- a/htdocs/telephonie/telephonie.tarif.grille.class.php +++ b/htdocs/telephonie/telephonie.tarif.grille.class.php @@ -88,6 +88,9 @@ class TelephonieTarifGrille { return $result; } + /* + + */ function CopieGrille($user, $ori) { $sql = "SELECT fk_tarif,temporel,fixe FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant"; @@ -117,6 +120,64 @@ class TelephonieTarifGrille { } } + /* + \brief Supprime une grille de tarif + */ + function RemoveGrille($user, $id, $replace) + { + $result = 0; + + if ($id > 0) + { + $this->db->begin(); + + $sql= "UPDATE ".MAIN_DB_PREFIX."telephonie_contrat"; + $sql.=" SET grille_tarif='$replace'"; + $sql.=" WHERE grille_tarif='$id';"; + + if ( $this->db->query($sql) ) + { + + } + else + { + dolibarr_syslog($this->db->error()); + dolibarr_syslog($sql); + $result = -1; + } + + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille"; + $sql .= " WHERE rowid=$id;"; + + if ( $this->db->query($sql) ) + { + + } + else + { + dolibarr_syslog($this->db->error()); + $result = -1; + } + + + if ($result === 0 ) + { + $this->db->commit(); + } + else + { + $this->db->rollback(); + } + + } + else + { + $result = -2; + } + + return $result; + } function Perms($user, $perms, $user_grille)