From d049970d794af2da7a54e8d7548cf64956ccac1e Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 25 Jul 2005 16:17:53 +0000 Subject: [PATCH] Ajout informations de log des tarifs --- htdocs/telephonie/client/tarifs.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/htdocs/telephonie/client/tarifs.php b/htdocs/telephonie/client/tarifs.php index 46f3e5a7334..635fa700a67 100644 --- a/htdocs/telephonie/client/tarifs.php +++ b/htdocs/telephonie/client/tarifs.php @@ -27,6 +27,7 @@ $message_erreur = ''; if ($_POST["action"] == 'addtarif') { + $error = 0; $saisieok = 1; if (strlen(trim($_POST["temporel"])) == 0 OR strlen(trim($_POST["fixe"])) == 0) @@ -57,16 +58,34 @@ if ($_POST["action"] == 'addtarif') if ($saisieok) { + $db->begin(); + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; $sql .= " (".$_POST["tarifid"].",".$_GET["id"].",'".$temporel."','".$fixe."',".$user->id.")"; - if ( $db->query($sql) ) + if (! $db->query($sql) ) { + $error++; + } + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log"; + $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES "; + $sql .= " (".$_POST["tarifid"].",".$_GET["id"].",'".$temporel."','".$fixe."',".$user->id.",now())"; + + if (! $db->query($sql) ) + { + $error++; + } + + if ( $error == 0 ) + { + $db->commit(); Header("Location: tarifs.php?id=".$_GET["id"]); } else { + $db->rollback(); print $db->error(); } }