Fix: Corrections divers sur affichage des produits et stocks

This commit is contained in:
Laurent Destailleur 2007-11-13 20:52:06 +00:00
parent 4633330b6f
commit fb6cf9da81
4 changed files with 57 additions and 43 deletions

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-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 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
@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -96,7 +95,8 @@ else
$sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate('p.tms').' as datem,'; $sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.price_ttc, p.price_base_type,';
$sql.= ' p.fk_product_type, '.$db->pdate('p.tms').' as datem,';
$sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte'; $sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
if ($catid || ($conf->categorie->enabled && !$user->rights->categorie->voir)) if ($catid || ($conf->categorie->enabled && !$user->rights->categorie->voir))
@ -220,7 +220,7 @@ if ($resql)
print_liste_field_titre($langs->trans("DateModification"),"liste.php", "p.tms","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateModification"),"liste.php", "p.tms","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="center"',$sortfield,$sortorder);
if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"),"liste.php", "p.duration","&amp;envente=$envente&".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="center"',$sortfield,$sortorder); if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"),"liste.php", "p.duration","&amp;envente=$envente&".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SellingPrice"),"liste.php", "p.price","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),"liste.php", "p.price","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder);
if ($conf->stock->enabled && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("TotalStock").'</td>'; if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("Stock").'</td>';
print_liste_field_titre($langs->trans("Status"),"liste.php", "p.envente","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),"liste.php", "p.envente","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
@ -232,6 +232,9 @@ if ($resql)
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="snom" value="'.$snom.'">'; print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
if ($conf->service->enabled && $type != 0) if ($conf->service->enabled && $type != 0)
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -241,10 +244,7 @@ if ($resql)
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
print '&nbsp;';
print '</td>';
if ($conf->stock->enabled && $type != 1)
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '&nbsp;'; print '&nbsp;';
@ -279,7 +279,10 @@ if ($resql)
} }
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td nowrap="nowrap">'; print '<tr '.$bc[$var].'>';
// Ref
print '<td nowrap="nowrap">';
print "<a href=\"fiche.php?id=$objp->rowid\">"; print "<a href=\"fiche.php?id=$objp->rowid\">";
if ($objp->fk_product_type==1) if ($objp->fk_product_type==1)
print img_object($langs->trans("ShowService"),"service"); print img_object($langs->trans("ShowService"),"service");
@ -287,8 +290,14 @@ if ($resql)
print img_object($langs->trans("ShowProduct"),"product"); print img_object($langs->trans("ShowProduct"),"product");
print '</a> '; print '</a> ';
print '<a href="fiche.php?id='.$objp->rowid.'">'.$objp->ref."</a></td>\n"; print '<a href="fiche.php?id='.$objp->rowid.'">'.$objp->ref."</a></td>\n";
// Label
print '<td>'.$objp->label.'</td>'; print '<td>'.$objp->label.'</td>';
print '<td align="center">'.dolibarr_print_date($objp->datem)."</td>\n";
// Date
print '<td align="center">'.dolibarr_print_date($objp->datem,'day')."</td>\n";
// Duration
if ($conf->service->enabled && $type != 0) if ($conf->service->enabled && $type != 0)
{ {
print '<td align="center">'; print '<td align="center">';
@ -298,35 +307,39 @@ if ($resql)
else print $objp->duration; else print $objp->duration;
print '</td>'; print '</td>';
} }
print '<td align="right">'.price($objp->price).'</td>';
// Price
print '<td align="right">';
if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
else print price($objp->price).' '.$langs->trans("HT");
print '</td>';
// Affichage du stock // Affichage du stock
if ($objp->fk_product_type!=1 && $conf->stock->enabled && $user->rights->stock->lire) if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
{
if ($objp->fk_product_type != 1)
{ {
$product_static->id = $objp->rowid; $product_static->id = $objp->rowid;
$product_static->load_stock(); $product_static->load_stock();
if ($product_static->no_stock) if ($product_static->stock_reel < $objp->seuil_stock_alerte)
{ {
print '<td align="right">'.$langs->trans("NoStock"); print '<td align="right">'.$product_static->stock_reel.' '.img_warning($langs->trans("StockTooLow")).'</td>';
} }
else else
{ {
if ($product_static->stock_reel <= $objp->seuil_stock_alerte) print '<td align="right">'.$product_static->stock_reel.'</td>';
{ }
print '<td align="right">'.img_warning().' '.$product_static->stock_reel;
} }
else else
{ {
print '<td align="right">'.$product_static->stock_reel; print '<td>&nbsp;</td>';
} }
} }
}
else if (!$type)
{
print '<td align="right">&nbsp;</td>';
}
// Statut
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5).'</td>'; print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5).'</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -30,7 +29,8 @@
require_once("./pre.inc.php"); require_once("./pre.inc.php");
require_once("./entrepot.class.php"); require_once("./entrepot.class.php");
$user->getrights("stocks"); $user->getrights();
$langs->load("stocks"); $langs->load("stocks");
if (!$user->rights->stock->lire) if (!$user->rights->stock->lire)

View File

@ -30,7 +30,8 @@
require("./pre.inc.php"); require("./pre.inc.php");
require_once("./entrepot.class.php"); require_once("./entrepot.class.php");
$user->getrights('stocks'); $user->getrights();
$langs->load("stocks"); $langs->load("stocks");
if (!$user->rights->stock->lire) if (!$user->rights->stock->lire)

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-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -30,7 +29,8 @@
require("./pre.inc.php"); require("./pre.inc.php");
require_once("./entrepot.class.php"); require_once("./entrepot.class.php");
$user->getrights('stocks'); $user->getrights();
$langs->load("stocks"); $langs->load("stocks");
if (!$user->rights->stock->lire) if (!$user->rights->stock->lire)