[ 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/compta/bank/ -> categ.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: categ.php,v 1.19 2005/09/06 20:58:15 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/bank/categ.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/compta/bank/categ.php
  25          \ingroup    compta
  26          \brief      Page ajout de catégories bancaires
  27          \version    $Revision: 1.19 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  if (!$user->rights->banque->configurer)
  33    accessforbidden();
  34  
  35  llxHeader();
  36  
  37  
  38  /*
  39   * Actions ajout catégorie
  40   */
  41  if ($_POST["action"] == 'add')
  42  {
  43    if ($_POST["label"])
  44      {
  45        $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_categ (label) VALUES ('".$_POST["label"]."')";
  46        $result = $db->query($sql);
  47        
  48        if (!$result)
  49      {
  50        dolibarr_print_error($db);
  51      }
  52      }
  53  }
  54  
  55  /*
  56   * Action suppression catégorie
  57   */
  58  if ( $_REQUEST['action'] == 'delete' )
  59  {
  60      if ( $_REQUEST['categid'] )
  61      {
  62          $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ WHERE rowid='".$_REQUEST['categid']."'";
  63          $result = $db->query($sql);
  64  
  65          if (!$result)
  66          {
  67          dolibarr_print_error($db);
  68          }
  69      }
  70  }
  71  
  72  /*
  73   * Affichage liste des catégories
  74   */
  75  
  76  print_titre($langs->trans("Categories"));
  77  print '<form method="post" action="categ.php">';
  78  print "<input type=\"hidden\" name=\"action\" value=\"add\">";
  79  print '<table class="noborder" width="100%">';
  80  print '<tr class="liste_titre">';
  81  print '<td>'.$langs->trans("Ref").'</td><td colspan="2">'.$langs->trans("Label").'</td>';
  82  print "</tr>\n";
  83  
  84  $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ ORDER BY label";
  85  
  86  $result = $db->query($sql);
  87  if ($result)
  88  {
  89    $num = $db->num_rows();
  90    $i = 0; $total = 0;
  91      
  92    $var=True;
  93    while ($i < $num)
  94      {
  95        $objp = $db->fetch_object($result);
  96        $var=!$var;
  97        print "<tr $bc[$var]>";
  98        print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/budget.php?bid='.$objp->rowid.'">'.$objp->rowid.'</td>';
  99        print "<td>$objp->label</td>";
 100        print '<td style="text-align: center;"><a href="categ.php?categid='.$objp->rowid.'&amp;action=delete"'.img_delete().'</a></td>';
 101        print "</tr>";
 102        $i++;
 103      }
 104    $db->free();
 105  }
 106  
 107  /*
 108   * Affichage ligne ajout de catégorie
 109   */
 110  $var=!$var;
 111  print "<tr $bc[$var]>";
 112  print "<td>&nbsp;</td><td><input name=\"label\" type=\"text\" size=45></td>";
 113  print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
 114  print "</table></form>";
 115  
 116  
 117  
 118  $db->close();
 119  
 120  llxFooter('$Date: 2005/09/06 20:58:15 $ - $Revision: 1.19 $');
 121  ?>


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