* Copyright (C) 2006-2007 Laurent Destailleur * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** \file htdocs/categories/edit.php \ingroup categories \brief Page de visualisation de categorie produit \version $Revision$ */ require "./pre.inc.php"; if ($_REQUEST['id'] == "") { dolibarr_print_error('','Missing parameter id'); exit(); } // Securite $user->getrights('categorie'); if (! $user->rights->categorie->lire) { accessforbidden(); } $mesg=''; $c = new Categorie($db); $c->fetch($_REQUEST['id']); /* * Actions */ if ($user->rights->categorie->supprimer && $_POST["action"] == 'confirm_delete' && $_POST['confirm'] == 'yes') { if ($c->remove() >= 0) { header("Location: ".DOL_URL_ROOT.'/categories/index.php'); exit; } else { $mesg='
'.$c->error.'
'; } } /* * Affichage fiche categorie */ llxHeader ("","",$langs->trans("Categories")); $html=new Form($db); if ($mesg) print $mesg.'
'; $h = 0; $head = array(); $head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$c->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; dolibarr_fiche_head($head, 'card', $langs->trans("Category")); /* * Confirmation suppression */ if ($_GET['action'] == 'delete') { $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); print '
'; } print ''; print ''; print ''; print ''; print '
'; $ways = $c->print_all_ways (); print $langs->trans("Ref").''; foreach ($ways as $way) { print $way."
\n"; } print '
'; print $langs->trans("Description").''; print nl2br($c->description); print '
'; print $langs->trans("Status").''; print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); print '
'; print ''; /* * Boutons actions */ print "
\n"; if ($user->rights->categorie->creer) { print "".$langs->trans("Edit").""; } if ($user->rights->categorie->supprimer) { print "".$langs->trans("Delete").""; } print "
"; $cats = $c->get_filles (); if ($cats < 0) { dolibarr_print_error(); } else { print "
"; print "\n"; print "\n"; if (sizeof ($cats) > 0) { $var=true; foreach ($cats as $cat) { $i++; $var=!$var; print "\t\n"; print "\t\t\n"; print "\t\t\n"; if ($cat->visible == 1) { print "\t\t\n"; } else { print "\t\t\n"; } print "\t\n"; } } else { print ""; } print "
".$langs->trans("SubCats")."
".$cat->label."".$cat->description."".$langs->trans("ContentsVisibleByAllShort")."".$langs->trans("ContentsNotVisibleByAllShort")."
".$langs->trans("NoSubCat")."
\n"; } $prods = $c->get_products (); if ($prods < 0) { dolibarr_print_error(); } else { print "
"; print "\n"; print "\n"; if (sizeof ($prods) > 0) { $i = 0; $var=true; foreach ($prods as $prod) { $i++; $var=!$var; print "\t\n"; print '\n"; print '\n"; print '\n"; print "\n"; } } else { print ""; } print "
".$langs->trans("ProductsAndServices")."
'; if ($prod->type == 1) print img_object($langs->trans("ShowService"),"service"); else print img_object($langs->trans("ShowProduct"),"product"); print " ".$prod->ref."'.$prod->libelle."'.$prod->description."
".$langs->trans ("NoProd")."
\n"; } $db->close(); llxFooter('$Date$ - $Revision$'); ?>