diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 1f6b4697dc9..4d62967fd51 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -111,6 +111,7 @@ ConfirmDeleteProductLine=Are you sure you want to delete this product line? NoProductMatching=No product/service match your criteria MatchingProducts=Matching products/services NoStockForThisProduct=No stock for this product +NoStock=No Stock Restock=Restock ProductSpecial=Special QtyMin=Quantity minimum diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 1f59abecde4..7cec8306f56 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -111,6 +111,7 @@ NoProductMatching=Aucun produit/service ne r MatchingProducts=Produits/Services trouvés NewBook=Nouveau livre NoStockForThisProduct=Pas de stock pour ce produit +NoStock=Pas de stock Restock=Réassort ProductSpecial=Special QtyMin=Quantité minimum diff --git a/htdocs/product.class.php b/htdocs/product.class.php index bd56465d197..41fcd667ffb 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -826,11 +826,11 @@ class Product extends CommonObject // Verification parametres if (! $id && ! $ref) - { - $this->error=$langs->trans('ErrorWrongParameters'); - dolibarr_print_error("Product::fetch ".$this->error); - return -1; - } + { + $this->error=$langs->trans('ErrorWrongParameters'); + dolibarr_print_error("Product::fetch ".$this->error); + return -1; + } $sql = "SELECT rowid, ref, label, description, note, price, price_ttc, price_base_type, tva_tx, envente,"; $sql.= " nbvente, fk_product_type, duration, seuil_stock_alerte,canvas,"; @@ -839,11 +839,11 @@ class Product extends CommonObject if ($id) $sql.= " WHERE rowid = '".$id."'"; if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'"; - dolibarr_syslog("Product::fetch sql=".$sql); + dolibarr_syslog("Product::fetch sql=".$sql); $result = $this->db->query($sql); if ( $result ) - { - $result = $this->db->fetch_array(); + { + $result = $this->db->fetch_array(); $this->id = $result["rowid"]; $this->ref = $result["ref"]; @@ -2122,33 +2122,33 @@ class Product extends CommonObject $sql.= " WHERE fk_product = '".$this->id."'"; $result = $this->db->query($sql) ; if ($result) - { - $num = $this->db->num_rows($result); - $i=0; - if ($num > 0) - { - while ($i < $num ) + { + $num = $this->db->num_rows($result); + $i=0; + if ($num > 0) + { + while ($i < $num ) { - $row = $this->db->fetch_row($result); - $this->stock_entrepot[$row[1]] = $row[0]; - $this->stock_reel = $this->stock_reel + $row[0]; - $i++; + $row = $this->db->fetch_row($result); + $this->stock_entrepot[$row[1]] = $row[0]; + $this->stock_reel = $this->stock_reel + $row[0]; + $i++; } - - $this->no_stock = 0; + + $this->no_stock = 0; + } + else + { + $this->no_stock = 1; + } + $this->db->free($result); + return 1; } - else - { - $this->no_stock = 1; - } - $this->db->free($result); - return 1; - } else - { - $this->error=$this->db->error(); - return -1; - } + { + $this->error=$this->db->error(); + return -1; + } } diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php index c872fd181ba..1ef4f11d48b 100644 --- a/htdocs/product/barcode.php +++ b/htdocs/product/barcode.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2006 Laurent Destailleur - * Copyright (C) 2005 Regis Houssin + * Copyright (C) 2005-2007 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 @@ -92,7 +92,7 @@ print ''; // Reference print ''; print ''; print ''; diff --git a/htdocs/product/categorie.php b/htdocs/product/categorie.php index 962683d7fe9..2b93dc582a0 100644 --- a/htdocs/product/categorie.php +++ b/htdocs/product/categorie.php @@ -1,9 +1,9 @@ * Copyright (C) 2005 Brice Davoleau - * Copyright (C) 2005-2006 Regis Houssin + * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2006-2007 Laurent Destailleur - * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2007 Patrick Raguin * * 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 @@ -107,7 +107,7 @@ if ($_GET["id"] || $_GET["ref"]) print ""; // Reference print ''; print ''; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 46cda0e84c6..9f909666569 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -143,7 +143,7 @@ if ($product->id) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 800a18663bc..9f7515dccb2 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -191,7 +191,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index f07fd57a9b0..d771f5d59a9 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2006 Laurent Destailleur - * Copyright (C) 2005-2006 Regis Houssin + * Copyright (C) 2005-2007 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 @@ -97,8 +97,8 @@ else $sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate('p.tms').' as datem,'; -$sql.= ' p.duration, p.envente as statut'; -$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; // '.MAIN_DB_PREFIX.'product_det as d'; //en attendant le debugage +$sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte'; +$sql.= ' FROM '.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"; @@ -220,6 +220,7 @@ if ($resql) print_liste_field_titre($langs->trans("DateModification"),"liste.php", "p.tms","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="center"',$sortfield); if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"),"liste.php", "p.duration","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="center"',$sortfield); print_liste_field_titre($langs->trans("SellingPrice"),"liste.php", "p.price","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield); + if ($conf->stock->enabled && $type != 1) print_liste_field_titre($langs->trans("TotalStock"),"liste.php", "p.seuil_stock_alerte","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield); print_liste_field_titre($langs->trans("Status"),"liste.php", "p.envente","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="center"',$sortfield); print "\n"; @@ -231,18 +232,24 @@ if ($resql) print ''; - if ($conf->service->enabled && $type != 0) - { - print ''; - } + if ($conf->service->enabled && $type != 0) + { + print ''; + } print ''; print ''; + if ($conf->stock->enabled && $type != 1) + { + print ''; + } print '\n"; print ''; print '\n"; if ($conf->service->enabled && $type != 0) - { - print ''; - } + { + print ''; + } print ''; + + // Affichage du stock + if ($objp->fk_product_type!=1 && $conf->stock->enabled && $user->rights->stock->lire) + { + $product_static->id = $objp->rowid; + $product_static->load_stock(); + if ($product_static->no_stock) + { + print ''; + } + print ''; print "\n"; $i++; diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index 0931b766aca..92fe3ab1e79 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -119,7 +119,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a93b13ff720..ccacef03269 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -137,7 +137,7 @@ print '
'.$langs->trans("Ref").''; -print $html->showrefnav($product,'ref'); +print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'; print ''; print ''; - print ' '; - print ''; + print ' '; + print ''; print ' '; print ''; print ' '; print ''; + print ' '; + print ''; print ''; print ''; @@ -274,22 +281,51 @@ if ($resql) $var=!$var; print '
'; print "rowid\">"; - if ($objp->fk_product_type==1) print img_object($langs->trans("ShowService"),"service"); - else print img_object($langs->trans("ShowProduct"),"product"); + if ($objp->fk_product_type==1) + print img_object($langs->trans("ShowService"),"service"); + else + print img_object($langs->trans("ShowProduct"),"product"); print ' '; print ''.$objp->ref."'.$objp->label.''.dolibarr_print_date($objp->datem)."'; - if (eregi('([0-9]+)y',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); - elseif (eregi('([0-9]+)m',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); - elseif (eregi('([0-9]+)d',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); - else print $objp->duration; - print ''; + if (eregi('([0-9]+)y',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); + elseif (eregi('([0-9]+)m',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); + elseif (eregi('([0-9]+)d',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); + else print $objp->duration; + print ''.price($objp->price).''.$langs->trans("NoStock"); + } + else + { + if ($product_static->stock_reel <= $objp->seuil_stock_alerte) + { + print ''.img_warning().' '.$product_static->stock_reel; + } + else + { + print ''.$product_static->stock_reel; + } + } + } + else if (!$type) + { + print ' '.$product_static->LibStatut($objp->statut,5).'
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'; // Reference print ''; print ''; print ''; diff --git a/htdocs/product/sousproduits/fiche.php b/htdocs/product/sousproduits/fiche.php index 36a5e0e225d..0c6a5e627e3 100644 --- a/htdocs/product/sousproduits/fiche.php +++ b/htdocs/product/sousproduits/fiche.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2006 Régis Houssin + * Copyright (C) 2005-2007 Régis Houssin * Copyright (C) 2006 Andre Cianfarani * * This program is free software; you can redistribute it and/or modify @@ -163,7 +163,7 @@ if ($id || $ref) // Reference print ''; // Libelle diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 56a1a9754a5..9d3fb9133f1 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005 Regis Houssin + * Copyright (C) 2005-2007 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 @@ -94,7 +94,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 0b6651e1d06..7dc32d20148 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005 Regis Houssin + * Copyright (C) 2005-2007 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 @@ -91,7 +91,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; // Libelle diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index c84963bb398..45b40c035a3 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005 Regis Houssin + * Copyright (C) 2005-2007 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 @@ -90,7 +90,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 0a306eedeab..564c4addc3d 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -88,7 +88,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 74db7340124..e1076f4f972 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005-2006 Regis Houssin + * Copyright (C) 2005-2007 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 @@ -88,7 +88,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index 280c4896d4c..9206634e8c9 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -82,7 +82,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index c2c1695b43b..c1a677f9ccf 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2005-2007 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 @@ -91,7 +92,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 726febb7ab0..5d5d3272acd 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2005 Regis Houssin + * Copyright (C) 2005-2007 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 @@ -118,7 +118,7 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print ''; print ''; print ''; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 7ca81e93df1..b401b843692 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * * This program is free software; you can redistribute it and/or modify @@ -145,7 +145,7 @@ print '
'.$langs->trans("Ref").''; -print $html->showrefnav($product,'ref'); +print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref'); + print $html->showrefnav($product,'ref','',1,'ref'); print '
'; // Reference print ''; print ''; print ''; print '
'.$langs->trans("Ref").''; -print $html->showrefnav($product,'ref'); +print $html->showrefnav($product,'ref','',1,'ref'); print '
';