Fix: Warning for stock was not visible

Fix: Change of stock limit was not possible
This commit is contained in:
Laurent Destailleur 2011-01-10 20:46:21 +00:00
parent a667a9e52e
commit 5e939a3d2a
4 changed files with 35 additions and 14 deletions

View File

@ -210,6 +210,7 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights
} }
} }
} }
// Update a product or service // Update a product or service
if ($_POST["action"] == 'update' && ($user->rights->produit->creer || $user->rights->service->creer)) if ($_POST["action"] == 'update' && ($user->rights->produit->creer || $user->rights->service->creer))
{ {

View File

@ -102,7 +102,7 @@ else
{ {
$title=$langs->trans("ProductsAndServices"); $title=$langs->trans("ProductsAndServices");
if ($type) if (isset($_GET["type"]))
{ {
if ($type==1) 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); 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); 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); 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 '<td class="liste_titre" align="right">'.$langs->trans("Stock").'</td>'; if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
print_liste_field_titre($langs->trans("Sell"),"liste.php", "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); 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_liste_field_titre($langs->trans("Buy"),"liste.php", "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
@ -422,7 +422,7 @@ if ($resql)
else print price($objp->price).' '.$langs->trans("HT"); else print price($objp->price).' '.$langs->trans("HT");
print '</td>'; print '</td>';
// Affichage du stock // Show stock
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
{ {
if ($objp->fk_product_type != 1) if ($objp->fk_product_type != 1)

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -21,7 +21,7 @@
/** /**
* \file htdocs/product/reassort.php * \file htdocs/product/reassort.php
* \ingroup produit * \ingroup produit
* \brief Page liste des produits ou services * \brief Page to list stocks
* \version $Id$ * \version $Id$
*/ */
@ -317,7 +317,9 @@ if ($resql)
} }
//print '<td align="right">'.$objp->stock_theorique.'</td>'; //print '<td align="right">'.$objp->stock_theorique.'</td>';
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>'; print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
print '<td align="right">'.$objp->stock_physique.'</td>'; print '<td align="right">'.$objp->stock_physique;
if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockTooLow"));
print '</td>';
print '<td align="right"><a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product_static->id.'">'.$langs->trans("Movements").'</a></td>'; print '<td align="right"><a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product_static->id.'">'.$langs->trans("Movements").'</a></td>';
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5,0).'</td>'; print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5,0).'</td>';
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>'; print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>';

View File

@ -54,6 +54,22 @@ $mesg = '';
* Actions * 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 // Correct stock
if ($_POST["action"] == "correct_stock" && ! $_POST["cancel"]) if ($_POST["action"] == "correct_stock" && ! $_POST["cancel"])
{ {
@ -182,7 +198,9 @@ if ($_GET["id"] || $_GET["ref"])
// Stock physique // Stock physique
print '<tr><td>'.$langs->trans("PhysicalStock").'</td>'; print '<tr><td>'.$langs->trans("PhysicalStock").'</td>';
print '<td>'.$product->stock_reel.'</td>'; print '<td>'.$product->stock_reel;
if ($product->seuil_stock_alerte && ($product->stock_reel < $product->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockTooLow"));
print '</td>';
print '</tr>'; print '</tr>';
// Calculating a theorical value of stock if stock increment is done on real sending // Calculating a theorical value of stock if stock increment is done on real sending
@ -247,10 +265,10 @@ if ($_GET["id"] || $_GET["ref"])
print '</td></tr>'; print '</td></tr>';
} }
// Stock // Stock
print '<tr><td>'.$langs->trans("StockLimit").'</td>'; print '<tr><td>'.$html->editfieldkey("StockLimit",'stocklimit',$product->seuil_stock_alerte,'id',$product->id,$user->rights->produit->creer).'</td><td colspan="2">';
print '<td>'.$product->seuil_stock_alerte.'</td>'; print $html->editfieldval("StockLimit",'stocklimit',$product->seuil_stock_alerte,'id',$product->id,$user->rights->produit->creer);
print '</tr>'; print '</td></tr>';
// Last movement // Last movement
$sql = "SELECT max(m.datem) as datem"; $sql = "SELECT max(m.datem) as datem";
@ -387,8 +405,8 @@ else
print "<div class=\"tabsAction\">\n"; print "<div class=\"tabsAction\">\n";
if ($_GET["action"] == '' ) //if (empty($_GET["action"]))
{ //{
if ($user->rights->stock->creer) if ($user->rights->stock->creer)
{ {
print '<a class="butAction" href="product.php?id='.$product->id.'&amp;action=correction">'.$langs->trans("StockCorrection").'</a>'; print '<a class="butAction" href="product.php?id='.$product->id.'&amp;action=correction">'.$langs->trans("StockCorrection").'</a>';
@ -398,7 +416,7 @@ if ($_GET["action"] == '' )
{ {
print '<a class="butAction" href="product.php?id='.$product->id.'&amp;action=transfert">'.$langs->trans("StockMovement").'</a>'; print '<a class="butAction" href="product.php?id='.$product->id.'&amp;action=transfert">'.$langs->trans("StockMovement").'</a>';
} }
} //}
print '</div>'; print '</div>';