[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/telephonie/fournisseur/ -> fiche.php (source)

   1  <?PHP
   2  /* Copyright (C) 2004-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   *
  18   * $Id: fiche.php,v 1.7 2005/09/06 14:35:07 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/fournisseur/fiche.php,v $
  20   *
  21   */
  22  
  23  require ("./pre.inc.php");
  24  
  25  if (!$user->rights->telephonie->fournisseur->lire)
  26    accessforbidden();
  27  
  28  $mesg = '';
  29  
  30  if ($_POST["action"] == 'add')
  31  {
  32    $fourn = new FournisseurTelephonie($db);
  33  
  34    $fourn->nom            = $_POST["nom"];
  35    $fourn->email_commande = $_POST["email_commande"];
  36  
  37    if ( $fourn->create($user) == 0)
  38      {
  39        Header("Location: index.php");
  40      }
  41  }
  42  
  43  if ($_POST["action"] == 'update' && $_GET["id"])
  44  {
  45    $fourn = new FournisseurTelephonie($db);
  46  
  47    if ($fourn->fetch($_GET["id"]) == 0)
  48      {
  49  
  50        $fourn->num_client       = $_POST["num_client"];
  51        $fourn->email_commande   = $_POST["email_commande"];
  52        $fourn->methode_commande = $_POST["methode"];
  53        $fourn->commande_bloque  = $_POST["commande_bloque"];
  54        
  55        if ( $fourn->update($user) == 0)
  56      {
  57        Header("Location: fiche.php?id=".$fourn->id);
  58      }
  59      }
  60  }
  61  
  62  if ($_GET["action"] == 'active')
  63  {
  64    $fourn = new FournisseurTelephonie($db);
  65    $fourn->id = $_GET["id"];
  66  
  67    if ( $fourn->active($user) == 0)
  68      {
  69        Header("Location: index.php");
  70      }
  71  }
  72  
  73  if ($_GET["action"] == 'desactive')
  74  {
  75    $fourn = new FournisseurTelephonie($db);
  76    $fourn->id = $_GET["id"];
  77  
  78    if ( $fourn->desactive($user) == 0)
  79      {
  80        Header("Location: index.php");
  81      }
  82  }
  83  
  84  llxHeader("","Telephonie - Fournisseur");
  85  
  86  if ($cancel == $langs->trans("Cancel"))
  87  {
  88    $action = '';
  89  }
  90  
  91  /*
  92   * Création
  93   *
  94   */
  95  
  96  if ($_GET["action"] == 'create')
  97  {
  98    $fourn = new FournisseurTelephonie($db);
  99    print "<form action=\"fiche.php\" method=\"post\">\n";
 100    print '<input type="hidden" name="action" value="add">';
 101  
 102    print_titre("Nouveau  fournisseur");
 103        
 104    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 105  
 106    print '<tr><td width="20%">Nom</td><td><input name="nom" size="30" value=""></td></tr>';
 107    print '<tr><td width="20%">Email de commande</td><td><input name="email_commande" size="40" value=""> (adresse email à laquelle sont envoyées les commandes de lignes</td></tr>';
 108  
 109    print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
 110    print '</table>';
 111    print '</form>';
 112  }
 113  
 114  /*
 115   * Visualisation & Edition
 116   *
 117   */
 118  if ($_GET["id"] > 0)
 119  {
 120    $art[0] = "non";
 121    $art[1] = "oui";
 122  
 123    $fourn = new FournisseurTelephonie($db);
 124    if ($fourn->fetch($_GET["id"]) == 0)
 125    {
 126  
 127      if ($_GET["action"] == "edit" && $user->rights->telephonie->fournisseur->config)
 128        {
 129      /*
 130       * Edition
 131       *
 132       */
 133      print_titre("Modification fournisseur");
 134  
 135      print '<form action="fiche.php?id='.$fourn->id.'" method="post">';
 136      print '<input type="hidden" name="action" value="update">';
 137  
 138      print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 139      
 140      print '<tr><td width="20%">Nom</td><td colspan="2">'.$fourn->nom.'</td></tr>';
 141  
 142      print '<tr><td width="20%">Numéro Client</td>';
 143      print '<td><input name="num_client" size="30" value="'.$fourn->num_client.'"></td>';
 144      print '<td>Notre numéro de client</td></tr>';
 145  
 146      print '<tr><td width="20%">Email de commande</td>';
 147      print '<td><input name="email_commande" size="30" value="'.$fourn->email_commande.'"></td>';
 148      print '<td>adresse email à laquelle sont envoyées les commandes de lignes</td></tr>';
 149  
 150      $html = new Form($db);
 151  
 152      $arr = $fourn->array_methode();
 153  
 154      print '<tr><td width="20%">Méthode de commande</td>';
 155      print '<td>';
 156      print $html->select_array("methode",$arr,$fourn->class_commande);
 157      print '</td>';
 158      print '<td>méthode utilisée pour les commandes de lignes</td></tr>';
 159      
 160      print '<tr><td width="20%">Blocage des commandes</td>';
 161      print '<td>';
 162  
 163      print $html->select_array("commande_bloque",$art,$fourn->commande_bloque);
 164      print '</td>';
 165      print '<td>Les commandes vers ce fournisseur sont bloquées</td></tr>';
 166  
 167      print '<tr><td colspan="3" align="center"><input type="submit" value="Update"></td></tr>';
 168      print '</table></form><br />';
 169        }
 170      else
 171        {
 172      /*
 173       * Visualisation
 174       *
 175       */
 176      $h = 0;
 177      $head[$h][0] = DOL_URL_ROOT."/telephonie/fournisseur/fiche.php?id=".$fourn->id;
 178      $head[$h][1] = $langs->trans("Fiche");
 179      $hselected = $h;
 180      $h++;
 181      /*    
 182      $head[$h][0] = DOL_URL_ROOT."/telephonie/fournisseur/cdr.php?id=".$fourn->id;
 183      $head[$h][1] = $langs->trans("CDR");
 184      $h++;
 185      */
 186      dolibarr_fiche_head($head, $hselected, 'Fournisseur : '.$fourn->nom);
 187      
 188      print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 189      
 190      print '<tr><td width="20%">Nom</td><td colspan="2">'.$fourn->nom.'</td></tr>';
 191  
 192      print '<tr><td width="20%">Numéro Client</td>';
 193      print '<td>'.$fourn->num_client.'</td>';
 194      print '<td>Notre numéro de client</td></tr>';
 195  
 196      print '<tr><td width="20%">Email de commande</td>';
 197      print '<td>'.$fourn->email_commande.'</td>';
 198      print '<td>adresse email à laquelle sont envoyées les commandes de lignes</td></tr>';
 199      
 200      print '<tr><td width="20%">Méthode de commande</td>';
 201      print '<td>'.$fourn->class_commande.'</td>';
 202      print '<td>méthode utilisée pour les commandes de lignes</td></tr>';
 203      
 204      
 205      print '<tr><td width="20%">Blocage des commandes</td>';
 206      print '<td>'.$art[$fourn->commande_bloque].'</td>';
 207      print '<td>Les commandes sont bloquées</td></tr>';
 208  
 209      print '</table><br /></div>';
 210        }
 211    }
 212  }
 213  
 214  /* ************************************************************************** */
 215  /*                                                                            */ 
 216  /* Barre d'action                                                             */ 
 217  /*                                                                            */ 
 218  /* ************************************************************************** */
 219  
 220  print "\n<div class=\"tabsAction\">\n";
 221  
 222  if ($_GET["action"] == '')
 223  {  
 224    if($user->rights->telephonie->fournisseur->config)
 225  
 226      {
 227        print '<a class="tabAction" href="'.DOL_URL_ROOT.'/telephonie/fournisseur/fiche.php?action=edit&amp;id='.$fourn->id.'">'.$langs->trans("Edit").'</a>';
 228      }
 229  }
 230  
 231  print "</div>";
 232  
 233  $db->close();
 234  
 235  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/06 14:35:07 $ r&eacute;vision $Revision: 1.7 $</em>");
 236  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics