noalyss
Version-6.7.2
|
manage the predefined operation, link to the table op_def and op_def_detail More...
Public Member Functions | |
compute_array () | |
count () | |
count the number of pred operation for a ledger | |
delete () | |
display () | |
display the detail of predefined operation, normally everything is loaded | |
get_list_ledger () | |
get the list of the predef. operation of a ledger | |
get_post () | |
fill the object with the $_POST variable | |
load () | |
load the data from the database and return an array | |
Pre_operation ($cn, $p_id=0) | |
save () | |
save the predef check first is the name is unique | |
set_jrn ($p_jrn) | |
set the ledger | |
show_button () | |
show the button for selecting a predefined operation | |
Static Public Member Functions | |
static | save_propose () |
Propose to save the operation into a predefined operation. | |
Data Fields | |
$db | |
$jrn_type | |
$name | |
$nb_item | |
$p_jrn |
manage the predefined operation, link to the table op_def and op_def_detail
Definition at line 35 of file class_pre_operation.php.
Definition at line 156 of file class_pre_operation.php.
count the number of pred operation for a ledger
Definition at line 187 of file class_pre_operation.php.
Referenced by save().
get the list of the predef. operation of a ledger
Definition at line 198 of file class_pre_operation.php.
References $all, $res, $sql, db, and Database\fetch_all().
fill the object with the $_POST variable
Definition at line 71 of file class_pre_operation.php.
References $_REQUEST, db, name, and trim().
{ $this->nb_item=$_POST['nb_item']; $this->p_jrn=$_REQUEST['p_jrn']; $this->jrn_type=$_POST['jrn_type']; $this->name=$_POST['opd_name']; $this->name=(trim($this->name)=='')?$_POST['e_comm']:$this->name; $this->description= $_POST['od_description']; if ( $this->name=="") { $n=$this->db->get_next_seq('op_def_op_seq'); $this->name=$this->jrn_type.$n; // common value } }
load the data from the database and return an array
Definition at line 128 of file class_pre_operation.php.
References $array, $res, $sql, db, and Database\fetch_all().
Referenced by compute_array().
{ $sql="select od_id,jrn_def_id,od_name,od_item,od_jrn_type,od_description". " from op_predef where od_id=".$this->od_id. " order by od_name"; $res=$this->db->exec_sql($sql); $array=Database::fetch_all($res); foreach (array('jrn_def_id','od_name','od_item','od_jrn_type','od_description') as $field) { $this->$field=$array[0][$field]; } switch ($this->od_jrn_type) { case 'ACH': $this->detail=new Pre_op_ach($this->db); break; case 'VEN': $this->detail=new Pre_Op_ven($this->db); break; case 'ODS': $this->detail=new Pre_op_advanced($this->db); break; default: throw new Exception('Load PreOperatoin failed'.$this->od_jrn_type); } $this->detail->set_od_id($this->od_id); $this->detail->jrn_def_id=$this->jrn_def_id; return $array; }
Pre_operation::Pre_operation | ( | $ | cn, |
$ | p_id = 0 |
||
) |
save the predef check first is the name is unique
Definition at line 96 of file class_pre_operation.php.
References $sql, count(), db, echo, and name.
{ if ( $this->db->count_sql("select * from op_predef ". "where upper(od_name)=upper('".Database::escape_string($this->name)."')". "and jrn_def_id=".$this->p_jrn) != 0 ) { echo "<span class=\"notice\"> Ce modèle d' opération a déjà été sauvé</span>"; return false; } if ( $this->count() > MAX_PREDEFINED_OPERATION ) { echo '<span class="notice">Vous avez atteint le max. d\'opération prédéfinie, désolé</span>'; return false; } $sql='insert into op_predef (jrn_def_id,od_name,od_item,od_jrn_type,od_direct,od_description)'. 'values'. "($1,$2,$3,$4,$5 ,$6 )"; $this->db->exec_sql($sql,array($this->p_jrn, $this->name, $this->nb_item, $this->jrn_type, $this->od_direct, $this->description, )); $this->od_id=$this->db->get_current_seq('op_def_op_seq'); return true; }
static Pre_operation::save_propose | ( | ) | [static] |
Propose to save the operation into a predefined operation.
Definition at line 53 of file class_pre_operation.php.
References $opd_description, and $r.
{ $r="<h2>Modèle d'opération</h2>"; $r.= '<p class="decale">'; $r.= "Donnez un nom pour sauver cette opération comme modèle <br>"; $opd_name = new IText('opd_name'); $r.= "Nom du modèle " . $opd_name->input(); $opd_description=new ITextarea('od_description'); $opd_description->style=' class="itextarea" style="width:30em;height:4em;vertical-align:top"'; $r.='</p>'; $r.= '<p class="decale">'; $r.= 'Description (max 50 car.)'; $r.='<br>'; $r.=$opd_description->input(); $r.='</p>'; return $r; }
Pre_operation::set_jrn | ( | $ | p_jrn | ) |
set the ledger
$p_jrn | is the ledger (jrn_id) |
Definition at line 211 of file class_pre_operation.php.
References $p_jrn.
{ $this->p_jrn=$p_jrn; }
show the button for selecting a predefined operation
Definition at line 171 of file class_pre_operation.php.
Pre_operation::$db |
$db database connection
Definition at line 37 of file class_pre_operation.php.
Pre_operation::$jrn_type |
$jrn_type
Definition at line 40 of file class_pre_operation.php.
Pre_operation::$name |
$name name of the predef. operation
Definition at line 41 of file class_pre_operation.php.
Pre_operation::$nb_item |
$nb_item nb of item
Definition at line 38 of file class_pre_operation.php.
Pre_operation::$p_jrn |