db=$p_cn; $this->pcm_val=$p_id; } /*!\brief Return the name of a account * it doesn't change any data member * \return string with the pcm_lib */ function get_lib() { $ret=pg_exec($this->db, "select pcm_lib from tmp_pcmn where pcm_val=".$this->id); if ( pg_NumRows($ret) != 0) { $r=pg_fetch_array($ret); $this->name=$r['pcm_lib']; } else { $this->name="Poste inconnu"; } return $this->name; } /*!\brief Get all the value for this object from the database * the data member are set * \return false if this account doesn't exist otherwise true */ function load() { $ret=ExecSql($this->db,"select pcm_lib,pcm_val_parent,pcm_type from tmp_pcmn where pcm_val=".$this->id); $r=pg_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; } function form($p_table=true){ $array=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'=>'Charge','value'=>'CHA'), array('label'=>'Non defini','value'=>'CON') ); $wType=new widget("select"); $wType->name='p_type'; $wType->value=$array; if ( ! $p_table ) { $ret=' '; $ret.=$wType->IOValue().''; return $ret; } else { $ret=''; $ret.=sprintf ('',$this->pcm_val); $ret.=""; $ret.=sprintf('',urldecode($this->pcm_lib)); $ret.= ""; $ret.=sprintf ('',$this->pcm_val_parent); $ret.=''; $wType->selected=$this->pcm_type; $ret.=""; $ret.= ''; $ret.="
Numéro de classe
Libellé
Classe Parent
Type de poste '.$wType->IOValue().'
"; $ret.=dossier::hidden(); return $ret; } } /*!\brief for developper only during test */ static function test_me() { $cn=DbConnect(dossier::id()); } }