noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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)
 check that the filter for ANC operation is valid
 
 input_select_format ()
 build a SELECT html input
 
 match_analytic ($p_accounting)
 Check if an accounting match the anc_filter.
 
 save ($p_attr)
 save the parameter into the database by inserting or updating
 
 update ()
 save data
 

Data Fields

 $db
 
 $MY_ALPHANUM
 
 $MY_ANALYTIC
 
 $MY_ANC_FILTER
 
 $MY_CHECK_PERIODE
 
 $MY_CITY
 
 $MY_COUNTRY
 
 $MY_COUNTRY_CODE
 
 $MY_CURRENCY
 
 $MY_DATE_SUGGEST
 
 $MY_DEFAULT_ROUND_ERROR_CRED
 
 $MY_DEFAULT_ROUND_ERROR_DEB
 
 $MY_FAX
 
 $MY_INVOICE_FORMAT
 Default invoice format : BASIC, UBL21BEL, FACTURXFR.
 
 $MY_NAME
 
 $MY_NUMBER
 
 $MY_PHONE
 
 $MY_PJ_SUGGEST
 
 $MY_POSTCODE
 
 $MY_REPORT
 In Belgium , we need a report on the beginning of the exercice , not in France,.
 
 $MY_STOCK
 
 $MY_STREET
 
 $MY_STRICT
 
 $MY_TVA
 
 $MY_TVA_USE
 
 $MY_UPDLAB
 
const VALID_INVOICE_FORMAT =['BASIC','UBL21BEL','FACTURXFR']
 

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 59 of file noalyss_parameter_folder.class.php.

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

74 : string
75 {
76 $r = <<<EOF
77MY_TVA = [ {$this->MY_TVA }]
78MY_STREET = [ {$this->MY_STREET }]
79MY_NUMBER= [ {$this->MY_NUMBER }]
80MY_POSTCODE= [ {$this->MY_POSTCODE }]
81MY_PHONE= [ {$this->MY_PHONE }]
82MY_COUNTRY= [ {$this->MY_COUNTRY }]
83MY_COUNTRY_CODE= [ {$this->MY_COUNTRY_CODE }]
84MY_CITY= [ {$this->MY_CITY }]
85MY_FAX= [ {$this->MY_FAX }]
86MY_ANALYTIC= [ {$this->MY_ANALYTIC }]
87MY_STRICT= [ {$this->MY_STRICT }]
88MY_TVA_USE= [ {$this->MY_TVA_USE }]
89MY_PJ_SUGGEST= [ {$this->MY_PJ_SUGGEST }]
90MY_CHECK_PERIODE= [ {$this->MY_CHECK_PERIODE }]
91MY_DATE_SUGGEST= [ {$this->MY_DATE_SUGGEST }]
92MY_ALPHANUM= [ {$this->MY_ALPHANUM }]
93MY_UPDLAB= [ {$this->MY_UPDLAB }]
94MY_STOCK= [ {$this->MY_STOCK }]
95MY_DEFAULT_ROUND_ERROR_DEB= [ {$this->MY_DEFAULT_ROUND_ERROR_DEB }]
96MY_DEFAULT_ROUND_ERROR_CRED= [ {$this->MY_DEFAULT_ROUND_ERROR_CRED }]
97MY_ANC_FILTER= [ {$this->MY_ANC_FILTER }]
98MY_REPORT = [ {$this->MY_REPORT } ]
99MY_INVOICE_FORMAT = [ {$this->MY_INVOICE_FORMAT} ]
100EOF;
101 return $r;
102 }
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 122 of file noalyss_parameter_folder.class.php.

123 {
124 $ret_value=$p_value;
125 switch ($p_attr)
126 {
127 case 'MY_STRICT':
128
129 if (empty($p_value) ||($p_value!='Y'&&$p_value!='N'))
130 {
131 $ret_value='N';
132 }
133
134 break;
135 case 'MY_ANC_FILTER':
136 try
137 {
138 $p_value=noalyss_str_replace(" ", "", $p_value);
139 $this->check_anc_filter($p_value);
140 $ret_value=$p_value;
141 }
142 catch (Exception $exc)
143 {
144 throw $exc;
145 }
146
147 break;
148 case 'MY_INVOICE_FORMAT':
149 if ( !in_array($this->MY_INVOICE_FORMAT, Noalyss_Parameter_Folder::VALID_INVOICE_FORMAT))
150 {
151 throw new \Exception ('Format facture invalide');
152 }
153 default :
154 $ret_value= strip_tags($p_value);
155 }
156 return $ret_value;
157 }
noalyss_str_replace($search, $replace, $string)
check_anc_filter($p_value)
check that the filter for ANC operation is valid

References check_anc_filter(), noalyss_str_replace(), and VALID_INVOICE_FORMAT.

Referenced by save().

