/[dolibarr]/dolibarr/htdocs/telephonie/client/tarifs.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/client/tarifs.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by rodolphe, Mon Jun 20 13:13:35 2005 UTC revision 1.4 by rodolphe, Mon Jul 25 16:17:53 2005 UTC
# Line 27  $message_erreur = ''; Line 27  $message_erreur = '';
27    
28  if ($_POST["action"] == 'addtarif')  if ($_POST["action"] == 'addtarif')
29  {  {
30      $error = 0;
31    $saisieok = 1;    $saisieok = 1;
32    
33    if (strlen(trim($_POST["temporel"])) == 0 OR strlen(trim($_POST["fixe"])) == 0)    if (strlen(trim($_POST["temporel"])) == 0 OR strlen(trim($_POST["fixe"])) == 0)
# Line 57  if ($_POST["action"] == 'addtarif') Line 58  if ($_POST["action"] == 'addtarif')
58    if ($saisieok)    if ($saisieok)
59      {      {
60                
61          $db->begin();
62    
63        $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client";        $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client";
64        $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES ";        $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES ";
65        $sql .= " (".$_POST["tarifid"].",".$_GET["id"].",'".$temporel."','".$fixe."',".$user->id.")";        $sql .= " (".$_POST["tarifid"].",".$_GET["id"].",'".$temporel."','".$fixe."',".$user->id.")";
66                
67        if ( $db->query($sql) )        if (! $db->query($sql) )
68            {
69              $error++;
70            }
71    
72          $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log";
73          $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES ";
74          $sql .= " (".$_POST["tarifid"].",".$_GET["id"].",'".$temporel."','".$fixe."',".$user->id.",now())";
75    
76          if (! $db->query($sql) )
77            {
78              $error++;
79            }
80    
81          if ( $error == 0 )
82          {          {
83              $db->commit();
84            Header("Location: tarifs.php?id=".$_GET["id"]);            Header("Location: tarifs.php?id=".$_GET["id"]);
85          }          }
86        else        else
87          {          {
88              $db->rollback();
89            print $db->error();            print $db->error();
90          }          }
91      }      }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26