From 63d929cae7110ff78f87230fd1956052b07b8e48 Mon Sep 17 00:00:00 2001 From: Dany Date: Wed, 4 Dec 2019 11:51:22 +0100 Subject: [PATCH 1/3] Remove direct access to $http --- include/export/export_fiche_csv.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/export/export_fiche_csv.php b/include/export/export_fiche_csv.php index d178ab9fc..a03e14635 100644 --- a/include/export/export_fiche_csv.php +++ b/include/export/export_fiche_csv.php @@ -30,6 +30,7 @@ require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php'; $gDossier=dossier::id(); $cn=Dossier::connect(); +$http=new HttpInput(); require_once NOALYSS_INCLUDE.'/class/user.class.php'; @@ -40,7 +41,7 @@ $export->send_header(); if ( isset ($_GET['fd_id'])) { - $fiche_def=new Fiche_Def($cn,$_GET ['fd_id']); + $fiche_def=new Fiche_Def($cn,$http->get('fd_id',"number")); $fiche=new Fiche($cn); $e=$fiche_def->get_by_type(); $o=0; From 577115a78855c5f8d3a5b869b77a04c15659a477 Mon Sep 17 00:00:00 2001 From: Dany Date: Wed, 4 Dec 2019 17:01:59 +0100 Subject: [PATCH 2/3] export historic card csv : column wrong --- include/export/export_fiche_balance_csv.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/export/export_fiche_balance_csv.php b/include/export/export_fiche_balance_csv.php index 6142ea7ca..f2d752027 100644 --- a/include/export/export_fiche_balance_csv.php +++ b/include/export/export_fiche_balance_csv.php @@ -176,11 +176,13 @@ else if ($row['j_debit'] == 't') { $export->add($row['j_montant'],"number"); + $export->add(0,"number"); $amount_deb=bcadd($amount_deb,$row['j_montant']); $prog = bcadd($prog, $row['j_montant']); } else { + $export->add(0,"number"); $export->add($row['j_montant'],"number"); $amount_cred=bcadd($amount_cred,$row['j_montant']); $prog = bcsub($prog, $row['j_montant']); From 758544af0882eae657288e8c4d1f311f118f2aa9 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 4 Dec 2019 19:43:16 +0100 Subject: [PATCH 3/3] http_input replace empty by a value --- include/ajax/ajax_search_operation.php | 1 + include/lib/http_input.class.php | 40 +++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/include/ajax/ajax_search_operation.php b/include/ajax/ajax_search_operation.php index 9c3a5ef6c..0c4701187 100644 --- a/include/ajax/ajax_search_operation.php +++ b/include/ajax/ajax_search_operation.php @@ -42,6 +42,7 @@ $base=basename($_SERVER['SCRIPT_NAME']); $inside=false; $tiers=$http->get("tiers", "string", ""); // With the amount id, we find the amount in a html elt +$http->set_empty(0); if (isset($_GET['amount_id'])) { put_global(array( diff --git a/include/lib/http_input.class.php b/include/lib/http_input.class.php index 68d9648d1..fab33d237 100644 --- a/include/lib/http_input.class.php +++ b/include/lib/http_input.class.php @@ -34,13 +34,36 @@ class HttpInput { private $array; + private $empty; //!< if empty that replace by $empty function _construct() { $this->array=null; + $this->empty=""; + } + public function get_array() + { + return $this->array; } - /** + public function get_empty() + { + return $this->empty; + } + + public function set_array($array) + { + $this->array=$array; + return $this; + } + // $empty replace the empty value + public function set_empty($empty) + { + $this->empty=$empty; + return $this; + } + + /** * Check the type of the value * @param $p_name name of the variable * @param $p_type type of the variable (number,string,date,array) @@ -53,10 +76,17 @@ class HttpInput { // no check on string if ($p_type=="string") + { return; + } // Check if number else if ($p_type=="number") { + if (empty($this->array[$p_name])) + { + $this->array[$p_name]=$this->empty; + } + if ( isNumber($this->array[$p_name])==0 ) { throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}" @@ -67,6 +97,10 @@ class HttpInput // Check if date dd.mm.yyyy else if ($p_type=="date") { + if (empty($this->array[$p_name])) + { + $this->array[$p_name]=$this->empty; + } if (isDate($this->array[$p_name]) <> $this->array[$p_name]) { throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}" @@ -76,6 +110,10 @@ class HttpInput } else if ($p_type=="array") { + if (empty($this->array[$p_name])) + { + $this->array[$p_name]=$this->empty; + } if (!is_array($this->array[$p_name]) ) { throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}" , EXC_PARAM_TYPE);