diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index 11c1e28e423..699bba7e198 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -105,10 +105,10 @@ print "
";
$prodser = array();
$prodser[0][0]=$prodser[0][1]=$prodser[1][0]=$prodser[1][1]=0;
-$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell";
+$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE p.entity = ".$conf->entity;
-$sql.= " GROUP BY p.fk_product_type, p.tosell";
+$sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
$result = $db->query($sql);
while ($objp = $db->fetch_object($result))
{
@@ -162,7 +162,7 @@ print '
| '.$transRecordedType.' | ||||
| '.$transRecordedType.' | '; - print $product_static->LibStatut($objp->tosell,5); + print $product_static->LibStatut($objp->tosell,5,0); print " | "; + print ''; + print $product_static->LibStatut($objp->tobuy,5,1); + print " | "; print "\n"; $i++; } diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 2b96e5aa62c..8563cba1686 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -123,7 +123,7 @@ else $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql.= ' p.fk_product_type, p.tms as datem,'; -$sql.= ' p.duration, p.tosell as statut, p.seuil_stock_alerte'; +$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; // We'll need this table joined to the select in order to filter by categ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; @@ -194,6 +194,10 @@ if ($resql) { $tosell = (isset($_GET["tosell"])?$_GET["tosell"]:$_POST["tosell"]); } + if (isset($_GET["tobuy"]) || isset($_POST["tobuy"])) + { + $tosell = (isset($_GET["tobuy"])?$_GET["tobuy"]:$_POST["tobuy"]); + } $helpurl=''; if (isset($_GET["type"]) && $_GET["type"] == 0) @@ -213,7 +217,7 @@ if ($resql) print ''.$langs->trans("Stock").' | '; - print_liste_field_titre($langs->trans("Status"),"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 "\n"; // Lignes des champs de filtre @@ -344,6 +349,9 @@ if ($resql) print ' '; print ''; } + print ''; + print ' '; + print ' | '; print ''; print ''; print ''; @@ -438,10 +446,13 @@ if ($resql) } } - // Statut - print ' | '.$product_static->LibStatut($objp->statut,5).' | '; + // Status (to buy) + print ''.$product_static->LibStatut($objp->tosell,5,0).' | '; - print "\n"; + // Status (to sell) + print ''.$product_static->LibStatut($objp->tobuy,5,1).' | '; + + print "\n"; $i++; } @@ -449,11 +460,11 @@ if ($resql) { if ($sref || $snom || $sall || $sbarcode || $_POST["search"]) { - print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell, $sortfield, $sortorder,'',$num); + print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); } else { - print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell, $sortfield, $sortorder,'',$num); + print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); } } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 4a318c122e7..0adc5d89358 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -332,11 +332,11 @@ if ($resql) { if ($sref || $snom || $sall || $_POST["search"]) { - print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$_POST["tosell"]."&tobuy=".$_POST["tobuy"], $sortfield, $sortorder,'',$num, 0, ''); + print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); } else { - print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, 0, ''); + print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); } }