From fc6d6fdcb7c9185223fbfa7497404ba569b05381 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Nov 2007 20:59:12 +0000 Subject: [PATCH] Fix: Corrections divers sur affichage des produits et stocks --- htdocs/product/fiche.php | 21 ++++++++++----------- htdocs/product/reassort.php | 11 +++++------ htdocs/product/stock/product.php | 25 +++++++++---------------- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 684a5e10b30..66209fded45 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -568,6 +568,8 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer) print $langs->trans("RefAlreadyExists"); } print ''; + + // Label print ''.$langs->trans("Label").''; if($conf->global->PRODUIT_MULTIPRICES == 1) @@ -593,15 +595,18 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer) print ''; } + // VAT print ''.$langs->trans("VATRate").''; print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,''); print ''; + // Status print ''.$langs->trans("Status").''; $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $html->select_array('statut',$statutarray,$_POST["statut"]); print ''; + // Stock min level if ($_GET["type"] != 1 && $conf->stock->enabled) { print 'Seuil stock'; @@ -840,6 +845,7 @@ if ($_GET["id"] || $_GET["ref"]) } print ''; } + // Statut print ''.$langs->trans("Status").''; print $product->getLibStatut(2); @@ -852,22 +858,15 @@ if ($_GET["id"] || $_GET["ref"]) if ($product->isproduct() && $conf->stock->enabled) { print ''.$langs->trans("Stock").''; - if ($product->no_stock) + if ($product->stock_reel < $product->seuil_stock_alerte) { - print "".$langs->trans("NoStockForThisProduct"); + print ''.$product->stock_reel.' '.img_warning().' (Seuil: '.$product->seuil_stock_alerte.')'; } else { - if ($product->stock_reel <= $product->seuil_stock_alerte) - { - print ''.img_warning().' '.$product->stock_reel.' Seuil : '.$product->seuil_stock_alerte; - } - else - { - print "".$product->stock_reel; - } + print "".$product->stock_reel.''; } - print ''; + print ''; } // Description diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index e2af7afb53b..e86b7e81499 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2006 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -81,11 +80,11 @@ $sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate $sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte,'; $sql.= ' p.stock_commande,'; $sql.= ' SUM(s.reel) as stock,'; -// \TODO Bug ? On soustrait le stock commandé alors qu'il ait stocké en base en négatif. Du coup on additionne ! +// \FIXME Bug ? On soustrait le stock commandé alors qu'il ait stocké en base en négatif. Du coup on additionne ! $sql.= ' (SUM(s.reel) - p.stock_commande) as stock_dispo'; -$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; // '.MAIN_DB_PREFIX.'product_det as d'; //en attendant le debugage -$sql.= ',' .MAIN_DB_PREFIX.'product_stock as s'; -if ($catid || ($conf->categorie->enabled && !$user->rights->categorie->voir)) +$sql.= ' FROM '.MAIN_DB_PREFIX.'product_stock as s,'; // '.MAIN_DB_PREFIX.'product_det as d'; //en attendant le debugage +$sql.= ' '.MAIN_DB_PREFIX.'product as p'; +if ($catid || ($conf->categorie->enabled && ! $user->rights->categorie->voir)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 5d5d3272acd..23477eea2b8 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -145,22 +145,15 @@ if ($_GET["id"] || $_GET["ref"]) // Stock print ''.$langs->trans("TotalStock").''; - if ($product->no_stock) - { - print "".$langs->trans("NoStockForThisProduct"); - } - else - { - if ($product->stock_reel <= $product->seuil_stock_alerte) - { - print ''.img_warning().' '.$product->stock_reel.' '.$langs->trans("StockLimit").' : '.$product->seuil_stock_alerte; - } - else - { - print "".$product->stock_reel; - } - } - print ''; + if ($product->stock_reel < $product->seuil_stock_alerte) + { + print ''.$product->stock_reel.' '.img_warning().' (Seuil: '.$product->seuil_stock_alerte.')'; + } + else + { + print "".$product->stock_reel.''; + } + print ''; // Nbre de commande clients en cours