[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * or see http://www.gnu.org/ 18 * 19 * $Id: telephonie.tarif.grille.class.php,v 1.2 2005/09/06 15:35:13 rodolphe Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/telephonie.tarif.grille.class.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/telephonie.tarif.class.php 26 \ingroup facture 27 \brief Fichier de la classe des tarifs telephonies 28 \version $Revision: 1.2 $ 29 */ 30 31 32 /** 33 \class TelephonieTarif 34 \brief Classe permettant la gestion des tarifs de telephonie 35 */ 36 37 38 class TelephonieTarifGrille { 39 40 var $_DB; 41 var $tableau_tarif; 42 var $prefixes; 43 var $prefixe_max; 44 45 /* 46 * Constructeur 47 * 48 */ 49 function TelephonieTarifGrille($_DB) 50 { 51 $this->db = $_DB; 52 53 54 } 55 56 57 function UpdateTarif($grille_id, $tarif_id, $temporel, $fixe, $user) 58 { 59 60 if ($temporel > 0) 61 { 62 63 $tarifs_linked = array(); 64 65 $this->_DBUpdateTarif($grille_id, $tarif_id, $temporel, $fixe, $user); 66 67 $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_tarif"; 68 $sql .= " WHERE tlink = ".$tarif_id; 69 70 $resql = $this->db->query($sql); 71 72 if ($resql) 73 { 74 $num = $this->db->num_rows($resql); 75 $i = 0; 76 77 while ($i < $num) 78 { 79 $row = $this->db->fetch_row($resql); 80 $tarifs_linked[$i] = $row[0]; 81 $i++; 82 } 83 } 84 else 85 { 86 dolibarr_syslog($this->db->error()); 87 } 88 89 90 foreach($tarifs_linked as $tarif) 91 { 92 $this->_DBUpdateTarif($grille_id, $tarif, $temporel, $fixe, $user); 93 } 94 95 } 96 97 return $result; 98 } 99 100 /* 101 * 102 */ 103 104 105 function _DBUpdateTarif($grille_id, $tarif_id, $temporel, $fixe, $user) 106 { 107 108 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_montant"; 109 $sql .= "(fk_tarif_desc, fk_user, fk_tarif, temporel,fixe)"; 110 $sql .= " VALUES (".$grille_id.",".$user->id; 111 $sql .= " ,".$tarif_id; 112 $sql .= " ,".ereg_replace(",",".",$temporel); 113 $sql .= " ,".ereg_replace(",",".",$fixe).");"; 114 115 if ( $this->db->query($sql) ) 116 { 117 118 } 119 else 120 { 121 dolibarr_syslog($this->db->error()); 122 } 123 124 $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_montant_log"; 125 $sql .= "(fk_tarif_desc, fk_user, fk_tarif, temporel,fixe)"; 126 127 $sql .= " VALUES (".$grille_id.",".$user->id; 128 $sql .= " ,".$tarif_id; 129 $sql .= " ,".ereg_replace(",",".",$temporel); 130 $sql .= " ,".ereg_replace(",",".",$fixe).");"; 131 132 if ( $this->db->query($sql) ) 133 { 134 135 } 136 else 137 { 138 dolibarr_syslog($this->db->error()); 139 } 140 141 142 return $result; 143 } 144 145 } 146 147 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |