diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 4e95eecc148..22a560c7bf8 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -210,6 +210,7 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights } } } + // Update a product or service if ($_POST["action"] == 'update' && ($user->rights->produit->creer || $user->rights->service->creer)) { diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 8836e74527b..662dbdce902 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -102,7 +102,7 @@ else { $title=$langs->trans("ProductsAndServices"); - if ($type) + if (isset($_GET["type"])) { if ($type==1) { @@ -310,7 +310,7 @@ if ($resql) print_liste_field_titre($langs->trans("DateModification"),"liste.php", "p.tms",$param,"",'align="center"',$sortfield,$sortorder); if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"),"liste.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),"liste.php", "p.price",$param,"",'align="right"',$sortfield,$sortorder); - if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("Stock").''; + if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("PhysicalStock").''; print_liste_field_titre($langs->trans("Sell"),"liste.php", "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Buy"),"liste.php", "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; @@ -422,7 +422,7 @@ if ($resql) else print price($objp->price).' '.$langs->trans("HT"); print ''; - // Affichage du stock + // Show stock if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) { if ($objp->fk_product_type != 1) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index bed34f109f2..1c578780767 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ /** * \file htdocs/product/reassort.php * \ingroup produit - * \brief Page liste des produits ou services + * \brief Page to list stocks * \version $Id$ */ @@ -317,7 +317,9 @@ if ($resql) } //print ''.$objp->stock_theorique.''; print ''.$objp->seuil_stock_alerte.''; - print ''.$objp->stock_physique.''; + print ''.$objp->stock_physique; + if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockTooLow")); + print ''; print ''.$langs->trans("Movements").''; print ''.$product_static->LibStatut($objp->statut,5,0).''; print ''.$product_static->LibStatut($objp->tobuy,5,1).''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 6edd7d7e4b9..6f50978c8a8 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -54,6 +54,22 @@ $mesg = ''; * Actions */ +// Set stock limit +if ($_POST['action'] == 'setstocklimit') +{ + $product = new Product($db); + $result=$product->fetch($_POST['id']); + $product->seuil_stock_alerte=$_POST["stocklimit"]; + $result=$product->update($product->id,$user,1,0,1); + if ($result < 0) + { + $mesg=join(',',$product->errors); + } + $POST["action"]=""; + $id=$_POST["id"]; + $_GET["id"]=$_POST["id"]; +} + // Correct stock if ($_POST["action"] == "correct_stock" && ! $_POST["cancel"]) { @@ -182,7 +198,9 @@ if ($_GET["id"] || $_GET["ref"]) // Stock physique print ''.$langs->trans("PhysicalStock").''; - print ''.$product->stock_reel.''; + print ''.$product->stock_reel; + if ($product->seuil_stock_alerte && ($product->stock_reel < $product->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockTooLow")); + print ''; print ''; // Calculating a theorical value of stock if stock increment is done on real sending @@ -247,10 +265,10 @@ if ($_GET["id"] || $_GET["ref"]) print ''; } - // Stock - print ''.$langs->trans("StockLimit").''; - print ''.$product->seuil_stock_alerte.''; - print ''; + // Stock + print ''.$html->editfieldkey("StockLimit",'stocklimit',$product->seuil_stock_alerte,'id',$product->id,$user->rights->produit->creer).''; + print $html->editfieldval("StockLimit",'stocklimit',$product->seuil_stock_alerte,'id',$product->id,$user->rights->produit->creer); + print ''; // Last movement $sql = "SELECT max(m.datem) as datem"; @@ -387,8 +405,8 @@ else print "
\n"; -if ($_GET["action"] == '' ) -{ +//if (empty($_GET["action"])) +//{ if ($user->rights->stock->creer) { print ''.$langs->trans("StockCorrection").''; @@ -398,7 +416,7 @@ if ($_GET["action"] == '' ) { print ''.$langs->trans("StockMovement").''; } -} +//} print '
';