noalyss
Version-6.7.2
|
manage the table forecast More...
Public Member Functions | |
__construct ($p_init, $p_id=0) | |
constructor | |
delete () | |
get_info () | |
get_parameter ($p_string) | |
insert () | |
load () | |
object_clone () | |
save () | |
set_parameter ($p_string, $p_value) | |
update () | |
update the forecast table | |
verify () | |
Static Public Member Functions | |
static | load_all ($p_cn) |
load all the existing forecast | |
static | test_me () |
unit test | |
Private Attributes | |
$cn | |
Static Private Attributes | |
static | $variable = array ("id"=>"f_id","name"=>"f_name","start_date"=>"f_start_date","end_date"=>"f_end_date") |
manage the table forecast
Definition at line 28 of file class_forecast.php.
Forecast::__construct | ( | $ | p_init, |
$ | p_id = 0 |
||
) |
constructor
$p_init | Database object |
Definition at line 36 of file class_forecast.php.
References cn.
{ $this->cn=$p_init; $this->f_id=$p_id; }
Forecast::delete | ( | ) |
Definition at line 61 of file class_forecast.php.
{ return var_export(self::$variable,true); }
Forecast::get_parameter | ( | $ | p_string | ) |
Forecast::insert | ( | ) |
Definition at line 83 of file class_forecast.php.
References $res, $sql, cn, Database\fetch_result(), and verify().
Referenced by save().
Forecast::load | ( | ) |
Definition at line 121 of file class_forecast.php.
References $idx, $res, $row, $sql, $value, cn, Database\fetch_array(), and Database\num_row().
Referenced by object_clone().
static Forecast::load_all | ( | $ | p_cn | ) | [static] |
Definition at line 141 of file class_forecast.php.
References $array, $new, $old, $sql, cn, and load().
{ $this->load(); /* save into the table forecast */ $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"; $new=$this->cn->get_value($sql,array($this->f_id)); /* save into forecast_cat */ $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" ; $array=$this->cn->get_array($sql,array($new,$this->f_id)); $old=$this->cn->get_array("select fc_id from forecast_cat where f_id=$1",array($this->f_id)); /* save into forecast_item */ for ($i=0;$i<count($array);$i++) { $this->cn->exec_sql("insert into forecast_item (fi_text,fi_account,fi_card,fi_order,fc_id,fi_amount,fi_debit,fi_pid) ". " select fi_text,fi_account,fi_card,fi_order,$1,fi_amount,fi_debit,fi_pid ". " from forecast_item where fc_id=$2",array($array[$i]['fc_id'],$old[$i]['fc_id'])); } }
Forecast::save | ( | ) |
Definition at line 74 of file class_forecast.php.
References get_parameter(), insert(), and update().
{ /* please adapt */ if ( $this->get_parameter("id") == 0 ) $this->insert(); else $this->update(); }
Forecast::set_parameter | ( | $ | p_string, |
$ | p_value | ||
) |
static Forecast::test_me | ( | ) | [static] |
Forecast::update | ( | ) |
Forecast::verify | ( | ) |
Definition at line 66 of file class_forecast.php.
References trim().
Referenced by insert(), and update().
{ // Verify that the elt we want to add is correct // the f_name must be unique (case insensitive) if ( strlen(trim($this->f_name))==0) throw new Exception(_('Le nom ne peut pas ĂȘtre vide')); return 0; }
Forecast::$cn [private] |
Definition at line 31 of file class_forecast.php.
Forecast::$variable = array ("id"=>"f_id","name"=>"f_name","start_date"=>"f_start_date","end_date"=>"f_end_date") [static, private] |
Definition at line 30 of file class_forecast.php.