This commit is contained in:
Rodolphe Quiedeville 2007-07-09 07:05:03 +00:00
parent 5de83d5494
commit eb0b94af7a
2 changed files with 10 additions and 18 deletions

View File

@ -213,7 +213,6 @@ if ($_GET["id"] > 0)
print '</td>'; print '</td>';
print '<td>Grille de tarif</td></tr>'; print '<td>Grille de tarif</td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" value="Update"></td></tr>'; print '<tr><td colspan="3" align="center"><input type="submit" value="Update"></td></tr>';
print '</table></form><br />'; print '</table></form><br />';
} }

View File

@ -46,7 +46,7 @@ class TelephonieTarif {
* Constructeur * 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; $this->db = $_DB;
@ -65,7 +65,7 @@ class TelephonieTarif {
$this->prefixe_max = array(); $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') 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 = "SELECT p.prefix, m.temporel, m.fixe";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant as m "; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant as m ";
$sql .= " , ".MAIN_DB_PREFIX."telephonie_prefix as p "; $sql .= " , ".MAIN_DB_PREFIX."telephonie_prefix as p ";
@ -151,21 +146,19 @@ class TelephonieTarif {
$sql .= " WHERE t.rowid = m.fk_tarif"; $sql .= " WHERE t.rowid = m.fk_tarif";
$sql .= " AND t.rowid = p.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"; //print "$num tableau_tarif trouvés\n";
$i = 0; $i = 0;
while ($i < $num) while ( $row = $this->db->fetch_row($resql) )
{ {
$row = $this->db->fetch_row($i);
$l = $row[0]; $l = $row[0];
$this->tableau_tarif[$l] = $row; $this->tableau_tarif[$l] = $row;
@ -183,7 +176,7 @@ class TelephonieTarif {
$i++; $i++;
} }
$this->num_tarifs = $num;
$this->db->free(); $this->db->free();
} }
else else