From 2fc8f8826bc329dc30ff240d5b7af2cb56942e50 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 19 Feb 2006 17:03:42 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20onglet=20cat=E9gories=20dans=20la=20fic?= =?UTF-8?q?he=20produit=20-=20en=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product/barcode.php | 8 ++ htdocs/product/categorie.php | 194 +++++++++++++++++++++++++++++++ htdocs/product/document.php | 9 ++ htdocs/product/fiche.php | 14 ++- htdocs/product/fournisseurs.php | 8 ++ htdocs/product/photos.php | 8 ++ htdocs/product/price.php | 8 ++ htdocs/product/stats/facture.php | 8 ++ htdocs/product/stats/fiche.php | 8 ++ htdocs/product/stock/product.php | 8 ++ 10 files changed, 270 insertions(+), 3 deletions(-) create mode 100644 htdocs/product/categorie.php diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php index 4d8e8b0d6b2..b88f3367991 100644 --- a/htdocs/product/barcode.php +++ b/htdocs/product/barcode.php @@ -64,6 +64,14 @@ $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $head[$h][1] = $langs->trans("Price"); $h++; + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $h++; + } + if($product->type == 0) { if ($user->rights->barcode->lire) diff --git a/htdocs/product/categorie.php b/htdocs/product/categorie.php new file mode 100644 index 00000000000..b0ae62cd55e --- /dev/null +++ b/htdocs/product/categorie.php @@ -0,0 +1,194 @@ + + * Copyright (C) 2005 Brice Davoleau + * Copyright (C) 2005-2006 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/product.class.php"); +require_once(DOL_DOCUMENT_ROOT."/product/categorie/categorie.class.php"); + +$langs->load("categories"); + +$mesg = ''; + +if (!$user->rights->produit->lire) accessforbidden(); + +$types[0] = $langs->trans("Product"); +$types[1] = $langs->trans("Service"); + +/* + * Creation de l'objet produit correspondant ŕ l'id + */ +if ($_GET["id"]) +{ + $product = new Product($db); + $result = $product->fetch($_GET["id"]); +} + +llxHeader("","",$langs->trans("CardProduct0")); + +/* + * Fiche produit + */ +if ($_GET["id"]) +{ + //on veut supprimer une catégorie + if ($_REQUEST["cat"]) + { + $cat = new Categorie($db,$_REQUEST["cat"]); + $cat->del_product($product); + } + + //on veut ajouter une catégorie + if (isset($_REQUEST["add_cat"]) && $_REQUEST["add_cat"]>=0) + { + $cat = new Categorie($db,$_REQUEST["add_cat"]); + $cat->add_product($product); + } + + if ( $result ) + { + + /* + * En mode visu + */ + + $h=0; + + $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; + $head[$h][1] = $langs->trans("Card"); + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; + $head[$h][1] = $langs->trans("Price"); + $h++; + + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $hselected = $h; + $h++; + } + + if($product->type == 0) + { + if ($user->rights->barcode->lire) + { + if ($conf->barcode->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id; + $head[$h][1] = $langs->trans("BarCode"); + $h++; + } + } + } + + $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; + $head[$h][1] = $langs->trans("Photos"); + $h++; + + if($product->type == 0) + { + if ($conf->stock->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; + $head[$h][1] = $langs->trans("Stock"); + $h++; + } + } + + if ($conf->fournisseur->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; + $head[$h][1] = $langs->trans("Suppliers"); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; + $head[$h][1] = $langs->trans('Statistics'); + $h++; + + dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); + + print($mesg); + print ''; + print ""; + print ''; + + print ''; + print "
'.$langs->trans("Ref").''.$product->ref.'
'.$langs->trans("Label").''.$product->libelle.'

\n"; + + $c = new Categorie($db); + $cats = $c->containing($_REQUEST['id']); + + if (sizeof($cats) > 0) + { + print "Vous avez stocké le produit dans les catégorie suivantes:

"; + print ''; + print ''; + + + foreach ($cats as $cat) + { + + $ways = $cat->print_all_ways (); + foreach ($ways as $way) + { + $i = !$i; + print ""; + print "\n"; + + } + + } + print "
'.$langs->trans("AllWays").'
".$way."".$langs->trans("DeleteFromCat")."


\n"; + } + else if($cats < 0) + { + print $langs->trans("ErrorUnknown"); + } + + else + { + print $langs->trans("NoCat")."

"; + } + + } + + print $langs->trans("AddProductToCat")."

"; + print ''; + print ""; + print ""; + print "

"; + +} +$db->close(); + + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> + diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 817fd4d6958..624a0f5525b 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -107,6 +107,15 @@ if ($product->id) $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $head[$h][1] = $langs->trans("Price"); $h++; + + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $hselected = $h; + $h++; + } if($product->type == 0) { diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 9a88dcdcece..dfa558cdde2 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -417,6 +417,14 @@ if ($_GET["id"] || $_GET["ref"]) $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $head[$h][1] = $langs->trans("Price"); $h++; + + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $h++; + } if($product->type == 0) { @@ -467,9 +475,9 @@ if ($_GET["id"] || $_GET["ref"]) $head[$h][1] = $langs->trans('Referers'); $h++; - $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id; - $head[$h][1] = $langs->trans('Documents'); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id; + $head[$h][1] = $langs->trans('Documents'); + $h++; $titre=$langs->trans("CardProduct".$product->type); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index a2bda85ce05..6ad51de9ac1 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -174,6 +174,14 @@ if ($_GET["id"] || $_GET["ref"]) $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $head[$h][1] = $langs->trans("Price"); $h++; + + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $h++; + } if($product->type == 0) { diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index df6bc7a377c..443f4b9b5df 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -102,6 +102,14 @@ if ($_GET["id"] || $_GET["ref"]) $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $head[$h][1] = $langs->trans("Price"); $h++; + + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $h++; + } if($product->type == 0) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index bb3f71d03df..506921a5dfd 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -106,6 +106,14 @@ $head[$h][1] = $langs->trans("Price"); $hselected=$h; $h++; + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $h++; + } + if($product->type == 0) { if ($user->rights->barcode->lire) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 36f0f0e05c4..1fc835ebd2b 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -84,6 +84,14 @@ if ($_GET["id"] || $_GET["ref"]) $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $head[$h][1] = $langs->trans("Price"); $h++; + + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $h++; + } if($product->type == 0) { diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index d2df96aa5c3..349a89b7909 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -131,6 +131,14 @@ if ($_GET["id"] || $_GET["ref"]) $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $head[$h][1] = $langs->trans("Price"); $h++; + + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $h++; + } if($product->type == 0) { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 565f0a76397..d6620678cf3 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -116,6 +116,14 @@ if ($_GET["id"] || $_GET["ref"]) $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; $head[$h][1] = $langs->trans("Price"); $h++; + + //affichage onglet catégorie + if ($conf->categorie->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $h++; + } if($product->type == 0) {