Merge branch 'dev-7200'

This commit is contained in:
Dany De Bontridder 2019-12-04 19:47:08 +01:00
commit af2a64ed93
4 changed files with 44 additions and 2 deletions

View file

@ -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(

View file

@ -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']);

View file

@ -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;

View file

@ -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);