From eb0b94af7a0e39aacd977f34f675cc2a00658d22 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 9 Jul 2007 07:05:03 +0000 Subject: [PATCH] Synchro --- htdocs/telephonie/fournisseur/fiche.php | 1 - htdocs/telephonie/telephonie.tarif.class.php | 27 ++++++++------------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/htdocs/telephonie/fournisseur/fiche.php b/htdocs/telephonie/fournisseur/fiche.php index d068b07f210..864308bc2ae 100644 --- a/htdocs/telephonie/fournisseur/fiche.php +++ b/htdocs/telephonie/fournisseur/fiche.php @@ -213,7 +213,6 @@ if ($_GET["id"] > 0) print ''; print 'Grille de tarif'; - print ''; print '
'; } diff --git a/htdocs/telephonie/telephonie.tarif.class.php b/htdocs/telephonie/telephonie.tarif.class.php index dfdcba782d0..70994b98c0d 100644 --- a/htdocs/telephonie/telephonie.tarif.class.php +++ b/htdocs/telephonie/telephonie.tarif.class.php @@ -46,7 +46,7 @@ class TelephonieTarif { * Constructeur * */ - function TelephonieTarif($_DB, $fournisseur_id, $type, $tarif_spec = 0, $client_id = 0) + function TelephonieTarif($_DB, $grille_id, $type, $fournisseur_id = 0 , $client_id = 0) { $this->db = $_DB; @@ -65,7 +65,7 @@ class TelephonieTarif { $this->prefixe_max = array(); } - $this->_load_tarif($fournisseur_id, $type); + $this->_load_tarif($grille_id, $type); } @@ -121,15 +121,10 @@ class TelephonieTarif { * * */ - function _load_tarif($fournisseur_id, $type) + function _load_tarif($grille_id, $type) { - if ($type == 'achat') { - $sql = "SELECT prefix, temporel, fixe"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_achat "; - $sql .= " WHERE fk_fournisseur = " . $fournisseur_id; - $sql = "SELECT p.prefix, m.temporel, m.fixe"; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant as m "; $sql .= " , ".MAIN_DB_PREFIX."telephonie_prefix as p "; @@ -151,21 +146,19 @@ class TelephonieTarif { $sql .= " WHERE t.rowid = m.fk_tarif"; $sql .= " AND t.rowid = p.fk_tarif"; - $sql .= " AND m.fk_tarif_desc = 1"; + $sql .= " AND m.fk_tarif_desc = ". $grille_id; } - if ( $this->db->query($sql) ) + if ( $resql = $this->db->query($sql) ) { - $num = $this->db->num_rows(); + $num = $this->db->num_rows($resql); //print "$num tableau_tarif trouvés\n"; $i = 0; - while ($i < $num) - { - $row = $this->db->fetch_row($i); - + while ( $row = $this->db->fetch_row($resql) ) + { $l = $row[0]; $this->tableau_tarif[$l] = $row; @@ -183,7 +176,7 @@ class TelephonieTarif { $i++; } - + $this->num_tarifs = $num; $this->db->free(); } else @@ -291,7 +284,7 @@ class TelephonieTarif { if (in_array($prefix_to_find, $this->prefixes[$first_char_in_prefix])) { - // print "\t$prefix_to_find\n"; + //print "\t$prefix_to_find\n"; $cout_tempo = $this->tableau_tarif[$prefix_to_find][1]; $cout_fixe = $this->tableau_tarif[$prefix_to_find][2]; $tarif_libelle = $this->tableau_tarif[$prefix_to_find][3];