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

Class to manage the company parameter (address, name...) More...

+ Collaboration diagram for Noalyss_Parameter_Folder:

Public Member Functions

 __construct ($p_cn)
 
 __toString ()
 
 check ($p_attr, $p_value)
 
 check_anc_filter ($p_value)
 
 match_analytic ($p_accounting)
 Check if an accounting match the anc_filter. More...
 
 save ($p_attr)
 save the parameter into the database by inserting or updating More...
 
 update ()
 save data More...
 

Data Fields

 $db
 
 $MY_ALPHANUM
 
 $MY_ANALYTIC
 
 $MY_ANC_FILTER
 
 $MY_CHECK_PERIODE
 
 $MY_COMMUNE
 
 $MY_COUNTRY
 
 $MY_CP
 
 $MY_CURRENCY
 
 $MY_DATE_SUGGEST
 
 $MY_DEFAULT_ROUND_ERROR_CRED
 
 $MY_DEFAULT_ROUND_ERROR_DEB
 
 $MY_FAX
 
 $MY_NAME
 
 $MY_NUMBER
 
 $MY_PAYS
 
 $MY_PJ_SUGGEST
 
 $MY_REPORT
 In Belgium , we need a report on the beginning of the exercice , not in French,. More...
 
 $MY_STOCK
 
 $MY_STREET
 
 $MY_STRICT
 
 $MY_TEL
 
 $MY_TVA
 
 $MY_TVA_USE
 
 $MY_UPDLAB
 

Detailed Description

Class to manage the company parameter (address, name...)

Definition at line 27 of file noalyss_parameter_folder.class.php.

Constructor & Destructor Documentation

◆ __construct()

Noalyss_Parameter_Folder::__construct (   $p_cn)

Definition at line 57 of file noalyss_parameter_folder.class.php.

58 {
59 $this->db=$p_cn;
60 $Res=$p_cn->exec_sql("select * from parameter where pr_id like 'MY_%'");
61 for ($i = 0;$i < Database::num_row($Res);$i++)
62 {
64 $key=$row['pr_id'];
65 $elt=$row['pr_value'];
66 // store value here
67 $this->{"$key"}=$elt;
68 }
69
70 }
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
$SecUser db

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __toString()

Noalyss_Parameter_Folder::__toString ( )

Definition at line 72 of file noalyss_parameter_folder.class.php.

