diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php
index 0444e16f094..92203b4fbd3 100644
--- a/htdocs/product/stock/index.php
+++ b/htdocs/product/stock/index.php
@@ -49,7 +49,7 @@ print '
";
@@ -94,6 +94,63 @@ else
print '';
+// Last movements
+$max=10;
+$sql = "SELECT p.rowid, p.label as produit,";
+$sql.= " s.label as stock, s.rowid as entrepot_id,";
+$sql.= " m.value, ".$db->pdate("m.datem")." as datem";
+$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as s, ".MAIN_DB_PREFIX."stock_mouvement as m, ".MAIN_DB_PREFIX."product as p";
+if ($conf->categorie->enabled && !$user->rights->categorie->voir)
+{
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
+}
+$sql .= " WHERE m.fk_product = p.rowid AND m.fk_entrepot = s.rowid";
+if ($conf->categorie->enabled && !$user->rights->categorie->voir)
+{
+ $sql.= " AND IFNULL(c.visible,1)=1";
+}
+$sql .= " ORDER BY datem DESC";
+$sql .= $db->plimit($max,0);
+
+dolibarr_syslog("Index:list stock movements sql=".$sql, LOG_DEBUG);
+$resql = $db->query($sql) ;
+if ($resql)
+{
+ $num = $db->num_rows($resql);
+
+ print '";
+}
print ' | ';
diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php
index ce45d0d8b22..3290cb54d60 100644
--- a/htdocs/product/stock/liste.php
+++ b/htdocs/product/stock/liste.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2006 Laurent Destailleur
+ * Copyright (C) 2004-2008 Laurent Destailleur
*
* 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
@@ -15,16 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- * $Source$
*/
/**
\file htdocs/product/stock/liste.php
\ingroup stock
\brief Page liste des stocks
- \version $Revision$
+ \version $Id$
*/
require("./pre.inc.php");
@@ -49,16 +46,16 @@ $limit = $conf->liste_limit;
$offset = $limit * $page;
-$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu, e.address, e.cp, e.ville, e.fk_pays";
+$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.cp, e.ville, e.fk_pays";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " WHERE 1=1";
if ($sref)
{
- $sql .= " AND e.ref like '%".$sref."%'";
+ $sql .= " AND e.label like '%".$sref."%'";
}
if ($sall)
{
- $sql .= " AND (e.label like '%".$sall."%' OR e.description like '%".$sall."%' OR e.lieu like '%".$sall."%' OR e.address like '%".$sall."%' OR e.ville like '%".$sall."%')";
+ $sql .= " AND (e.description like '%".$sall."%' OR e.lieu like '%".$sall."%' OR e.address like '%".$sall."%' OR e.ville like '%".$sall."%')";
}
$sql .= " ORDER BY $sortfield $sortorder";
$sql .= $db->plimit($limit + 1 ,$offset);
@@ -91,7 +88,7 @@ if ($result)
$objp = $db->fetch_object($result);
$var=!$var;
print "";
- print '| '.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.' | ';
+ print ''.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.' | ';
print ''.$objp->lieu.' | ';
print ''.$entrepot->LibStatut($objp->statut,5).' | ';
print "
\n";
diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php
index 769ca00c19e..3a749027d0f 100644
--- a/htdocs/product/stock/mouvement.php
+++ b/htdocs/product/stock/mouvement.php
@@ -77,7 +77,7 @@ if ($resql)
$result = $entrepot->fetch($_GET["id"]);
if ($result < 0)
{
- dolibarr_print_error($db);
+ dolibarr_print_error($db);
}
}
@@ -142,7 +142,8 @@ if ($resql)
$param="&id=".$_GET["id"]."&sref=$sref&snom=$snom";
- print_barre_liste($texte, $page, "mouvement.php", $param, $sortfield, $sortorder,'',$num,0,'');
+ if ($_GET["id"]) print_barre_liste($texte, $page, "mouvement.php", $param, $sortfield, $sortorder,'',$num,0,'');
+ else print_barre_liste($texte, $page, "mouvement.php", $param, $sortfield, $sortorder,'',$num);
print '