diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index c25647a6da4..25d4950cda3 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -24,7 +24,7 @@ * \file htdocs/categories/categorie.php * \ingroup category * \brief Page to show category tab - * \version $Id: categorie.php,v 1.66 2011/08/18 22:33:43 eldy Exp $ + * \version $Id: categorie.php,v 1.67 2011/08/24 11:16:43 eldy Exp $ */ require("../main.inc.php"); @@ -33,7 +33,10 @@ require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); $langs->load("categories"); $langs->load("products"); -$mesg=isset($_GET["mesg"])?'
'.$_GET["mesg"].'
':''; +$socid=GETPOST('socid'); +$id=GETPOST('id'); +$ref=GETPOST('ref'); +$mesg=GETPOST('mesg'); $dbtablename = ''; @@ -41,10 +44,11 @@ $dbtablename = ''; // For categories on third parties if (! empty($_REQUEST["socid"])) { $_REQUEST["id"]=$_REQUEST["socid"]; + $id=$socid; } if (! isset($_REQUEST["type"])) $_REQUEST["type"]=0; -if ($_REQUEST["type"] == 1) $_GET["socid"]=$_REQUEST["id"]; -if ($_REQUEST["type"] == 2) $_GET["socid"]=$_REQUEST["id"]; +if ($_REQUEST["type"] == 1) $socid=$id; +if ($_REQUEST["type"] == 2) $socid=$id; if ($_REQUEST["id"] || $_REQUEST["ref"]) { @@ -56,13 +60,13 @@ if ($_REQUEST["id"] || $_REQUEST["ref"]) $fieldid = isset($_REQUEST["ref"])?'ref':'rowid'; } if ($_REQUEST["type"] == 1) { - $type = 'fournisseur'; $socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; + $type = 'fournisseur'; $objecttype = 'societe&categorie'; $objectid = isset($_REQUEST["id"])?$_REQUEST["id"]:(isset($_REQUEST["socid"])?$_REQUEST["socid"]:''); $fieldid = 'rowid'; } if ($_REQUEST["type"] == 2) { - $type = 'societe'; $socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; + $type = 'societe'; $objecttype = 'societe&categorie'; $objectid = isset($_REQUEST["id"])?$_REQUEST["id"]:(isset($_REQUEST["socid"])?$_REQUEST["socid"]:''); $fieldid = 'rowid'; @@ -161,8 +165,8 @@ if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0) } else { - if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') $mesg='
'.$langs->trans("ObjectAlreadyLinkedToCategory").'
'; - else $mesg='
'.$langs->trans("Error").' '.$cat->error.'
'; + if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') $mesg='
'.$langs->trans("ObjectAlreadyLinkedToCategory").'
'; + else $mesg=$langs->trans("Error").' '.$cat->error; } } @@ -174,10 +178,11 @@ if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0) $html = new Form($db); + /* * Fiche categorie de client et/ou fournisseur */ -if ($_GET["socid"]) +if ($socid) { require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); @@ -189,7 +194,7 @@ if ($_GET["socid"]) * Creation de l'objet client/fournisseur correspondant au socid */ $soc = new Societe($db); - $result = $soc->fetch($_GET["socid"]); + $result = $soc->fetch($socid); llxHeader("","",$langs->trans("Category")); @@ -275,7 +280,7 @@ if ($_GET["socid"]) print ''; - if ($mesg) print($mesg); + dol_htmloutput_mesg($mesg); if ($soc->client) formCategory($db,$soc,2); @@ -336,7 +341,7 @@ else if ($_GET["id"] || $_GET["ref"]) print ''; - if ($mesg) print($mesg); + dol_htmloutput_mesg($mesg); formCategory($db,$product,0); } @@ -455,6 +460,7 @@ function formCategory($db,$object,$typeid) { print ''; print "id.'&type='.$typeid)."'>"; + print $langs->trans("CreateCat").' '; print img_picto($langs->trans("Create"),'filenew'); print ""; print ''; @@ -534,5 +540,5 @@ function formCategory($db,$object,$typeid) $db->close(); -llxFooter('$Date: 2011/08/18 22:33:43 $ - $Revision: 1.66 $'); +llxFooter('$Date: 2011/08/24 11:16:43 $ - $Revision: 1.67 $'); ?> diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 101a22844b0..cc3a140293f 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Patrick Raguin * @@ -22,7 +22,7 @@ * \file htdocs/categories/fiche.php * \ingroup category * \brief Page to create a new category - * \version $Id: fiche.php,v 1.85 2011/08/03 00:46:32 eldy Exp $ + * \version $Id: fiche.php,v 1.86 2011/08/24 11:16:43 eldy Exp $ */ require("../main.inc.php"); @@ -234,5 +234,5 @@ if ($user->rights->categorie->creer) $db->close(); -llxFooter('$Date: 2011/08/03 00:46:32 $ - $Revision: 1.85 $'); +llxFooter('$Date: 2011/08/24 11:16:43 $ - $Revision: 1.86 $'); ?>