From 2c0eeaf8dedf15f7a84c4dbbc272d68c307130ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jan 2018 20:57:51 +0100 Subject: [PATCH 1/2] FIX #8093 --- .../fourn/class/fournisseur.product.class.php | 9 ++++-- htdocs/product/fournisseurs.php | 29 +++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 17f8b2615ee..d34441ffd75 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -468,9 +468,11 @@ class ProductFournisseur extends Product * @param int $prodid Id of product * @param string $sortfield Sort field * @param string $sortorder Sort order + * @param int $limit Limit + * @param int $offset Offset * @return array Array of Products with new properties to define supplier price */ - function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='') + function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='', $limit=0, $offset=0) { global $conf; @@ -484,7 +486,8 @@ class ProductFournisseur extends Product $sql.= " AND s.status=1"; // only enabled company selected $sql.= " AND pfp.fk_product = ".$prodid; if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price"; - else $sql.= $this->db->order($sortfield,$sortorder); + else $sql.= $this->db->order($sortfield, $sortorder); + $sql.=$this->db->plimit($limit, $offset); dol_syslog(get_class($this)."::list_product_fournisseur_price", LOG_DEBUG); $resql = $this->db->query($sql); @@ -516,7 +519,7 @@ class ProductFournisseur extends Product $prodfourn->id = $prodid; $prodfourn->fourn_tva_npr = $record["info_bits"]; $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; - $prodfourn->supplier_reputation = $record["supplier_reputation"]; + $prodfourn->supplier_reputation = $record["supplier_reputation"]; if (!empty($conf->dynamicprices->enabled) && !empty($prodfourn->fk_supplier_price_expression)) { $priceparser = new PriceParser($this->db); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index cb295012795..2c49319fc19 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -65,6 +65,17 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service&fournisseur',$fieldvalue,'product&product','','',$fieldtype); +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = (GETPOST("page",'int')?GETPOST("page", 'int'):0); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield="s.nom"; +if (! $sortorder) $sortorder="ASC"; + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('pricesuppliercard','globalcard')); @@ -589,13 +600,21 @@ if ($id > 0 || $ref) print "\n\n"; print '
'; - if ($user->rights->fournisseur->lire) { + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + $param.='&ref='.urlencode($object->ref); + $product_fourn = new ProductFournisseur($db); - $product_fourn_list = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder); - $nbtotalofrecords = count($product_fourn_list); - print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($product_fourn_list), $nbtotalofrecords, 'title_accountancy.png'); + $product_fourn_list = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder, $limit, $offset); + $product_fourn_list_all = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder, 0, 0); + $nbtotalofrecords = count($product_fourn_list_all); + $num = count($product_fourn_list); + if (($num + ($offset * $limit)) < $nbtotalofrecords) $num++; + + print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVEUR ['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit, 1); // Suppliers list title print '
'; @@ -606,7 +625,7 @@ if ($id > 0 || $ref) $param="&id=".$object->id; print ''; print_liste_field_titre("Suppliers",$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - print_liste_field_titre("SupplierRef"); + print_liste_field_titre("SupplierRef",$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder); if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre("Availability",$_SERVER["PHP_SELF"],"pfp.fk_availability","",$param,"",$sortfield,$sortorder); print_liste_field_titre("QtyMin",$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("VATRate",$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); From d3c0414b4f8f7c4b5cf0ce9979289464f3ea7bca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jan 2018 01:16:36 +0100 Subject: [PATCH 2/2] Update changelog --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index a5fe90d2bbd..e6d061a58ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ FIX: #7379: Compatibility with PRODUCT_USE_OLD_PATH_FOR_PHOTO variable FIX: #7903 FIX: #7933 FIX: #8029 Unable to make leave request in holyday module +FIX: #8093 +FIX: Bad name alias showing in name of third column +FIX: Cashdesk should not sell to inactive third parties FIX: Edit accountancy account and warning message on loan FIX: $accounts[$bid] is a label ! FIX: $oldvatrateclean & $newvatrateclean must be set if preg_match === false @@ -16,6 +19,10 @@ FIX: product best price on product list FIX: search on contact list FIX: stats trad for customerinvoice FIX: translate unactivate on contractline +FIX: email sent was not in HTML +FIX: missing hook invoice index +FIX: subject mail sepa + ***** ChangeLog for 6.0.4 compared to 6.0.3 ***** FIX: #7737