From b9893bde1d1c85af11d9dd9cfd6e251cdf8ad7c6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 19 Jun 2018 18:26:37 +0200 Subject: [PATCH] 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;