From f413579d911bda3fa8aae06e14376759be488116 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 20 Nov 2019 20:37:02 +0100 Subject: [PATCH 1/3] Bug PHP : confuse NULL and 0 --- include/lib/inum.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lib/inum.class.php b/include/lib/inum.class.php index f2755c499..6cc9f4e1c 100644 --- a/include/lib/inum.class.php +++ b/include/lib/inum.class.php @@ -82,7 +82,7 @@ class INum extends IText $this->javascript='onchange="format_number(this,'.$this->prec.');"'; } $this->name=($p_name==null)?$this->name:$p_name; - $this->value=($p_value==null)?$this->value:$p_value; + $this->value=($p_value===null)?$this->value:$p_value; $this->id=($this->id=="")?$this->name:$this->id; if ($this->readOnly==true) From 7c9ec073806dbff558fac2bbe6ae062b94e0e0f3 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 20 Nov 2019 20:45:33 +0100 Subject: [PATCH 2/3] Bug Array to string conversion error --- include/class/acc_ledger_sold.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class/acc_ledger_sold.class.php b/include/class/acc_ledger_sold.class.php index d67b10bd8..436b70c96 100644 --- a/include/class/acc_ledger_sold.class.php +++ b/include/class/acc_ledger_sold.class.php @@ -609,7 +609,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { 'Erreur dans l\'enregistrement ' . __FILE__ . ':' . __LINE__ . ' ' . $e->getMessage(); - echo $e->getTrace(); + echo $e->getTraceAsString(); $this->db->rollback(); throw new Exception ($e); From 13d052a5c692b8a7a2fd5c6cae1384974b7ce6cb Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 20 Nov 2019 20:56:28 +0100 Subject: [PATCH 3/3] Bug : when e_march is null it is considered as an empty string instead of 0 --- include/class/acc_ledger_purchase.class.php | 4 ++++ include/class/acc_ledger_sold.class.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 6d9c5c62e..a3e74c015 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -669,6 +669,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger } // insert into quant_purchase //----- + if (empty( ${'e_march' . $i . '_price'} ) ) ${'e_march' . $i . '_price'} = 0; + if (empty( ${'e_march' . $i } ) ) ${'e_march' . $i } = 0; + if (empty( ${'e_quant' . $i } ) ) ${'e_quant' . $i } = 0; + if ( $g_parameter->MY_TVA_USE=='Y') { diff --git a/include/class/acc_ledger_sold.class.php b/include/class/acc_ledger_sold.class.php index 436b70c96..da6991cc4 100644 --- a/include/class/acc_ledger_sold.class.php +++ b/include/class/acc_ledger_sold.class.php @@ -374,6 +374,9 @@ class Acc_Ledger_Sold extends Acc_Ledger { $op->oa_description = sql_string($e_comm); $op->save_form_plan($_POST, $i, $j_id); } + if (empty( ${'e_march' . $i . '_price'} ) ) ${'e_march' . $i . '_price'} = 0; + if (empty( ${'e_march' . $i } ) ) ${'e_march' . $i } = 0; + if (empty( ${'e_quant' . $i } ) ) ${'e_quant' . $i } = 0; if ($g_parameter->MY_TVA_USE == 'Y') { /* save into quant_sold */ $r = $this->db->exec_sql("select insert_quant_sold ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", array(null, /* 1 */