+ Here is the call graph for this function:

◆ check_anc_filter()

Noalyss_Parameter_Folder::check_anc_filter ( $p_value)

check that the filter for ANC operation is valid

Parameters
$p_value(string) list of digit for accounting separated by comma
Returns
void
Exceptions
ifvalue contains a no-digit value

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

109 :void
110 {
111 $tmp_value=$p_value;
112 $tmp_value=preg_replace("/[0-9]|,/", '', $p_value);
113 if ( $tmp_value != "") {
114 throw new Exception (sprintf(_("Valeur invalide %s"),$tmp_value),1000);
115 }
116 if (trim($p_value) == "") {
117 throw new Exception (sprintf(_("Erreur Filtre analytique %s"),$tmp_value),1001);
118
119 }
120
121 }
_("actif, passif,charge,...")

References _.

Referenced by check().

◆ input_select_format()

Noalyss_Parameter_Folder::input_select_format ( )

build a SELECT html input

Returns
\ISelect

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

246 {
247 $select_format_invoice=new \ISelect('invoice_format');
248 $a_label=[_("Basic"),_("UBL21 Belgique"),_("FacturX France")];
252 }
$MY_INVOICE_FORMAT
Default invoice format : BASIC, UBL21BEL, FACTURXFR.
$select_format_invoice

References $MY_INVOICE_FORMAT, $select_format_invoice, _, and VALID_INVOICE_FORMAT.

◆ 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 231 of file noalyss_parameter_folder.class.php.

232 {
233 $a_filter=explode(",",$this->MY_ANC_FILTER??"");
234 if (empty($a_filter)) return false;
235 foreach ($a_filter as $filter ) {
236 $string="/^".$filter.".*/";
237
238 if ( preg_match($string,$p_accounting) != 0 ) return TRUE;
239 }
240 return FALSE;
241 }

References $filter, and $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 167 of file noalyss_parameter_folder.class.php.

168 {
169 try {
170 $value=$this->check($p_attr,$this->$p_attr);
171
172 // check if the parameter does exist
173 if ( $this->db->get_value('select count(*) from parameter where pr_id=$1',array($p_attr)) != 0 )
174 {
175 $Res=$this->db->exec_sql("update parameter set pr_value=$1 where pr_id=$2",
176 array($value,$p_attr));
177 }
178 else
179 {
180
181 $Res=$this->db->exec_sql("insert into parameter (pr_id,pr_value) values( $1,$2)",
182 array($p_attr,$value));
183
184 }
185 } catch (Exception $e) {
186 throw $e;
187 }
188
189 }

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 197 of file noalyss_parameter_folder.class.php.

198 {
199
200 $this->save('MY_NAME');
201 $this->save('MY_TVA');
202 $this->save('MY_STREET');
203 $this->save('MY_NUMBER');
204 $this->save('MY_POSTCODE');
205 $this->save('MY_PHONE');
206 $this->save('MY_COUNTRY');
207 $this->save('MY_COUNTRY_CODE');
208 $this->save('MY_CITY');
209 $this->save('MY_FAX');
210 $this->save('MY_ANALYTIC');
211 $this->save('MY_STRICT');
212 $this->save('MY_TVA_USE');
213 $this->save('MY_PJ_SUGGEST');
214 $this->save('MY_CHECK_PERIODE');
215 $this->save('MY_DATE_SUGGEST');
216 $this->save('MY_ALPHANUM');
217 $this->save('MY_UPDLAB');
218 $this->save('MY_STOCK');
219 $this->save('MY_DEFAULT_ROUND_ERROR_DEB');
220 $this->save('MY_DEFAULT_ROUND_ERROR_CRED');
221 $this->save("MY_ANC_FILTER");
222 $this->save("MY_REPORT");
223 $this->save("MY_INVOICE_FORMAT");
224
225 }
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_CITY

Noalyss_Parameter_Folder::$MY_CITY

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

◆ $MY_COUNTRY

Noalyss_Parameter_Folder::$MY_COUNTRY

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

◆ $MY_COUNTRY_CODE

Noalyss_Parameter_Folder::$MY_COUNTRY_CODE

Definition at line 52 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_INVOICE_FORMAT

Noalyss_Parameter_Folder::$MY_INVOICE_FORMAT

Default invoice format : BASIC, UBL21BEL, FACTURXFR.

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

Referenced by input_select_format().

◆ $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_PHONE

Noalyss_Parameter_Folder::$MY_PHONE

Definition at line 35 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_POSTCODE

Noalyss_Parameter_Folder::$MY_POSTCODE

Definition at line 34 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 France,.

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_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.

◆ VALID_INVOICE_FORMAT

const Noalyss_Parameter_Folder::VALID_INVOICE_FORMAT =['BASIC','UBL21BEL','FACTURXFR']

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

Referenced by check(), and input_select_format().


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