[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 07/19: http_input replace empty by a value
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 07/19: http_input replace empty by a value |
Date: |
Thu, 12 Dec 2019 15:49:05 -0500 (EST) |
sparkyx pushed a commit to tag rel7200
in repository noalyss.
commit 758544af0882eae657288e8c4d1f311f118f2aa9
Author: Dany De Bontridder <address@hidden>
Date: Wed Dec 4 19:43:16 2019 +0100
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 9c3a5ef..0c47011 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 68d9648..fab33d2 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);
- [Noalyss-commit] [noalyss] tag rel7200 created (now e52d76a), Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 01/19: Fix cosmetic + export histo CSV with operation filter, Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 04/19: Merge branch 'dev-7200', Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 02/19: Merge branch 'dev-7200', Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 05/19: Remove direct access to $http, Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 08/19: Merge branch 'dev-7200', Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 07/19: http_input replace empty by a value,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 03/19: Documentation + bug cosmetic about TVA_SIDED : total operation shown instead of total_invoice (VAT REVERSED), Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 10/19: Merge branch 'dev-7200', Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 11/19: Bug #1783 : les nombres commençant par zéro ne sont pas supportés, Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 06/19: export historic card csv : column wrong, Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 12/19: Merge branch 'dev-7200', Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 09/19: zero is considered as empty value, Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 16/19: Merge branch 'dev-7200', Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 17/19: Test : correct test for Acc_Ledger_Factory : payment status, Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 18/19: http_input , trim on array is invalid, Dany De Bontridder, 2019/12/12
- [Noalyss-commit] [noalyss] 15/19: Bug in reconcile for bank amount: total_invoice is null for FIN and ODS, Dany De Bontridder, 2019/12/12