From 08dc7ade3b7840d594638e4e36f78de8af407ea1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2016 14:04:03 +0200 Subject: [PATCH] Fix list of supplier price must show price compared to quantity. --- htdocs/fourn/card.php | 28 ++++++++++++++++++++-------- htdocs/fourn/product/list.php | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 8e74648500b..71f86cf0fe5 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -298,22 +298,22 @@ if ($object->id > 0) $langs->load("products"); print ''; print ''; - print ''; //Query from product/liste.php - $sql = 'SELECT p.rowid, p.ref, p.label, pfp.tms,'; - $sql.= ' p.fk_product_type, p.entity'; + $sql = 'SELECT p.rowid, p.ref, p.label, p.fk_product_type, p.entity,'; + $sql.= ' pfp.tms, pfp.ref_fourn as supplier_ref, pfp.price, pfp.quantity, pfp.unitprice'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; $sql.= ' AND pfp.fk_soc = '.$object->id; $sql .= $db->order('pfp.tms', 'desc'); $sql.= $db->plimit($MAXLIST); - $query = $db->query($sql); - + if (! $query) dol_print_error($db); + $return = array(); if ($db->num_rows($query)) { @@ -335,12 +335,24 @@ if ($object->id > 0) print $productstatic->getNomUrl(1); print ''; print ''; - print ''; - print ''; + //print ''; + print ''; print ''; } } diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 6a4f2255f6b..95ff1620691 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -23,7 +23,7 @@ /** * \file htdocs/fourn/product/list.php * \ingroup produit - * \brief Page liste des produits ou services + * \brief Page to list supplier products and services */ require '../../main.inc.php';
'.$langs->trans("ProductsAndServices").''; + print ''.$langs->trans("ProductsAndServices").''; print ''.$langs->trans("All").' '.$object->nbOfProductRefs().''; print '
'; - print $productstatic->ref; + print $objp->supplier_ref; print ''; + print ''; print dol_trunc(dol_htmlentities($objp->label), 30); print ''.dol_print_date($objp->tms).''.dol_print_date($objp->tms, 'day').''; + //print (isset($objp->unitprice) ? price($objp->unitprice) : ''); + if (isset($objp->price)) + { + print price($objp->price); + if ($objp->quantity > 1) + { + print ' / '; + print $objp->quantity; + } + } + print '