From b9893bde1d1c85af11d9dd9cfd6e251cdf8ad7c6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 19 Jun 2018 18:26:37 +0200 Subject: [PATCH 1/4] Fix: avoid Warning: A non-numeric value encountered --- htdocs/product/composition/card.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 2167f15a7e5..7656cdd8f72 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Raphaël Doursenaud @@ -369,18 +369,23 @@ if ($id > 0 || ! empty($ref)) } print ''; - $totalline=price2num($value['nb'] * ($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise), 'MT'); + // For avoid a non-numeric value + $fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0); + $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); + $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); + + $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); $total+=$totalline; print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency)); + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice,'','',0,0,-1,$conf->currency)); print ''; // Best selling price $pricesell=$productstatic->price; if (! empty($conf->global->PRODUIT_MULTIPRICES)) { - $pricesell='Variable'; + //$pricesell='Variable'; FIXME A non-numeric value encountered } $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); $totalsell+=$totallinesell; From 2c927dba013e469ffd753442ba51401b000d25c4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 19 Jun 2018 18:33:22 +0200 Subject: [PATCH 2/4] Fix: wrong var name "shownav" --- htdocs/product/traduction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index e8900d51bb4..c96e1c0f025 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2010-2012 Destailleur Laurent * Copyright (C) 2014 Henry Florian @@ -205,7 +205,7 @@ $linkback = 'liste_limit; +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page ; // Load sale and categ filters diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 7b82408cfc0..b4d14ef1231 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Ferran Marcet @@ -61,6 +61,7 @@ $page = GETPOST("page",'int'); if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page ; // Load sale and categ filters From 6f1101a2d60f80d5dce685ef284aea5e0998ab5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 15:51:26 +0200 Subject: [PATCH 4/4] Update card.php --- htdocs/product/composition/card.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 7656cdd8f72..70f14f9edf5 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -342,6 +342,7 @@ if ($id > 0 || ! empty($ref)) $class='pair'; + $totalsell=0; if (count($prods_arbo)) { foreach($prods_arbo as $value) @@ -374,7 +375,7 @@ if ($id > 0 || ! empty($ref)) $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); $total+=$totalline; print ''; @@ -385,12 +386,17 @@ if ($id > 0 || ! empty($ref)) $pricesell=$productstatic->price; if (! empty($conf->global->PRODUIT_MULTIPRICES)) { - //$pricesell='Variable'; FIXME A non-numeric value encountered + $pricesell='Variable'; + } + else + { + $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); + $totalsell+=$totallinesell; } - $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); - $totalsell+=$totallinesell; print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($pricesell,'','',0,0,-1,$conf->currency)); + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : ''); + if (is_numeric($pricesell)) print price($pricesell,'','',0,0,-1,$conf->currency)); + else print $langs->trans($pricesell); print ''; // Stock