From 2e643bfa7b695170ebe3d1856807fd966dbe8421 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Tue, 1 Aug 2006 22:42:38 +0000 Subject: [PATCH] Mise en facteur code gestion onglet produit --- htdocs/lib/product.lib.php | 132 ++++++++++++++++++++++++++ htdocs/product/barcode.php | 89 +---------------- htdocs/product/categorie.php | 86 +---------------- htdocs/product/document.php | 88 +---------------- htdocs/product/fiche.php | 87 +---------------- htdocs/product/fournisseurs.php | 99 +------------------ htdocs/product/photos.php | 89 +---------------- htdocs/product/price.php | 85 +---------------- htdocs/product/sousproduits/fiche.php | 98 ++----------------- htdocs/product/stats/commande.php | 80 +--------------- htdocs/product/stats/contrat.php | 80 +--------------- htdocs/product/stats/facture.php | 87 +---------------- htdocs/product/stats/fiche.php | 87 +---------------- htdocs/product/stats/propal.php | 80 +--------------- htdocs/product/stock/product.php | 85 +---------------- htdocs/product/traduction.php | 126 +++++------------------- 16 files changed, 215 insertions(+), 1263 deletions(-) create mode 100644 htdocs/lib/product.lib.php diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php new file mode 100644 index 00000000000..56c56401fec --- /dev/null +++ b/htdocs/lib/product.lib.php @@ -0,0 +1,132 @@ +<?php +/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> + * + * 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. + * or see http://www.gnu.org/ + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/lib/product.lib.php + \brief Ensemble de fonctions de base pour le module produit et service + \version $Revision$ + + Ensemble de fonctions de base de dolibarr sous forme d'include +*/ + +function product_prepare_head($product) +{ + global $langs, $conf; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; + $head[$h][1] = $langs->trans("Price"); + $head[$h][2] = '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'); + $head[$h][2] = 'category'; + $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"); + $head[$h][2] = 'barcode'; + $h++; + } + } + } + + if($product->type == 0) // Si produit stockable + { + if ($conf->stock->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; + $head[$h][1] = $langs->trans("Stock"); + $head[$h][2] = 'stock'; + $h++; + } + } + + // Multilangs + // TODO Ecran a virer et � remplacer par + if($conf->global->MAIN_MULTILANGS) + { + $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; + $head[$h][1] = $langs->trans("Translation"); + $head[$h][2] = 'translation'; + $h++; + } + + if ($conf->fournisseur->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; + $head[$h][1] = $langs->trans("Suppliers"); + $head[$h][2] = 'suppliers'; + $h++; + } + + $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; + $head[$h][1] = $langs->trans('Statistics'); + $head[$h][2] = 'stats'; + $h++; + + // sousproduits + if($conf->global->PRODUIT_SOUSPRODUITS == 1) + { + $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; + $head[$h][1] = $langs->trans('AssociatedProducts'); + $head[$h][2] = 'subproduct'; + $h++; + } + + + $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; + $head[$h][1] = $langs->trans('Referers'); + $head[$h][2] = 'referers'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; + $head[$h][1] = $langs->trans("Photos"); + $head[$h][2] = 'photos'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id; + $head[$h][1] = $langs->trans('Documents'); + $head[$h][2] = 'document'; + $h++; + + return $head; +} + +?> \ No newline at end of file diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php index e0ca3a2aab9..91f84c866d5 100644 --- a/htdocs/product/barcode.php +++ b/htdocs/product/barcode.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com> * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** @@ -30,6 +29,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langs->load("products"); @@ -54,89 +54,10 @@ if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); if ($_GET["id"]) $result = $product->fetch($_GET["id"]); -$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'); - $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"); - $hselected=$h; - $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++; - } -} - -// Multilangs -if($conf->global->MAIN_MULTILANGS) -{ - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - -// sousproduits -if($conf->global->PRODUIT_SOUSPRODUITS == 1) -{ - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; -$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=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); -dolibarr_fiche_head($head, $hselected, $titre); +dolibarr_fiche_head($head, 'barcode', $titre); + print '<table class="border" width="100%">'; diff --git a/htdocs/product/categorie.php b/htdocs/product/categorie.php index 9dd9d3ccc4d..efb7d38c40e 100644 --- a/htdocs/product/categorie.php +++ b/htdocs/product/categorie.php @@ -30,6 +30,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php"); @@ -79,89 +80,10 @@ if ($_GET["id"] || $_GET["ref"]) * 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++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $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=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'category', $titre); - $titre=$langs->trans("CardProduct".$product->type); - dolibarr_fiche_head($head, $hselected, $titre); print($mesg); print '<table class="border" width="100%">'; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 4c6e45098e5..37e4b0e9059 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -31,6 +31,7 @@ */ require('./pre.inc.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langs->load("other"); @@ -98,91 +99,10 @@ if ($product->id) dol_delete_file($file); } - $h=0; + $head=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'documents', $titre); - $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans("Card"); - $hselected = $h; - $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++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $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'); - $hselected=$h; - $h++; - - $titre=$langs->trans("CardProduct".$product->type); - dolibarr_fiche_head($head, $hselected, $titre); // Construit liste des fichiers clearstatcache(); diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 3a66e82ef85..16552176291 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -31,6 +31,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -522,91 +523,9 @@ if ($_GET["id"] || $_GET["ref"]) * En mode visu */ - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans("Card"); - $hselected = $h; - $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'); - $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++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; - } - - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $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=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); - dolibarr_fiche_head($head, $hselected, $titre); + dolibarr_fiche_head($head, 'card', $titre); // Confirmation de la suppression de la facture if ($_GET["action"] == 'delete') diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2198336878b..5d2e54ab1fa 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com> * @@ -30,6 +30,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -176,100 +177,10 @@ if ($_GET["id"] || $_GET["ref"]) * En mode visu */ - // Zone recherche - /* Deja pr�sent dans menu gauche - print '<div class="formsearch">'; - print '<form action="liste.php" method="post">'; - print '<input type="hidden" name="type" value="'.$product->type.'">'; - print $langs->trans("Ref").': <input class="flat" type="text" size="10" name="sref"> <input class="flat" type="submit" value="'.$langs->trans("Go").'"> '; - print $langs->trans("Label").': <input class="flat" type="text" size="20" name="snom"> <input class="flat" type="submit" value="'.$langs->trans("Go").'">'; - print '</form></div>'; - */ - - $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'); - $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] = 'Stock'; - $h++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $h++; - } - - if ($conf->fournisseur->enabled) - { - $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; - $head[$h][1] = $langs->trans("Suppliers"); - $hselected = $h; - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('Statistics'); - $h++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $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=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); - dolibarr_fiche_head($head, $hselected, $titre); + dolibarr_fiche_head($head, 'suppliers', $titre); + print '<table class="border" width="100%">'; diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index bf5ce99d84f..3488f577b64 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -30,6 +30,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -92,92 +93,10 @@ if ($_GET["id"] || $_GET["ref"]) /* * En mode visu */ + $head=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'photos', $titre); - $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'); - $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"); - $hselected = $h; - $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++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; - } - - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $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++; - - $titre=$langs->trans("CardProduct".$product->type); - dolibarr_fiche_head($head, $hselected, $titre); print($mesg); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 30f49f99746..150f8fbe3a7 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -31,6 +31,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langs->load("products"); @@ -94,88 +95,10 @@ if ($_GET["id"]) $result = $product->fetch($_GET["id"]); llxHeader("","",$langs->trans("CardProduct".$product->type)); -$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"); -$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) - { - 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++; - } -} - -// Multilangs -if($conf->global->MAIN_MULTILANGS) -{ - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - -// sousproduits -if($conf->global->PRODUIT_SOUSPRODUITS == 1) -{ - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; -$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=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); -dolibarr_fiche_head($head, $hselected, $titre); +dolibarr_fiche_head($head, 'price', $titre); + print '<table class="border" width="100%">'; diff --git a/htdocs/product/sousproduits/fiche.php b/htdocs/product/sousproduits/fiche.php index 6d2e4550298..7a2bd8fed0a 100644 --- a/htdocs/product/sousproduits/fiche.php +++ b/htdocs/product/sousproduits/fiche.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005-2006 R�gis Houssin <regis.houssin@cap-networks.com> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> @@ -24,17 +24,16 @@ */ /** - \file htdocs/product/fiche.php + \file htdocs/product/sousproduits/fiche.php \ingroup product \brief Page de la fiche produit \version $Revision$ */ require("./pre.inc.php"); - +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); -// if(MAIN_MODULE_CATEGORIE) - require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php"); +require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php"); @@ -152,92 +151,9 @@ if ($id || $ref) /* * 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'); - $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++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $hselected = $h; - $h++; - } - - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $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++; - - - $titre=$langs->trans("CardProduct".$product->type); - dolibarr_fiche_head($head, $hselected, $titre); + $head=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'subproduct', $titre); print($mesg); diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 2ab901df1d0..9609649d3ef 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -30,6 +30,7 @@ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -81,82 +82,9 @@ if ($_GET["id"] || $_GET["ref"]) /* * 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'); - $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++; - - //erics: pour cr�er des produits compos�s de x 'sous' produits - /* - $head[$h][0] = DOL_URL_ROOT."/product/pack.php?id=".$product->id; - $head[$h][1] = $langs->trans('Packs'); - $h++; - */ - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $head[$h][1] = $langs->trans('Referers'); - $hselected=$h; - $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); - dolibarr_fiche_head($head, $hselected, $titre); + $head=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'referers', $titre); print '<table class="border" width="100%">'; diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 03c27f5610a..88680f0e3e3 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -30,6 +30,7 @@ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -80,82 +81,9 @@ if ($_GET["id"] || $_GET["ref"]) /* * 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'); - $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++; - - //erics: pour cr�er des produits compos�s de x 'sous' produits - /* - $head[$h][0] = DOL_URL_ROOT."/product/pack.php?id=".$product->id; - $head[$h][1] = $langs->trans('Packs'); - $h++; - */ - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $head[$h][1] = $langs->trans('Referers'); - $hselected=$h; - $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); - dolibarr_fiche_head($head, $hselected, $titre); + $head=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'referers', $titre); print '<table class="border" width="100%">'; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index a3c85eee6dd..37b584e73bb 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -30,6 +30,7 @@ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -75,90 +76,10 @@ if ($_GET["id"] || $_GET["ref"]) /* * En mode visu */ + $head=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'referers', $titre); - $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'); - $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++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $head[$h][1] = $langs->trans('Referers'); - $hselected=$h; - $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); - dolibarr_fiche_head($head, $hselected, $titre); print '<table class="border" width="100%">'; diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index acb0e8aacce..938937b8e6e 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -30,6 +30,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -122,90 +123,10 @@ if ($_GET["id"] || $_GET["ref"]) } - $h=0; + $head=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'stats', $titre); - $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'); - $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++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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"); - $hselected=$h; - $h++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $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++; - - $titre=$langs->trans("CardProduct".$product->type); - dolibarr_fiche_head($head, $hselected, $titre); print '<table class="border" width="100%">'; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index c2f8605b95d..e5cf6785fdc 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -29,6 +29,7 @@ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -79,82 +80,9 @@ if ($_GET["id"] || $_GET["ref"]) /* * 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'); - $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++; - - //erics: pour cr�er des produits compos�s de x 'sous' produits - /* - $head[$h][0] = DOL_URL_ROOT."/product/pack.php?id=".$product->id; - $head[$h][1] = $langs->trans('Packs'); - $h++; - */ - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $head[$h][1] = $langs->trans('Referers'); - $hselected=$h; - $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); - dolibarr_fiche_head($head, $hselected, $titre); + $head=product_prepare_head($product); + $titre=$langs->trans("CardProduct".$product->type); + dolibarr_fiche_head($head, 'referers', $titre); print '<table class="border" width="100%">'; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f308d69633b..078b7369520 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -31,6 +31,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langs->load("products"); @@ -107,88 +108,10 @@ if ($_GET["id"] || $_GET["ref"]) if ($result > 0) { - $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'); - $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"); - $hselected = $h; - $h++; - } - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $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++; - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $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=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); - dolibarr_fiche_head($head, $hselected, $titre); + dolibarr_fiche_head($head, 'stock', $titre); + print($mesg); diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 905b80cce96..2ca9f78b815 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -1,24 +1,24 @@ <?php /* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com> -* -* 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. -* or see http://www.gnu.org/ -* -* $Id$ -* $Source$ -*/ + * + * 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. + * or see http://www.gnu.org/ + * + * $Id$ + * $Source$ + */ /** \file htdocs/product/traduction.php @@ -28,6 +28,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langs->load("products"); @@ -130,88 +131,6 @@ $product = new Product($db); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); if ($_GET["id"]) $result = $product->fetch($_GET["id"]); -/* - * D�finition des onglets - */ -$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'); - $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++; - } -} - -// Multilangs -if($conf->global->MAIN_MULTILANGS) -{ - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $hselected=$h; - $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++; - -// sousproduits -if($conf->global->PRODUIT_SOUSPRODUITS == 1) -{ - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; -$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++; /* * Affichage @@ -219,9 +138,10 @@ $h++; llxHeader("","",$langs->trans("Translation")); -$titre=$langs->trans("CardProduct".$product->type); -if ( $_GET["action"] != 'edit') dolibarr_fiche_head($head, $hselected, $titre); +$head=product_prepare_head($product); +$titre=$langs->trans("CardProduct".$product->type); +if ( $_GET["action"] != 'edit') dolibarr_fiche_head($head, 'translation', $titre); print '<table class="border" width="100%">'; -- GitLab