29 require_once NOALYSS_INCLUDE.
'/lib/class_database.php';
30 require_once NOALYSS_INCLUDE.
'/lib/ac_common.php';
40 protected $variable=array(
"id"=>
"id",
"format_name"=>
"format_name"
41 ,
"jrn_def_id"=>
"jrn_def_id"
43 ,
"pos_amount"=>
"pos_amount"
44 ,
"pos_date"=>
"pos_date"
45 ,
"pos_operation_nb"=>
"pos_operation_nb"
46 ,
"pos_third"=>
"pos_third"
47 ,
"pos_extra"=>
"pos_extra"
48 ,
"sep_decimal"=>
"sep_decimal"
49 ,
"sep_thousand"=>
"sep_thousand"
50 ,
"sep_field"=>
"sep_field"
51 ,
"format_date"=>
"format_date"
63 foreach ($this->variable as
$key=>$value) $this->$value=NULL;
75 if ( array_key_exists($p_string,$this->variable) )
77 $idx=$this->variable[$p_string];
81 throw new Exception (__FILE__.
":".__LINE__.$p_string.
'Erreur attribut inexistant');
85 if ( array_key_exists($p_string,$this->variable) )
87 $idx=$this->variable[$p_string];
91 throw new Exception (__FILE__.
":".__LINE__.$p_string.
'Erreur attribut inexistant');
95 return var_export($this,
true);
101 if ( $this->jrn_def_id !==null && settype($this->jrn_def_id,
'float') ==
false )
102 throw new Exception(
'DATATYPE jrn_def_id $this->jrn_def_id non numerique');
103 if ( $this->pos_lib !== null && settype($this->pos_lib,
'float') ==
false )
104 throw new Exception(
'DATATYPE pos_lib $this->pos_lib non numerique');
105 if ( $this->pos_amount !== null && settype($this->pos_amount,
'float') ==
false )
106 throw new Exception(
'DATATYPE pos_amount $this->pos_amount non numerique');
107 if ( $this->pos_date !== null && settype($this->pos_date,
'float') ==
false )
108 throw new Exception(
'DATATYPE pos_date $this->pos_date non numerique');
109 if ( $this->pos_operation_nb !== null && settype($this->pos_operation_nb,
'float') ==
false )
110 throw new Exception(
'DATATYPE pos_operation_nb $this->pos_operation_nb non numerique');
111 if ($this->nb_col !== null && settype($this->nb_col,
'float') ==
false )
112 throw new Exception(
'DATATYPE nb_col $this->nb_col non numerique');
118 if ( $this->
id == -1 )
131 public function seek($cond=
'',$p_array=null)
133 $sql=
"select * from importbank.format_bank $cond";
135 $ret= $this->cn->exec_sql(
$sql,$p_array);
150 $array=Database::fetch_array($p_ret,$idx);
151 foreach (
$array as $idx=>$value)
161 if ( $this->
verify() != 0 )
return;
162 if ( strlen(trim($this->format_name))==0)
164 $get_id=$this->cn->get_value(
'select id from importbank.format_bank where format_name=$1',array($this->format_name));
165 if ( $this->cn->size() == 1) {
174 $sql=
"insert into importbank.format_bank(format_name
204 $this->
id=$this->cn->get_value(
206 array( $this->format_name
211 ,$this->pos_operation_nb
225 $sql=
"insert into importbank.format_bank(format_name
257 $this->
id=$this->cn->get_value(
259 array( $this->format_name
264 ,$this->pos_operation_nb
283 if ( $this->
verify() != 0 )
return;
285 $sql=
" update importbank.format_bank set format_name = $1
290 ,pos_operation_nb = $6
300 $res=$this->cn->exec_sql(
302 array($this->format_name
307 ,$this->pos_operation_nb
327 $sql=
"select format_name
341 from importbank.format_bank where id=$1";
343 $res=$this->cn->get_array(
348 if ( count(
$res) == 0 )
351 foreach ($this->variable as
$key=>$value) $this->
$key=
'';
355 foreach (
$res[0] as $idx=>$value)
362 public function delete()
364 $sql=
"delete from importbank.format_bank where id=$1";
365 $res=$this->cn->exec_sql(
$sql,array($this->
id));
if(isset($_POST['remove'])) $array