From 646ad48bd068d7070b809ac84729ce0d9ed579f6 Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas <maxime@atm-consulting.fr>
Date: Tue, 21 Jul 2015 10:50:07 +0200
Subject: [PATCH] Better fix for not numeric qty or discount

---
 htdocs/comm/propal/class/propal.class.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 60cbaa6ae0d..1a800dbf944 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -2876,11 +2876,12 @@ class PropaleLigne  extends CommonObject
         if (empty($this->total_localtax2)) $this->total_localtax2=0;
         if (empty($this->rang)) $this->rang=0;
         if (empty($this->remise)) $this->remise=0;
-        if (empty($this->remise_percent)) $this->remise_percent=0;
+        if (empty($this->remise_percent) || ! is_numeric($this->remise_percent)) $this->remise_percent=0;
         if (empty($this->info_bits)) $this->info_bits=0;
         if (empty($this->special_code)) $this->special_code=0;
         if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
         if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
+		if (! is_numeric($this->qty)) $this->qty = 0;
 
         if (empty($this->pa_ht)) $this->pa_ht=0;
 
@@ -2910,14 +2911,14 @@ class PropaleLigne  extends CommonObject
         $sql.= " ".($this->fk_product?"'".$this->fk_product."'":"null").",";
         $sql.= " '".$this->product_type."',";
         $sql.= " ".($this->fk_remise_except?"'".$this->fk_remise_except."'":"null").",";
-        $sql.= " '".price2num($this->qty)."',";
+        $sql.= " ".price2num($this->qty).",";
         $sql.= " ".price2num($this->tva_tx).",";
         $sql.= " ".price2num($this->localtax1_tx).",";
         $sql.= " ".price2num($this->localtax2_tx).",";
 		$sql.= " '".$this->localtax1_type."',";
 		$sql.= " '".$this->localtax2_type."',";
         $sql.= " ".($this->subprice?price2num($this->subprice):"null").",";
-        $sql.= " '".price2num($this->remise_percent)."',";
+        $sql.= " ".price2num($this->remise_percent).",";
         $sql.= " ".(isset($this->info_bits)?"'".$this->info_bits."'":"null").",";
         $sql.= " ".price2num($this->total_ht).",";
         $sql.= " ".price2num($this->total_tva).",";
-- 
GitLab