noalyss
Version-6.7.2
|
Manage the account from the table tmp_pcmn. More...
Public Member Functions | |
__construct ($p_cn, $p_id=0) | |
check ($p_member='', $p_value='') | |
Check that the value are valid. | |
count ($p_value) | |
form ($p_table=true) | |
get_lib () | |
Return the name of a account it doesn't change any data member. | |
get_parameter ($p_string) | |
load () | |
Get all the value for this object from the database the data member are set. | |
set_parameter ($p_string, $p_value) | |
update ($p_old) | |
update an accounting, but you can update pcm_val only if this accounting has never been used before | |
Static Public Member Functions | |
static | test_me () |
for developper only during test | |
Data Fields | |
$db | |
Static Public Attributes | |
static | $type |
Private Attributes | |
$pcm_lib | |
$pcm_parent | |
$pcm_type | |
$pcm_val | |
Static Private Attributes | |
static | $variable |
Manage the account from the table tmp_pcmn.
Definition at line 30 of file class_acc_account.php.
Acc_Account::__construct | ( | $ | p_cn, |
$ | p_id = 0 |
||
) |
Definition at line 53 of file class_acc_account.php.
References db.
{ $this->db=$p_cn; $this->pcm_val=$p_id; }
Acc_Account::check | ( | $ | p_member = '' , |
$ | p_value = '' |
||
) |
Check that the value are valid.
Definition at line 104 of file class_acc_account.php.
Referenced by set_parameter(), and update().
{ // if there is no argument we check all the member if ($p_member == '' && $p_value== '' ) { foreach (self::$variable as $l=>$k) { $this->check($k,$this->$k); } } else { // otherwise we check only the value if ( strcmp ($p_member,'pcm_val') == 0 ) { return true; } else if ( strcmp ($p_member,'pcm_val_parent') == 0 ) { return true; } else if ( strcmp ($p_member,'pcm_lib') == 0 ) { return true; } else if ( strcmp ($p_member,'pcm_type') == 0 ) { foreach (self::$type as $l=>$k) { if ( strcmp ($k['value'],$p_value) == 0 ) return true; } throw new Exception(_('type de compte incorrect ').$p_value); } throw new Exception (_('Donnee member inconnue ').$p_member); } }
Acc_Account::count | ( | $ | p_value | ) |
Acc_Account::form | ( | $ | p_table = true | ) |
Definition at line 159 of file class_acc_account.php.
References $ret, $type, and h().
{ $wType=new ISelect(); $wType->name='p_type'; $wType->value=self::$type; if ( ! $p_table ) { $ret=' <TR> <TD> <INPUT TYPE="TEXT" NAME="p_val" SIZE=7> </TD> <TD> <INPUT TYPE="TEXT" NAME="p_lib" size=50> </TD> <TD> <INPUT TYPE="TEXT" NAME="p_parent" size=5> </TD> <TD>'; $ret.=$wType->input().'</TD>'; return $ret; } else { $ret='<TABLE><TR>'; $ret.=sprintf ('<TD>'._('Numéro de classe').' </TD><TD><INPUT TYPE="TEXT" name="p_val" value="%s"></TD>',$this->pcm_val); $ret.="</TR><TR>"; $ret.=sprintf('<TD>'._('Libellé').' </TD><TD><INPUT TYPE="TEXT" size="70" NAME="p_lib" value="%s"></TD>',h($this->pcm_lib)); $ret.= "</TR><TR>"; $ret.=sprintf ('<TD>'._('Classe Parent').'</TD><TD><INPUT TYPE="TEXT" name="p_parent" value="%s"></TD>',$this->pcm_val_parent); $ret.='</tr><tr>'; $wType->selected=$this->pcm_type; $ret.="<td> Type de poste </td>"; $ret.= '<td>'.$wType->input().'</td>'; $ret.="</TR> </TABLE>"; $ret.=dossier::hidden(); return $ret; } }
Return the name of a account it doesn't change any data member.
Definition at line 85 of file class_acc_account.php.
References $r, $ret, db, Database\fetch_array(), and Database\num_row().
{ $ret=$this->db->exec_sql( "select pcm_lib from tmp_pcmn where pcm_val=$1",array($this->pcm_val)); if ( Database::num_row($ret) != 0) { $r=Database::fetch_array($ret); $this->pcm_lib=$r['pcm_lib']; } else { $this->pcm_lib=_("Poste inconnu"); } return $this->pcm_lib; }
Acc_Account::get_parameter | ( | $ | p_string | ) |
Get all the value for this object from the database the data member are set.
Definition at line 146 of file class_acc_account.php.
References $r, $ret, db, and Database\fetch_all().
{ $ret=$this->db->exec_sql("select pcm_lib,pcm_val_parent,pcm_type from tmp_pcmn where pcm_val=$1",array($this->pcm_val)); $r=Database::fetch_all($ret); if ( ! $r ) return false; $this->pcm_lib=$r[0]['pcm_lib']; $this->pcm_val_parent=$r[0]['pcm_val_parent']; $this->pcm_type=$r[0]['pcm_type']; return true; }
Acc_Account::set_parameter | ( | $ | p_string, |
$ | p_value | ||
) |
Definition at line 69 of file class_acc_account.php.
static Acc_Account::test_me | ( | ) | [static] |
for developper only during test
Definition at line 206 of file class_acc_account.php.
{ $cn=new Database(dossier::id()); }
Acc_Account::update | ( | $ | p_old | ) |
update an accounting, but you can update pcm_val only if this accounting has never been used before
Definition at line 214 of file class_acc_account.php.
References $count, $Ret, $sql, check(), db, and trim().
{ if (strcmp(trim($p_old), trim($this->pcm_val)) !=0 ) { $count=$this->db->get_value('select count(*) from jrnx where j_poste=$1', array($p_old) ); if ($count != 0) throw new Exception(_('Impossible de changer la valeur: poste déjà utilisé')); } $this->pcm_lib=mb_substr($this->pcm_lib,0,150); $this->check(); $sql="update tmp_pcmn set pcm_val=$1, pcm_lib=$2,pcm_val_parent=$3,pcm_type=$4 where pcm_val=$5"; $Ret=$this->db->exec_sql($sql,array($this->pcm_val, $this->pcm_lib, $this->pcm_val_parent, $this->pcm_type, $p_old)); }
Acc_Account::$db |
$db database connection
Definition at line 32 of file class_acc_account.php.
Acc_Account::$pcm_lib [private] |
Definition at line 40 of file class_acc_account.php.
Acc_Account::$pcm_parent [private] |
Definition at line 39 of file class_acc_account.php.
Acc_Account::$pcm_type [private] |
Definition at line 38 of file class_acc_account.php.
Acc_Account::$pcm_val [private] |
Definition at line 37 of file class_acc_account.php.
Acc_Account::$type [static] |
array( array('label'=>'Actif','value'=>'ACT'), array('label'=>'Passif','value'=>'PAS'), array('label'=>'Actif c. inverse','value'=>'ACTINV'), array('label'=>'Passif c.inverse','value'=>'PASINV'), array('label'=>'Produit','value'=>'PRO'), array('label'=>'Produit Inverse','value'=>'PROINV'), array('label'=>'Charge','value'=>'CHA'), array('label'=>'Charge Inverse','value'=>'CHAINV'), array('label'=>'Non defini','value'=>'CON') )
Definition at line 41 of file class_acc_account.php.
Referenced by form().
Acc_Account::$variable [static, private] |
array("value"=>'pcm_val', 'type'=>'pcm_type', 'parent'=>'pcm_val_parent', 'libelle'=>'pcm_lib')
Definition at line 33 of file class_acc_account.php.