72 : string
73 {
74 $r = <<<EOF
75MY_TVA = [ {$this->MY_TVA }]
76MY_STREET = [ {$this->MY_STREET }]
77MY_NUMBER= [ {$this->MY_NUMBER }]
78MY_CP= [ {$this->MY_CP }]
79MY_TEL= [ {$this->MY_TEL }]
80MY_PAYS= [ {$this->MY_PAYS }]
81MY_COMMUNE= [ {$this->MY_COMMUNE }]
82MY_FAX= [ {$this->MY_FAX }]
83MY_ANALYTIC= [ {$this->MY_ANALYTIC }]
84MY_STRICT= [ {$this->MY_STRICT }]
85MY_TVA_USE= [ {$this->MY_TVA_USE }]
86MY_PJ_SUGGEST= [ {$this->MY_PJ_SUGGEST }]
87MY_CHECK_PERIODE= [ {$this->MY_CHECK_PERIODE }]
88MY_DATE_SUGGEST= [ {$this->MY_DATE_SUGGEST }]
89MY_ALPHANUM= [ {$this->MY_ALPHANUM }]
90MY_UPDLAB= [ {$this->MY_UPDLAB }]
91MY_STOCK= [ {$this->MY_STOCK }]
92MY_DEFAULT_ROUND_ERROR_DEB= [ {$this->MY_DEFAULT_ROUND_ERROR_DEB }]
93MY_DEFAULT_ROUND_ERROR_CRED= [ {$this->MY_DEFAULT_ROUND_ERROR_CRED }]
94MY_ANC_FILTER= [ {$this->MY_ANC_FILTER }]
95MY_REPORT = [ {$this->MY_REPORT } ]
96
97EOF;
98 return $r;
99 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r

References $r.

◆ check()

Noalyss_Parameter_Folder::check (   $p_attr,
  $p_value 
)

Definition at line 114 of file noalyss_parameter_folder.class.php.

115 {
116 $ret_value=$p_value;
117 switch ($p_attr)
118 {
119 case 'MY_STRICT':
120
121 if (empty($p_value) ||($p_value!='Y'&&$p_value!='N'))
122 {
123 $ret_value='N';
124 }
125
126 break;
127 case 'MY_ANC_FILTER':
128 try
129 {
130 $p_value=noalyss_str_replace(" ", "", $p_value);
131 $this->check_anc_filter($p_value);
132 $ret_value=$p_value;
133 }
134 catch (Exception $exc)
135 {
136 throw $exc;
137 }
138
139 break;
140 default :
141 $ret_value=htmlspecialchars($p_value);
142 }
143 return $ret_value;
144 }
noalyss_str_replace($search, $replace, $string)
Definition: ac_common.php:1553

References check_anc_filter(), and noalyss_str_replace().

Referenced by save().

+ Here is the call graph for this function:

◆ check_anc_filter()

Noalyss_Parameter_Folder::check_anc_filter (   $p_value)

Definition at line 101 of file noalyss_parameter_folder.class.php.

101 :void
102 {
103 $tmp_value=$p_value;
104 $tmp_value=preg_replace("/[0-9]|,/", '', $p_value);
105 if ( $tmp_value != "") {
106 throw new Exception (sprintf(_("Valeur invalide %s"),$tmp_value),1000);
107 }
108 if (trim($p_value) == "") {
109 throw new Exception (sprintf(_("Erreur Filtre analytique %s"),$tmp_value),1001);
110
111 }
112
113 }

Referenced by check().

◆ match_analytic()

Noalyss_Parameter_Folder::match_analytic (   $p_accounting)

Check if an accounting match the anc_filter.

Parameters
string$p_accounting
Returns
boolean FALSE does not match , TRUE matches

Definition at line 216 of file noalyss_parameter_folder.class.php.

217 {
218 $string="/^[".$this->MY_ANC_FILTER."]+/";
219 if ( preg_match($string,$p_accounting) == 0 ) return FALSE;
220 return TRUE;
221 }

References $string.

◆ save()

Noalyss_Parameter_Folder::save (   $p_attr)

save the parameter into the database by inserting or updating

Parameters
$p_attrgive the attribut name

Definition at line 154 of file noalyss_parameter_folder.class.php.

155 {
156 try {
157 $value=$this->check($p_attr,$this->$p_attr);
158
159 // check if the parameter does exist
160 if ( $this->db->get_value('select count(*) from parameter where pr_id=$1',array($p_attr)) != 0 )
161 {
162 $Res=$this->db->exec_sql("update parameter set pr_value=$1 where pr_id=$2",
163 array($value,$p_attr));
164 }
165 else
166 {
167
168 $Res=$this->db->exec_sql("insert into parameter (pr_id,pr_value) values( $1,$2)",
169 array($p_attr,$value));
170
171 }
172 } catch (Exception $e) {
173 throw $e;
174 }
175
176 }

References $e, $Res, $value, check(), and db.

Referenced by update().

+ Here is the call graph for this function:

◆ update()

Noalyss_Parameter_Folder::update ( )

save data

Definition at line 184 of file noalyss_parameter_folder.class.php.

185 {
186
187 $this->save('MY_NAME');
188 $this->save('MY_TVA');
189 $this->save('MY_STREET');
190 $this->save('MY_NUMBER');
191 $this->save('MY_CP');
192 $this->save('MY_TEL');
193 $this->save('MY_PAYS');
194 $this->save('MY_COMMUNE');
195 $this->save('MY_FAX');
196 $this->save('MY_ANALYTIC');
197 $this->save('MY_STRICT');
198 $this->save('MY_TVA_USE');
199 $this->save('MY_PJ_SUGGEST');
200 $this->save('MY_CHECK_PERIODE');
201 $this->save('MY_DATE_SUGGEST');
202 $this->save('MY_ALPHANUM');
203 $this->save('MY_UPDLAB');
204 $this->save('MY_STOCK');
205 $this->save('MY_DEFAULT_ROUND_ERROR_DEB');
206 $this->save('MY_DEFAULT_ROUND_ERROR_CRED');
207 $this->save("MY_ANC_FILTER");
208 $this->save("MY_REPORT");
209
210 }
save($p_attr)
save the parameter into the database by inserting or updating

References save().

+ Here is the call graph for this function:

Field Documentation

◆ $db

Noalyss_Parameter_Folder::$db

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

◆ $MY_ALPHANUM

Noalyss_Parameter_Folder::$MY_ALPHANUM

Definition at line 45 of file noalyss_parameter_folder.class.php.

◆ $MY_ANALYTIC

Noalyss_Parameter_Folder::$MY_ANALYTIC

Definition at line 39 of file noalyss_parameter_folder.class.php.

◆ $MY_ANC_FILTER

Noalyss_Parameter_Folder::$MY_ANC_FILTER

Definition at line 50 of file noalyss_parameter_folder.class.php.

◆ $MY_CHECK_PERIODE

Noalyss_Parameter_Folder::$MY_CHECK_PERIODE

Definition at line 43 of file noalyss_parameter_folder.class.php.

◆ $MY_COMMUNE

Noalyss_Parameter_Folder::$MY_COMMUNE

Definition at line 37 of file noalyss_parameter_folder.class.php.

◆ $MY_COUNTRY

Noalyss_Parameter_Folder::$MY_COUNTRY

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

◆ $MY_CP

Noalyss_Parameter_Folder::$MY_CP

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

◆ $MY_CURRENCY

Noalyss_Parameter_Folder::$MY_CURRENCY

Definition at line 51 of file noalyss_parameter_folder.class.php.

◆ $MY_DATE_SUGGEST

Noalyss_Parameter_Folder::$MY_DATE_SUGGEST

Definition at line 44 of file noalyss_parameter_folder.class.php.

◆ $MY_DEFAULT_ROUND_ERROR_CRED

Noalyss_Parameter_Folder::$MY_DEFAULT_ROUND_ERROR_CRED

Definition at line 49 of file noalyss_parameter_folder.class.php.

◆ $MY_DEFAULT_ROUND_ERROR_DEB

Noalyss_Parameter_Folder::$MY_DEFAULT_ROUND_ERROR_DEB

Definition at line 48 of file noalyss_parameter_folder.class.php.

◆ $MY_FAX

Noalyss_Parameter_Folder::$MY_FAX

Definition at line 38 of file noalyss_parameter_folder.class.php.

◆ $MY_NAME

Noalyss_Parameter_Folder::$MY_NAME

Definition at line 30 of file noalyss_parameter_folder.class.php.

◆ $MY_NUMBER

Noalyss_Parameter_Folder::$MY_NUMBER

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

◆ $MY_PAYS

Noalyss_Parameter_Folder::$MY_PAYS

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

◆ $MY_PJ_SUGGEST

Noalyss_Parameter_Folder::$MY_PJ_SUGGEST

Definition at line 42 of file noalyss_parameter_folder.class.php.

◆ $MY_REPORT

Noalyss_Parameter_Folder::$MY_REPORT

In Belgium , we need a report on the beginning of the exercice , not in French,.

Definition at line 53 of file noalyss_parameter_folder.class.php.

◆ $MY_STOCK

Noalyss_Parameter_Folder::$MY_STOCK

Definition at line 47 of file noalyss_parameter_folder.class.php.

◆ $MY_STREET

Noalyss_Parameter_Folder::$MY_STREET

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

◆ $MY_STRICT

Noalyss_Parameter_Folder::$MY_STRICT

Definition at line 40 of file noalyss_parameter_folder.class.php.

◆ $MY_TEL

Noalyss_Parameter_Folder::$MY_TEL

Definition at line 35 of file noalyss_parameter_folder.class.php.

◆ $MY_TVA

Noalyss_Parameter_Folder::$MY_TVA

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

◆ $MY_TVA_USE

Noalyss_Parameter_Folder::$MY_TVA_USE

Definition at line 41 of file noalyss_parameter_folder.class.php.

◆ $MY_UPDLAB

Noalyss_Parameter_Folder::$MY_UPDLAB

Definition at line 46 of file noalyss_parameter_folder.class.php.


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