Fix: la barre de navigation se basait sur l'id

Add: visualisation du stock dans la liste produit
This commit is contained in:
Regis Houssin 2007-11-10 14:30:54 +00:00
parent a1c9025602
commit bd9e4acb47
20 changed files with 115 additions and 76 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 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
* it under the terms of the GNU General Public License as published by
@ -92,7 +92,7 @@ print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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 "<tr>";
// Reference
print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -143,7 +143,7 @@ if ($product->id)
// Reference
print '<tr>';
print '<td width="28%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -191,7 +191,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 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
* 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","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="center"',$sortfield);
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);
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);
if ($conf->stock->enabled && $type != 1) print_liste_field_titre($langs->trans("TotalStock"),"liste.php", "p.seuil_stock_alerte","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&amp;fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield);
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="center"',$sortfield);
print "</tr>\n";
@ -231,18 +232,24 @@ if ($resql)
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
print '</td>';
if ($conf->service->enabled && $type != 0)
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
if ($conf->service->enabled && $type != 0)
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
if ($conf->stock->enabled && $type != 1)
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
@ -274,22 +281,51 @@ if ($resql)
$var=!$var;
print '<tr '.$bc[$var].'><td nowrap="nowrap">';
print "<a href=\"fiche.php?id=$objp->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 '</a> ';
print '<a href="fiche.php?id='.$objp->rowid.'">'.$objp->ref."</a></td>\n";
print '<td>'.$objp->label.'</td>';
print '<td align="center">'.dolibarr_print_date($objp->datem)."</td>\n";
if ($conf->service->enabled && $type != 0)
{
print '<td align="center">';
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 '</td>';
}
{
print '<td align="center">';
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 '</td>';
}
print '<td align="right">'.price($objp->price).'</td>';
// 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 '<td align="right">'.$langs->trans("NoStock");
}
else
{
if ($product_static->stock_reel <= $objp->seuil_stock_alerte)
{
print '<td align="right">'.img_warning().' '.$product_static->stock_reel;
}
else
{
print '<td align="right">'.$product_static->stock_reel;
}
}
}
else if (!$type)
{
print '<td align="right">&nbsp;</td>';
}
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5).'</td>';
print "</tr>\n";
$i++;

View File

@ -119,7 +119,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -137,7 +137,7 @@ print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2006 Régis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2007 Régis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -163,7 +163,7 @@ if ($id || $ref)
// Reference
print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td></tr>';
// Libelle

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 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
* it under the terms of the GNU General Public License as published by
@ -94,7 +94,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 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
* it under the terms of the GNU General Public License as published by
@ -91,7 +91,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td></tr>';
// Libelle

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 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
* it under the terms of the GNU General Public License as published by
@ -90,7 +90,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -88,7 +88,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 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
* it under the terms of the GNU General Public License as published by
@ -88,7 +88,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -82,7 +82,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
*
* 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 '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005 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
* it under the terms of the GNU General Public License as published by
@ -118,7 +118,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
@ -145,7 +145,7 @@ print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';
print '</table>';