diff --git a/include/class_poste_analytic.php b/include/class_poste_analytic.php index 1d9d438b6..cde7129cb 100644 --- a/include/class_poste_analytic.php +++ b/include/class_poste_analytic.php @@ -43,6 +43,7 @@ class Poste_analytique { $this->db=$p_db; $this->id=$p_id; + $this->ga_id=null; } /*! \brief retrieve data from the database and * fill the object @@ -96,6 +97,10 @@ class Poste_analytique $this->format_data(); if ( strlen($this->name) == 0) return; + if ( $this->ga_id == null || strlen(trim($this->ga_id)) == 0 ) + $ga_id="NULL"; + else + $ga_id="'".$this->ga_id."'"; $sql="insert into poste_analytique ( po_name , pa_id, @@ -107,7 +112,7 @@ class Poste_analytique $this->pa_id.",". $this->amount.",". "'".$this->description."',". - "'".$this->ga_id."')"; + $ga_id.")"; try { ExecSql($this->db,$sql); @@ -190,7 +195,7 @@ class Poste_analytique function display_list() { $array=$this->get_list(); - + if ( empty($array) ) { echo "Vide"; return;} foreach ($array as $line) { echo $line->id." / ".$line->name." / ".$line->description."/". @@ -267,5 +272,45 @@ class Poste_analytique $this->id=$_POST['po_id']; $this->ga_id=($_POST['ga_id'] == "-1" )?"":$_POST['ga_id']; } + static function testme() { + $cn=DbConnect(dossier::id()); + $o=new Poste_Analytique($cn); + echo "