31 "name"=>
"f_name",
"start_date"=>
"f_start_date",
"end_date"=>
"f_end_date"
51 throw new Exception(
"Attribut inexistant $p_string");
61 throw new Exception(
"Attribut inexistant $p_string");
72 if (
noalyss_strlentrim($this->f_name)==0)
throw new Exception(_(
'Le nom ne peut pas ĂȘtre vide'));
87 if ( $this->
verify() != 0 )
return;
88 $sql=
"insert into forecast (f_name,f_start_date,f_end_date) ".
89 " values ($1,$2,$3) returning f_id";
92 array($this->f_name,$this->f_start_date,$this->f_end_date)
102 if ( $this->
verify() != 0 )
return;
104 $sql=
"update forecast set f_name=$1,f_start_date=$2,f_end_date=$3 ".
108 array($this->f_name,$this->f_start_date,$this->f_end_date, $this->f_id)
119 $sql=
"select f_id, f_name,f_start_date,f_end_date from forecast order by 2 desc";
129 $sql=
"select f_id, f_name,f_start_date ,f_end_date from forecast where f_id=$1";
137 foreach ( $a_index as
$idx)
143 public function delete()
145 $sql=
"delete from forecast where f_id=$1";
146 $res=$this->
cn->exec_sql(
$sql,array($this->f_id));
152 $sql=
"insert into forecast(f_name,f_start_date,f_end_date) select 'clone '||f_name,f_start_date,f_end_date from forecast where f_id=$1 returning f_id";
153 $new=$this->
cn->get_value(
$sql,array($this->f_id));
156 $sql=
"insert into forecast_cat(fc_desc,f_id,fc_order) select fc_desc,$1,fc_order from forecast_cat where f_id=$2 returning fc_id" ;
157 $array=$this->
cn->get_array(
$sql,array($new,$this->f_id));
159 $old=$this->
cn->get_array(
"select fc_id from forecast_cat where f_id=$1",array($this->f_id));
163 $this->
cn->exec_sql(
"insert into forecast_item (fi_text,fi_account,fi_order,fc_id,fi_amount,fi_pid) ".
164 " select fi_text,fi_account,fi_order,$1,fi_amount,fi_pid ".
165 " from forecast_item where fc_id=$2",array(
$array[
$i][
'fc_id'],
$old[
$i][
'fc_id']));
noalyss_strlentrim($p_string)
static fetch_result($ret, $p_row=0, $p_col=0)
wrapper for the function pg_fetch_all
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
manage the table forecast
__construct($p_init, $p_id=0)
constructor
update()
update the forecast table
static load_all($p_cn)
load all the existing forecast
set_parameter($p_string, $p_value)