* Copyright (C) 2004-2008 Laurent Destailleur * Copytight (C) 2005-2009 Regis Houssin * * 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, see . */ /** \file htdocs/compta/bank/categ.php \ingroup compta \brief Page ajout de cat�gories bancaires \version $Id: categ.php,v 1.31 2011/07/31 22:23:20 eldy Exp $ */ require("./pre.inc.php"); if (!$user->rights->banque->configurer) accessforbidden(); /* * Actions ajout cat�gorie */ if ($_POST["action"] == 'add') { if ($_POST["label"]) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_categ ("; $sql.= "label"; $sql.= ", entity"; $sql.= ") VALUES ("; $sql.= "'".$db->escape($_POST["label"])."'"; $sql.= ", ".$conf->entity; $sql.= ")"; $result = $db->query($sql); if (!$result) { dol_print_error($db); } } } /* * Action suppression cat�gorie */ if ( $_REQUEST['action'] == 'delete' ) { if ( $_REQUEST['categid'] ) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " WHERE rowid = '".$_REQUEST['categid']."'"; $sql.= " AND entity = ".$conf->entity; $result = $db->query($sql); if (!$result) { dol_print_error($db); } } } /* * Affichage liste des cat�gories */ llxHeader(); print_fiche_titre($langs->trans("Rubriques")); print '
'; print ''; print ""; print ''; print ''; print ''; print "\n"; $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " WHERE entity = ".$conf->entity; $sql.= " ORDER BY label"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; $total = 0; $var=True; while ($i < $num) { $objp = $db->fetch_object($result); $var=!$var; print ""; print ''; print ""; print ''; print ""; $i++; } $db->free($result); } /* * Affichage ligne ajout de categorie */ $var=!$var; print ""; print ""; print ''; print "
'.$langs->trans("Ref").''.$langs->trans("Label").'
'.$objp->rowid.'$objp->label'.img_delete().'
 
"; $db->close(); llxFooter('$Date: 2011/07/31 22:23:20 $ - $Revision: 1.31 $'); ?>