From a8cda44cca102e878a1eb1e03f45f018bf5a9563 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 2 Jan 2007 15:30:33 +0000 Subject: [PATCH] Modif =product_prepare_head($product, $user); BUG 18583 --- htdocs/lib/product.lib.php | 337 ++++++++++++++++++------------------- 1 file changed, 168 insertions(+), 169 deletions(-) diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index 2f331db06fd..27f58f022e2 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2007 Rodolphe Quiedeville * * 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 @@ -21,192 +22,190 @@ */ /** - \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 + \file htdocs/lib/product.lib.php + \brief Ensemble de fonctions de base pour le module produit et service + \version $Revision$ */ -function product_prepare_head($product) +function product_prepare_head($product, $user) { - 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++; - - $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; - $head[$h][1] = $langs->trans("Photos"); - $head[$h][2] = 'photos'; - $h++; - - //affichage onglet catégorie - if ($conf->categorie->enabled) + 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++; + + $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; + $head[$h][1] = $langs->trans("Photos"); + $head[$h][2] = 'photos'; + $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) { - $head[$h][0] = DOL_URL_ROOT."/product/categorie.php?id=".$product->id; - $head[$h][1] = $langs->trans('Categories'); - $head[$h][2] = 'category'; - $h++; + 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) + } + + // 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++; + } + + // 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++; + } + + 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++; + + $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/document.php?id='.$product->id; + $head[$h][1] = $langs->trans('Documents'); + $head[$h][2] = 'documents'; + $h++; + + if($product->type == 0) // Si produit stockable + { + if ($conf->stock->enabled) { - 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++; - } - } + $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++; - } - - // 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++; - } - - 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++; - - $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/document.php?id='.$product->id; - $head[$h][1] = $langs->trans('Documents'); - $head[$h][2] = 'documents'; - $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++; - } - } - - return $head; + } + + return $head; } function show_stats_for_company($product,$socid) { - global $conf,$langs,$user,$db; - - print ''; - print ''.$langs->trans("Referers").''; - print ''.$langs->trans("NbOfThirdParties").''; - print ''.$langs->trans("NbOfReferers").''; - print ''.$langs->trans("TotalQuantity").''; - print ''; - - // Propals - if ($conf->propal->enabled && $user->rights->propale->lire) + global $conf,$langs,$user,$db; + + print ''; + print ''.$langs->trans("Referers").''; + print ''.$langs->trans("NbOfThirdParties").''; + print ''.$langs->trans("NbOfReferers").''; + print ''.$langs->trans("TotalQuantity").''; + print ''; + + // Propals + if ($conf->propal->enabled && $user->rights->propale->lire) { - $ret=$product->load_stats_propale($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("propal"); - print ''; - print ''.img_object('','propal').' '.$langs->trans("Proposals").''; - print ''; - print $product->stats_propale['customers']; - print ''; - print $product->stats_propale['nb']; - print ''; - print $product->stats_propale['qty']; - print ''; - print ''; + $ret=$product->load_stats_propale($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("propal"); + print ''; + print ''.img_object('','propal').' '.$langs->trans("Proposals").''; + print ''; + print $product->stats_propale['customers']; + print ''; + print $product->stats_propale['nb']; + print ''; + print $product->stats_propale['qty']; + print ''; + print ''; } - // Commandes clients - if ($conf->commande->enabled && $user->rights->commande->lire) + // Commandes clients + if ($conf->commande->enabled && $user->rights->commande->lire) { - $ret=$product->load_stats_commande($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("orders"); - print ''; - print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; - print ''; - print $product->stats_commande['customers']; - print ''; - print $product->stats_commande['nb']; - print ''; - print $product->stats_commande['qty']; - print ''; - print ''; + $ret=$product->load_stats_commande($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("orders"); + print ''; + print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; + print ''; + print $product->stats_commande['customers']; + print ''; + print $product->stats_commande['nb']; + print ''; + print $product->stats_commande['qty']; + print ''; + print ''; } - // Commandes fournisseurs - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) + // Commandes fournisseurs + if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) { - $ret=$product->load_stats_commande_fournisseur($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("orders"); - print ''; - print ''.img_object('','order').' '.$langs->trans("SuppliersOrders").''; - print ''; - print $product->stats_commande_fournisseur['suppliers']; - print ''; - print $product->stats_commande_fournisseur['nb']; - print ''; - print $product->stats_commande_fournisseur['qty']; - print ''; - print ''; + $ret=$product->load_stats_commande_fournisseur($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("orders"); + print ''; + print ''.img_object('','order').' '.$langs->trans("SuppliersOrders").''; + print ''; + print $product->stats_commande_fournisseur['suppliers']; + print ''; + print $product->stats_commande_fournisseur['nb']; + print ''; + print $product->stats_commande_fournisseur['qty']; + print ''; + print ''; } - // Contrats - if ($conf->contrat->enabled && $user->rights->contrat->lire) + // Contrats + if ($conf->contrat->enabled && $user->rights->contrat->lire) { - $ret=$product->load_stats_contrat($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("contracts"); - print ''; - print ''.img_object('','contract').' '.$langs->trans("Contracts").''; - print ''; - print $product->stats_contrat['customers']; - print ''; - print $product->stats_contrat['nb']; - print ''; - print $product->stats_contrat['qty']; - print ''; - print ''; + $ret=$product->load_stats_contrat($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("contracts"); + print ''; + print ''.img_object('','contract').' '.$langs->trans("Contracts").''; + print ''; + print $product->stats_contrat['customers']; + print ''; + print $product->stats_contrat['nb']; + print ''; + print $product->stats_contrat['qty']; + print ''; + print ''; } // Factures clients if ($conf->facture->enabled && $user->rights->facture->lire) @@ -243,8 +242,8 @@ function show_stats_for_company($product,$socid) print ''; } - return 0; + return 0; } -?> \ No newline at end of file +?>