26 require_once NOALYSS_INCLUDE.
'/lib/class_iselect.php';
27 require_once NOALYSS_INCLUDE.
'/lib/class_database.php';
28 require_once NOALYSS_INCLUDE.
'/class/class_dossier.php';
33 static private $variable = array(
"value"=>
'pcm_val',
35 'parent'=>
'pcm_val_parent',
36 'libelle'=>
'pcm_lib');
42 array(
'label'=>
'Actif',
'value'=>
'ACT'),
43 array(
'label'=>
'Passif',
'value'=>
'PAS'),
44 array(
'label'=>
'Actif c. inverse',
'value'=>
'ACTINV'),
45 array(
'label'=>
'Passif c.inverse',
'value'=>
'PASINV'),
46 array(
'label'=>
'Produit',
'value'=>
'PRO'),
47 array(
'label'=>
'Produit Inverse',
'value'=>
'PROINV'),
48 array(
'label'=>
'Charge',
'value'=>
'CHA'),
49 array(
'label'=>
'Charge Inverse',
'value'=>
'CHAINV'),
50 array(
'label'=>
'Non defini',
'value'=>
'CON')
60 if ( array_key_exists($p_string,self::$variable) )
62 $idx=self::$variable[$p_string];
66 throw new Exception (__FILE__.
":".__LINE__._(
'Erreur attribut inexistant'));
71 if ( array_key_exists($p_string,self::$variable) )
73 $idx=self::$variable[$p_string];
74 if ($this->
check(
$idx,$p_value) ==
true ) $this->
$idx=$p_value;
77 throw new Exception (__FILE__.
":".__LINE__._(
'Erreur attribut inexistant'));
88 "select pcm_lib from tmp_pcmn where
89 pcm_val=$1",array($this->pcm_val));
93 $this->pcm_lib=
$r[
'pcm_lib'];
97 $this->pcm_lib=_(
"Poste inconnu");
104 function check ($p_member=
'',$p_value=
'')
107 if ($p_member ==
'' && $p_value==
'' )
109 foreach (self::$variable as
$l=>$k)
111 $this->
check($k,$this->$k);
117 if ( strcmp ($p_member,
'pcm_val') == 0 )
121 else if ( strcmp ($p_member,
'pcm_val_parent') == 0 )
125 else if ( strcmp ($p_member,
'pcm_lib') == 0 )
129 else if ( strcmp ($p_member,
'pcm_type') == 0 )
133 if ( strcmp ($k[
'value'],$p_value) == 0 )
return true;
136 throw new Exception(_(
'type de compte incorrect ').$p_value);
138 throw new Exception (_(
'Donnee member inconnue ').$p_member);
148 $ret=$this->
db->exec_sql(
"select pcm_lib,pcm_val_parent,pcm_type from
149 tmp_pcmn where pcm_val=$1",array($this->pcm_val));
152 if ( !
$r )
return false;
153 $this->pcm_lib=
$r[0][
'pcm_lib'];
154 $this->pcm_val_parent=
$r[0][
'pcm_val_parent'];
155 $this->pcm_type=
$r[0][
'pcm_type'];
162 $wType->name=
'p_type';
169 <INPUT TYPE="TEXT" NAME="p_val" SIZE=7>
172 <INPUT TYPE="TEXT" NAME="p_lib" size=50>
175 <INPUT TYPE="TEXT" NAME="p_parent" size=5>
179 $ret.=$wType->input().
'</TD>';
185 $ret.=sprintf (
'<TD>'._(
'Numéro de classe').
' </TD><TD><INPUT TYPE="TEXT" name="p_val" value="%s"></TD>',$this->pcm_val);
187 $ret.=sprintf(
'<TD>'._(
'Libellé').
' </TD><TD><INPUT TYPE="TEXT" size="70" NAME="p_lib" value="%s"></TD>',
h($this->pcm_lib));
189 $ret.=sprintf (
'<TD>'._(
'Classe Parent').
'</TD><TD><INPUT TYPE="TEXT" name="p_parent" value="%s"></TD>',$this->pcm_val_parent);
192 $ret.=
"<td> Type de poste </td>";
193 $ret.=
'<td>'.$wType->input().
'</td>';
194 $ret.=
"</TR> </TABLE>";
195 $ret.=dossier::hidden();
202 $sql=
"select count(*) from tmp_pcmn where pcm_val=$1";
203 return $this->
db->get_value(
$sql,array($p_value));
215 if (strcmp(
trim($p_old),
trim($this->pcm_val)) !=0 )
217 $count=$this->
db->get_value(
'select count(*) from jrnx where j_poste=$1',
221 throw new Exception(_(
'Impossible de changer la valeur: poste déjà utilisé'));
223 $this->pcm_lib=mb_substr($this->pcm_lib,0,150);
225 $sql=
"update tmp_pcmn set pcm_val=$1, pcm_lib=$2,pcm_val_parent=$3,pcm_type=$4 where pcm_val=$5";
226 $Ret=$this->
db->exec_sql(
$sql,array($this->pcm_val,
228 $this->pcm_val_parent,
__construct($p_cn, $p_id=0)
static fetch_all($ret)
wrapper for the function pg_fetch_all
load()
Get all the value for this object from the database the data member are set.
set_parameter($p_string, $p_value)
static num_row($ret)
wrapper for the function pg_NumRows
Manage the account from the table tmp_pcmn.
get_lib()
Return the name of a account it doesn't change any data member.
static fetch_array($ret, $p_indice=0)
wrapper for the function pg_fetch_array
update($p_old)
update an accounting, but you can update pcm_val only if this accounting has never been used before ...
function trim(s)
remove trailing and heading space
h($p_string)
to protect again bad characters which can lead to a cross scripting attack the string to be diplayed ...
static test_me()
for developper only during test
check($p_member='', $p_value='')
Check that the value are valid.