From dcb1c188a2df430601a3ab4ce42a8184119a5e83 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 17 Oct 2005 08:07:24 +0000 Subject: [PATCH] Nouveau fichier --- .../script/tarifs-commerciaux-grille.php | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 htdocs/telephonie/script/tarifs-commerciaux-grille.php diff --git a/htdocs/telephonie/script/tarifs-commerciaux-grille.php b/htdocs/telephonie/script/tarifs-commerciaux-grille.php new file mode 100644 index 00000000000..c3ca13d8f3d --- /dev/null +++ b/htdocs/telephonie/script/tarifs-commerciaux-grille.php @@ -0,0 +1,59 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + * Affecte aux contrats la grille de tarif spécifiaque a un + * commercial + * + */ +require ("../../master.inc.php"); +$error = 0; + +/* + * Lecture des lignes + * + */ +$comms = array(); + +$sql = "SELECT fk_grille, fk_commercial"; +$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille_commerciaux"; + +if ($db->query($sql)) +{ + while($row = $db->fetch_row($resql)) + { + $comms[$row[0]] = $row[1]; + } + $db->free($resql); +} + +foreach ($comms as $key => $value) +{ + $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_contrat"; + $sql .= " SET grille_tarif = '".$key."'"; + $sql .= " WHERE fk_commercial_sign = '".$value."';"; + + $resql = $db->query($sql); + + if (!$resql) + { + print "Erreur"; + } +} +?>