noalyss Version-9
Public Member Functions | Data Fields
Acc_Parm_Code Class Reference

Manage the table parm_code which contains the custom parameter for the module accountancy. More...

+ Collaboration diagram for Acc_Parm_Code:

Public Member Functions

 __construct ($p_cn, $p_id=-1)
 
 display ()
 Display an object, with the tag. More...
 
 form ()
 Display a form to enter info about a parm_code object with the tag. More...
 
 load ()
 
Complete a parm_code object thanks the p_code More...
 
 load_all ()
 
Load all parmCode return an array of Acc_Parm_Code object More...
 
 save ()
 update a parm_object into the database p_code is not updatable More...
 

Data Fields

 $db
 
 $p_code
 
 $p_comment
 
 $p_value
 

Detailed Description

Manage the table parm_code which contains the custom parameter for the module accountancy.

Definition at line 29 of file acc_parm_code.class.php.

Constructor & Destructor Documentation

◆ __construct()

Acc_Parm_Code::__construct (   $p_cn,
  $p_id = -1 
)

Definition at line 36 of file acc_parm_code.class.php.

37 {
38 $this->db=$p_cn;
39 $this->p_code=$p_id;
40 if ( $p_id != -1 )
41 $this->load();
42 }
load()
Complete a parm_code object thanks the p_code
$SecUser db

References $p_id, db, and load().

+ Here is the call graph for this function:

Member Function Documentation

◆ display()

Acc_Parm_Code::display ( )

Display an object, with the tag.

Returns
string

Definition at line 106 of file acc_parm_code.class.php.

107 {
108 $r="";
109 $r.= '<TD>'.$this->p_code.'</TD>';
110 $r.= '<TD>'.h($this->p_comment).'</TD>';
111 $r.= '<TD>'.$this->p_value.'</TD>';
112
113 return $r;
114 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r

References $r.

◆ form()

Acc_Parm_Code::form ( )

Display a form to enter info about a parm_code object with the tag.

Returns
string

Definition at line 122 of file acc_parm_code.class.php.

123 {
124 $comment=new IText();
125 $comment->name='p_comment';
126 $comment->value=$this->p_comment;
127 $comment->size=45;
128 $value=new IPoste();
129 $value->name='p_value';
130 $value->value=$this->p_value;
131 $value->size=7;
132 $value->set_attribute('ipopup','ipop_account');
133 $value->set_attribute('account','p_value');
134 $poste=new IText();
135 $poste->setReadOnly(true);
136 $poste->size=strlen($this->p_code)+1;
137 $poste->name='p_code';
138 $poste->value=$this->p_code;
139 $r="";
140 $r.='<tr>';
141 $r.='<td align="right"> Code </td>';
142 $r.= '<TD>'.$poste->input().'</TD>';
143 $r.='</tr>';
144 $r.='<tr>';
145 $r.='<td align="right"> Commentaire </td>';
146 $r.= '<TD>'.$comment->input().'</TD>';
147 $r.='</tr>';
148 $r.='<tr>';
149 $r.='<td align="right"> Poste comptable </td>';
150 $r.= '<TD>'.$value->input();
151 $r.='<span id="p_value_label"></span></td>';
152 $r.='</tr>';
154 return $r;
155
156 }
static hidden()
return a string to set gDossier into a FORM
show a button, for selecting a account and a input text for manually inserting an account the differe...
Html Input.
Definition: itext.class.php:30

References $p_code, $p_comment, $p_value, $poste, $r, $value, and Dossier\hidden().

+ Here is the call graph for this function:

◆ load()

Acc_Parm_Code::load ( )


Complete a parm_code object thanks the p_code

Returns
array

Definition at line 166 of file acc_parm_code.class.php.

167 {
168 if ( $this->p_code == -1 ) return "p_code non initialisé";
169 $sql='select * from parm_code where p_code=$1 ';
170
171 $Res=$this->db->exec_sql($sql,array($this->p_code));
172
173 if ( Database::num_row($Res) == 0 ) return 'INCONNU';
175 $this->p_value=$row['p_value'];
176 $this->p_comment=$row['p_comment'];
177
178 }
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
$Res

References $Res, $row, $sql, db, DatabaseCore\fetch_array(), and DatabaseCore\num_row().

Referenced by __construct().

+ Here is the call graph for this function:

◆ load_all()

Acc_Parm_Code::load_all ( )


Load all parmCode return an array of Acc_Parm_Code object

Returns
array

Definition at line 52 of file acc_parm_code.class.php.

53 {
54 $sql="select * from parm_code order by p_code";
55 $Res=$this->db->exec_sql($sql);
57 $idx=0;
58 $array=array();
59
60 if ( $r === false ) return null;
61 foreach ($r as $row )
62 {
63 $o=new Acc_Parm_Code($this->db,$row['p_code']);
64 $array[$idx]=$o;
65 $idx++;
66 }
67
68 return $array;
69 }
$idx
Manage the table parm_code which contains the custom parameter for the module accountancy.
static fetch_all($ret)
wrapper for the function pg_fetch_all

References $array, $idx, $r, $Res, $row, $sql, db, and DatabaseCore\fetch_all().

+ Here is the call graph for this function:

◆ save()

Acc_Parm_Code::save ( )

update a parm_object into the database p_code is not updatable

Returns
nothing

Definition at line 77 of file acc_parm_code.class.php.

78 {
79 // if p_code=="" nothing to save
80 if ( $this->p_code== -1) return;
81 // check if the account exists
82 $acc=new Acc_Account_Ledger($this->db,$this->p_value);
83 if ( $acc->load() == false )
84 {
85 alert(_("Ce compte n'existe pas"));
86 }
87 else
88 {
89 $this->p_comment=sql_string($this->p_comment);
90 $this->p_value=sql_string($this->p_value);
91 $this->p_code=sql_string($this->p_code);
92 $sql="update parm_code set ".
93 "p_comment='".$this->p_comment."' ".
94 ",p_value='".$this->p_value."' ".
95 "where p_code='".$this->p_code."'";
96 $Res=$this->db->exec_sql($sql);
97 }
98 }
sql_string($p_string)
Fix the problem with the quote char for the database.
Definition: ac_common.php:511
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
Manage the account from the table jrn, jrnx or tmp_pcmn.

References $Res, $sql, alert(), db, and sql_string().

+ Here is the call graph for this function:

Field Documentation

◆ $db

Acc_Parm_Code::$db

$db database connection

Definition at line 31 of file acc_parm_code.class.php.

◆ $p_code

Acc_Parm_Code::$p_code

$p_code parm_code.p_code primary key

Definition at line 32 of file acc_parm_code.class.php.

Referenced by form().

◆ $p_comment

Acc_Parm_Code::$p_comment

$p_comment parm_code.p_comment

Definition at line 34 of file acc_parm_code.class.php.

Referenced by form().

◆ $p_value

Acc_Parm_Code::$p_value

$p_value parm_code.p_value

Definition at line 33 of file acc_parm_code.class.php.

Referenced by form().


The documentation for this class was generated from the following file: