diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 7304b441e25..e6d334965c4 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Brice Davoleau - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent @@ -38,6 +38,8 @@ $ref = GETPOST('ref'); $type = GETPOST('type'); $mesg = GETPOST('mesg'); +$removecat = GETPOST('removecat','int'); + $dbtablename = ''; @@ -87,7 +89,7 @@ $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid */ //Suppression d'un objet d'une categorie -if ($_REQUEST["removecat"]) +if ($removecat > 0) { if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) { @@ -113,7 +115,7 @@ if ($_REQUEST["removecat"]) $result = $object->fetch($objectid); } $cat = new Categorie($db); - $result=$cat->fetch($_REQUEST["removecat"]); + $result=$cat->fetch($removecat); $result=$cat->del_type($object,$elementtype); } @@ -270,11 +272,11 @@ if ($socid) dol_htmloutput_mesg($mesg); - if ($soc->client) formCategory($db,$soc,2); + if ($soc->client) formCategory($db,$soc,2,$socid); if ($soc->client && $soc->fournisseur) print '

'; - if ($soc->fournisseur) formCategory($db,$soc,1); + if ($soc->fournisseur) formCategory($db,$soc,1,$socid); } else if ($id || $ref) { @@ -424,7 +426,7 @@ else if ($id || $ref) * @param int $typeid Type of category (0, 1, 2, 3) * @return int 0 */ -function formCategory($db,$object,$typeid) +function formCategory($db,$object,$typeid,$socid=0) { global $user,$langs,$form,$bc; @@ -499,7 +501,7 @@ function formCategory($db,$object,$typeid) if ($typeid == 3) $permission=$user->rights->adherent->creer; if ($permission) { - print ""; + print ""; print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat").""; } @@ -530,7 +532,7 @@ function formCategory($db,$object,$typeid) return 0; } -$db->close(); llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 8dc601e996f..de8d727c657 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 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 @@ -29,12 +29,13 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/treeview.lib.php"); -$type=(GETPOST('type') ? GETPOST('type') : 0); - -if (!$user->rights->categorie->lire) accessforbidden(); - $langs->load("categories"); +if (! $user->rights->categorie->lire) accessforbidden(); + +$id=GETPOST('id','int'); +$type=(GETPOST('type') ? GETPOST('type') : 0); + /* * View @@ -88,9 +89,9 @@ print ''; /* * Categories found */ -if($_POST['catname'] || $_REQUEST['id']) +if($_POST['catname'] || $id > 0) { - $cats = $categstatic->rechercher($_REQUEST['id'],$_POST['catname'],$_POST['type']); + $cats = $categstatic->rechercher($id,$_POST['catname'],$type); print ''; print ''; @@ -309,7 +310,7 @@ if ($nbofentries == 0) print "
'.$langs->trans("FoundCats").'
"; -$db->close(); llxFooter(); +$db->close(); ?>