@@ -149,7 +149,9 @@ |
||
149 | 149 | if (!isModEnabled("mymodule")) { |
150 | 150 | accessforbidden(); |
151 | 151 | } |
152 | -if (!$permissiontoread) accessforbidden(); |
|
152 | +if (!$permissiontoread) { |
|
153 | + accessforbidden(); |
|
154 | +} |
|
153 | 155 | |
154 | 156 | |
155 | 157 | /* |
@@ -65,7 +65,7 @@ |
||
65 | 65 | |
66 | 66 | $startdate = $enddate = ''; |
67 | 67 | if (GETPOST('startdatemonth')) { |
68 | - $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); |
|
68 | + $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); |
|
69 | 69 | } |
70 | 70 | if (GETPOST('enddatemonth')) { |
71 | 71 | $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear')); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; |
346 | 346 | $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").","; |
347 | 347 | $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").","; |
348 | - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ?((int) $this->fk_user_modif) : "null"); |
|
348 | + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null"); |
|
349 | 349 | $sql .= " WHERE rowid=".((int) $this->id); |
350 | 350 | |
351 | 351 | $this->db->begin(); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $result .= $linkend; |
656 | 656 | |
657 | 657 | global $action; |
658 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
658 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
659 | 659 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
660 | 660 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
661 | 661 | if ($reshook > 0) { |
@@ -83,10 +83,18 @@ |
||
83 | 83 | //if ($user->socid > 0) accessforbidden(); |
84 | 84 | //if ($user->socid > 0) $socid = $user->socid; |
85 | 85 | //$result = restrictedArea($user, 'partnership', $object->id); |
86 | -if (empty($conf->partnership->enabled)) accessforbidden(); |
|
87 | -if (empty($permissiontoread)) accessforbidden(); |
|
88 | -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); |
|
89 | -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); |
|
86 | +if (empty($conf->partnership->enabled)) { |
|
87 | + accessforbidden(); |
|
88 | +} |
|
89 | +if (empty($permissiontoread)) { |
|
90 | + accessforbidden(); |
|
91 | +} |
|
92 | +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { |
|
93 | + accessforbidden(); |
|
94 | +} |
|
95 | +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { |
|
96 | + accessforbidden(); |
|
97 | +} |
|
90 | 98 | |
91 | 99 | |
92 | 100 |
@@ -83,10 +83,18 @@ |
||
83 | 83 | //if ($user->socid > 0) accessforbidden(); |
84 | 84 | //if ($user->socid > 0) $socid = $user->socid; |
85 | 85 | //$result = restrictedArea($user, 'partnership', $object->id); |
86 | -if (empty($conf->partnership->enabled)) accessforbidden(); |
|
87 | -if (empty($permissiontoread)) accessforbidden(); |
|
88 | -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); |
|
89 | -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); |
|
86 | +if (empty($conf->partnership->enabled)) { |
|
87 | + accessforbidden(); |
|
88 | +} |
|
89 | +if (empty($permissiontoread)) { |
|
90 | + accessforbidden(); |
|
91 | +} |
|
92 | +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { |
|
93 | + accessforbidden(); |
|
94 | +} |
|
95 | +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { |
|
96 | + accessforbidden(); |
|
97 | +} |
|
90 | 98 | |
91 | 99 | |
92 | 100 |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | return $pass; |
195 | 195 | } |
196 | 196 | |
197 | - return $this->getNewGeneratedPassword(); // warning, may generate infinite loop if conditions are not possible |
|
197 | + return $this->getNewGeneratedPassword(); // warning, may generate infinite loop if conditions are not possible |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | global $langs; |
210 | 210 | |
211 | - $this->initAll(); // For the case this method is called alone |
|
211 | + $this->initAll(); // For the case this method is called alone |
|
212 | 212 | |
213 | 213 | $password_a = preg_split('//u', $password, null, PREG_SPLIT_NO_EMPTY); |
214 | 214 | $maj = preg_split('//u', $this->Maj, null, PREG_SPLIT_NO_EMPTY); |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | |
584 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
584 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
585 | 585 | /** |
586 | 586 | * Mise a jour du lien entre le paiement de salaire et la ligne dans llx_bank generee |
587 | 587 | * |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function update_fk_bank($id_bank) |
592 | 592 | { |
593 | - // phpcs:enable |
|
593 | + // phpcs:enable |
|
594 | 594 | $sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id); |
595 | 595 | |
596 | 596 | dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | return $this->LibStatut($this->statut, $mode); |
670 | 670 | } |
671 | 671 | |
672 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
672 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
673 | 673 | /** |
674 | 674 | * Return the status |
675 | 675 | * |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | */ |
680 | 680 | public function LibStatut($status, $mode = 0) |
681 | 681 | { |
682 | - // phpcs:enable |
|
682 | + // phpcs:enable |
|
683 | 683 | global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage |
684 | 684 | |
685 | 685 | $langs->load('compta'); |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | if ($result <= 0) { |
565 | 565 | $this->error = $this->db->lasterror(); |
566 | - dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->error); |
|
566 | + dol_syslog(get_class($this).'::addPaymentToBank '.$this->error); |
|
567 | 567 | $error++; |
568 | 568 | } |
569 | 569 | } |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | $label = $langs->trans("SalaryPayment"); |
779 | 779 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
780 | 780 | } |
781 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
781 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
782 | 782 | $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; |
783 | 783 | } else { |
784 | 784 | $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
@@ -139,15 +139,34 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | // Clean parameters |
142 | - if (isset($this->fk_salary)) $this->fk_salary = (int) $this->fk_salary; |
|
143 | - if (isset($this->amount)) $this->amount = trim($this->amount); |
|
144 | - if (isset($this->fk_typepayment)) $this->fk_typepayment = (int) $this->fk_typepayment; |
|
145 | - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated |
|
146 | - if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); |
|
147 | - if (isset($this->note)) $this->note = trim($this->note); |
|
148 | - if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; |
|
149 | - if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author; |
|
150 | - if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; |
|
142 | + if (isset($this->fk_salary)) { |
|
143 | + $this->fk_salary = (int) $this->fk_salary; |
|
144 | + } |
|
145 | + if (isset($this->amount)) { |
|
146 | + $this->amount = trim($this->amount); |
|
147 | + } |
|
148 | + if (isset($this->fk_typepayment)) { |
|
149 | + $this->fk_typepayment = (int) $this->fk_typepayment; |
|
150 | + } |
|
151 | + if (isset($this->num_paiement)) { |
|
152 | + $this->num_paiement = trim($this->num_paiement); |
|
153 | + } |
|
154 | + // deprecated |
|
155 | + if (isset($this->num_payment)) { |
|
156 | + $this->num_payment = trim($this->num_payment); |
|
157 | + } |
|
158 | + if (isset($this->note)) { |
|
159 | + $this->note = trim($this->note); |
|
160 | + } |
|
161 | + if (isset($this->fk_bank)) { |
|
162 | + $this->fk_bank = (int) $this->fk_bank; |
|
163 | + } |
|
164 | + if (isset($this->fk_user_author)) { |
|
165 | + $this->fk_user_author = (int) $this->fk_user_author; |
|
166 | + } |
|
167 | + if (isset($this->fk_user_modif)) { |
|
168 | + $this->fk_user_modif = (int) $this->fk_user_modif; |
|
169 | + } |
|
151 | 170 | |
152 | 171 | $totalamount = 0; |
153 | 172 | foreach ($this->amounts as $key => $value) { // How payment is dispatch |
@@ -158,7 +177,10 @@ discard block |
||
158 | 177 | $totalamount = price2num($totalamount); |
159 | 178 | |
160 | 179 | // Check parameters |
161 | - if ($totalamount == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null |
|
180 | + if ($totalamount == 0) { |
|
181 | + return -1; |
|
182 | + } |
|
183 | + // On accepte les montants negatifs pour les rejets de prelevement mais pas null |
|
162 | 184 | |
163 | 185 | |
164 | 186 | $this->db->begin(); |
@@ -207,7 +229,9 @@ discard block |
||
207 | 229 | } |
208 | 230 | |
209 | 231 | $result = $this->call_trigger('PAYMENTSALARY_CREATE', $user); |
210 | - if ($result < 0) $error++; |
|
232 | + if ($result < 0) { |
|
233 | + $error++; |
|
234 | + } |
|
211 | 235 | |
212 | 236 | if ($totalamount != 0 && !$error) { |
213 | 237 | $this->amount = $totalamount; |
@@ -303,15 +327,34 @@ discard block |
||
303 | 327 | |
304 | 328 | // Clean parameters |
305 | 329 | |
306 | - if (isset($this->fk_salary)) $this->fk_salary = (int) $this->fk_salary; |
|
307 | - if (isset($this->amount)) $this->amount = trim($this->amount); |
|
308 | - if (isset($this->fk_typepayment)) $this->fk_typepayment = (int) $this->fk_typepayment; |
|
309 | - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated |
|
310 | - if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); |
|
311 | - if (isset($this->note)) $this->note = trim($this->note); |
|
312 | - if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; |
|
313 | - if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author; |
|
314 | - if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; |
|
330 | + if (isset($this->fk_salary)) { |
|
331 | + $this->fk_salary = (int) $this->fk_salary; |
|
332 | + } |
|
333 | + if (isset($this->amount)) { |
|
334 | + $this->amount = trim($this->amount); |
|
335 | + } |
|
336 | + if (isset($this->fk_typepayment)) { |
|
337 | + $this->fk_typepayment = (int) $this->fk_typepayment; |
|
338 | + } |
|
339 | + if (isset($this->num_paiement)) { |
|
340 | + $this->num_paiement = trim($this->num_paiement); |
|
341 | + } |
|
342 | + // deprecated |
|
343 | + if (isset($this->num_payment)) { |
|
344 | + $this->num_payment = trim($this->num_payment); |
|
345 | + } |
|
346 | + if (isset($this->note)) { |
|
347 | + $this->note = trim($this->note); |
|
348 | + } |
|
349 | + if (isset($this->fk_bank)) { |
|
350 | + $this->fk_bank = (int) $this->fk_bank; |
|
351 | + } |
|
352 | + if (isset($this->fk_user_author)) { |
|
353 | + $this->fk_user_author = (int) $this->fk_user_author; |
|
354 | + } |
|
355 | + if (isset($this->fk_user_modif)) { |
|
356 | + $this->fk_user_modif = (int) $this->fk_user_modif; |
|
357 | + } |
|
315 | 358 | |
316 | 359 | // Check parameters |
317 | 360 | // Put here code to add control on parameters values |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | if (is_array($cpt)) { |
628 | 628 | $listofaccount = ''; |
629 | 629 | foreach ($cpt as $cptcursor) { |
630 | - if (! is_null($cptcursor)) { |
|
630 | + if (!is_null($cptcursor)) { |
|
631 | 631 | if ($listofaccount) { |
632 | 632 | $listofaccount .= ","; |
633 | 633 | } |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | |
777 | 777 | $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; |
778 | 778 | $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; |
779 | - $sql .= " WHERE c.active = " . (int) $active; |
|
779 | + $sql .= " WHERE c.active = ".(int) $active; |
|
780 | 780 | $sql .= " AND c.entity = ".$conf->entity; |
781 | 781 | if ($categorytype >= 0) { |
782 | 782 | $sql .= " AND c.category_type = 1"; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public $fk_website; |
58 | 58 | |
59 | - public $fk_page; // If translation of another page |
|
59 | + public $fk_page; // If translation of another page |
|
60 | 60 | |
61 | 61 | public $pageurl; |
62 | 62 | public $aliasalt; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public $fk_object; |
120 | 120 | |
121 | - const STATUS_DRAFT = 0; // offline |
|
122 | - const STATUS_VALIDATED = 1; // online |
|
121 | + const STATUS_DRAFT = 0; // offline |
|
122 | + const STATUS_VALIDATED = 1; // online |
|
123 | 123 | |
124 | 124 | |
125 | 125 | /** |