@@ -142,7 +142,9 @@ discard block |
||
142 | 142 | accessforbidden(); |
143 | 143 | } |
144 | 144 | |
145 | -if (empty($conf->holiday->enabled)) accessforbidden('Module not enabled'); |
|
145 | +if (empty($conf->holiday->enabled)) { |
|
146 | + accessforbidden('Module not enabled'); |
|
147 | +} |
|
146 | 148 | |
147 | 149 | $result = restrictedArea($user, 'holiday', '', ''); |
148 | 150 | // If we are on the view of a specific user |
@@ -893,14 +895,18 @@ discard block |
||
893 | 895 | print '<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid), 'dayhour').'">'; |
894 | 896 | print dol_print_date($db->jdate($obj->date_valid), 'day'); |
895 | 897 | print '</td>'; |
896 | - if (!$i) $totalarray['nbfield']++; |
|
898 | + if (!$i) { |
|
899 | + $totalarray['nbfield']++; |
|
900 | + } |
|
897 | 901 | } |
898 | 902 | // Date approval |
899 | 903 | if (!empty($arrayfields['cp.date_approval']['checked'])) { |
900 | 904 | print '<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval), 'dayhour').'">'; |
901 | 905 | print dol_print_date($db->jdate($obj->date_approval), 'day'); |
902 | 906 | print '</td>'; |
903 | - if (!$i) $totalarray['nbfield']++; |
|
907 | + if (!$i) { |
|
908 | + $totalarray['nbfield']++; |
|
909 | + } |
|
904 | 910 | } |
905 | 911 | |
906 | 912 | // Extra fields |
@@ -197,9 +197,10 @@ discard block |
||
197 | 197 | if ($action == 'setmode' && $user->rights->salaries->write) { |
198 | 198 | $object->fetch($id); |
199 | 199 | $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); |
200 | - if ($result < 0) |
|
201 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
202 | -} |
|
200 | + if ($result < 0) { |
|
201 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
202 | + } |
|
203 | + } |
|
203 | 204 | |
204 | 205 | // bank account |
205 | 206 | if ($action == 'setbankaccount' && $user->rights->salaries->write) { |
@@ -213,7 +214,9 @@ discard block |
||
213 | 214 | if ($action == 'add' && empty($cancel)) { |
214 | 215 | $error = 0; |
215 | 216 | |
216 | - if (empty($datev)) $datev = $datep; |
|
217 | + if (empty($datev)) { |
|
218 | + $datev = $datep; |
|
219 | + } |
|
217 | 220 | |
218 | 221 | $type_payment = GETPOST("paymenttype", 'alpha'); |
219 | 222 | $amount = price2num(GETPOST("amount", 'alpha'), 'MT', 2); |
@@ -390,8 +393,12 @@ discard block |
||
390 | 393 | $newdatestart = dol_mktime(0, 0, 0, GETPOST('clone_date_startmonth', 'int'), GETPOST('clone_date_startday', 'int'), GETPOST('clone_date_startyear', 'int')); |
391 | 394 | $newdateend = dol_mktime(0, 0, 0, GETPOST('clone_date_endmonth', 'int'), GETPOST('clone_date_endday', 'int'), GETPOST('clone_date_endyear', 'int')); |
392 | 395 | |
393 | - if ($newdatestart) $object->datesp = $newdatestart; |
|
394 | - if ($newdateend) $object->dateep = $newdateend; |
|
396 | + if ($newdatestart) { |
|
397 | + $object->datesp = $newdatestart; |
|
398 | + } |
|
399 | + if ($newdateend) { |
|
400 | + $object->dateep = $newdateend; |
|
401 | + } |
|
395 | 402 | |
396 | 403 | $id = $object->create($user); |
397 | 404 | if ($id > 0) { |
@@ -443,7 +450,9 @@ discard block |
||
443 | 450 | |
444 | 451 | $form = new Form($db); |
445 | 452 | $formfile = new FormFile($db); |
446 | -if (isModEnabled('project')) $formproject = new FormProjets($db); |
|
453 | +if (isModEnabled('project')) { |
|
454 | + $formproject = new FormProjets($db); |
|
455 | +} |
|
447 | 456 | |
448 | 457 | $title = $langs->trans('Salary')." - ".$object->ref; |
449 | 458 | $help_url = ""; |
@@ -870,8 +879,9 @@ discard block |
||
870 | 879 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
871 | 880 | print $langs->trans('DefaultPaymentMode'); |
872 | 881 | print '</td>'; |
873 | - if ($action != 'editmode') |
|
874 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
882 | + if ($action != 'editmode') { |
|
883 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
884 | + } |
|
875 | 885 | print '</tr></table>'; |
876 | 886 | print '</td><td>'; |
877 | 887 | |
@@ -978,8 +988,9 @@ discard block |
||
978 | 988 | } |
979 | 989 | |
980 | 990 | print '<td class="right">'; |
981 | - if ($bankaccountstatic->id) |
|
982 | - print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
991 | + if ($bankaccountstatic->id) { |
|
992 | + print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
993 | + } |
|
983 | 994 | print '</td>'; |
984 | 995 | } |
985 | 996 | print '<td class="right nowrap amountcard">'.price($objp->amount)."</td>\n"; |
@@ -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(); |
@@ -195,7 +217,9 @@ discard block |
||
195 | 217 | $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); |
196 | 218 | if ($remaintopay == 0) { |
197 | 219 | $result = $contrib->set_paid($user); |
198 | - } else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); |
|
220 | + } else { |
|
221 | + dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); |
|
222 | + } |
|
199 | 223 | } |
200 | 224 | } |
201 | 225 | } |
@@ -205,7 +229,9 @@ discard block |
||
205 | 229 | } |
206 | 230 | |
207 | 231 | $result = $this->call_trigger('PAYMENTSALARY_CREATE', $user); |
208 | - if ($result < 0) $error++; |
|
232 | + if ($result < 0) { |
|
233 | + $error++; |
|
234 | + } |
|
209 | 235 | |
210 | 236 | if ($totalamount != 0 && !$error) { |
211 | 237 | $this->amount = $totalamount; |
@@ -300,15 +326,34 @@ discard block |
||
300 | 326 | |
301 | 327 | // Clean parameters |
302 | 328 | |
303 | - if (isset($this->fk_salary)) $this->fk_salary = (int) $this->fk_salary; |
|
304 | - if (isset($this->amount)) $this->amount = trim($this->amount); |
|
305 | - if (isset($this->fk_typepayment)) $this->fk_typepayment = (int) $this->fk_typepayment; |
|
306 | - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated |
|
307 | - if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); |
|
308 | - if (isset($this->note)) $this->note = trim($this->note); |
|
309 | - if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; |
|
310 | - if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author; |
|
311 | - if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; |
|
329 | + if (isset($this->fk_salary)) { |
|
330 | + $this->fk_salary = (int) $this->fk_salary; |
|
331 | + } |
|
332 | + if (isset($this->amount)) { |
|
333 | + $this->amount = trim($this->amount); |
|
334 | + } |
|
335 | + if (isset($this->fk_typepayment)) { |
|
336 | + $this->fk_typepayment = (int) $this->fk_typepayment; |
|
337 | + } |
|
338 | + if (isset($this->num_paiement)) { |
|
339 | + $this->num_paiement = trim($this->num_paiement); |
|
340 | + } |
|
341 | + // deprecated |
|
342 | + if (isset($this->num_payment)) { |
|
343 | + $this->num_payment = trim($this->num_payment); |
|
344 | + } |
|
345 | + if (isset($this->note)) { |
|
346 | + $this->note = trim($this->note); |
|
347 | + } |
|
348 | + if (isset($this->fk_bank)) { |
|
349 | + $this->fk_bank = (int) $this->fk_bank; |
|
350 | + } |
|
351 | + if (isset($this->fk_user_author)) { |
|
352 | + $this->fk_user_author = (int) $this->fk_user_author; |
|
353 | + } |
|
354 | + if (isset($this->fk_user_modif)) { |
|
355 | + $this->fk_user_modif = (int) $this->fk_user_modif; |
|
356 | + } |
|
312 | 357 | |
313 | 358 | // Check parameters |
314 | 359 | // Put here code to add control on parameters values |
@@ -679,7 +724,9 @@ discard block |
||
679 | 724 | |
680 | 725 | $result = ''; |
681 | 726 | |
682 | - if (empty($this->ref)) $this->ref = $this->lib; |
|
727 | + if (empty($this->ref)) { |
|
728 | + $this->ref = $this->lib; |
|
729 | + } |
|
683 | 730 | |
684 | 731 | $label = img_picto('', $this->picto).' <u>'.$langs->trans("SalaryPayment").'</u>'; |
685 | 732 | $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; |
@@ -688,7 +735,9 @@ discard block |
||
688 | 735 | $reg = array(); |
689 | 736 | if (preg_match('/^\((.*)\)$/i', $this->label, $reg)) { |
690 | 737 | // Label generique car entre parentheses. On l'affiche en le traduisant |
691 | - if ($reg[1] == 'paiement') $reg[1] = 'Payment'; |
|
738 | + if ($reg[1] == 'paiement') { |
|
739 | + $reg[1] = 'Payment'; |
|
740 | + } |
|
692 | 741 | $labeltoshow = $langs->trans($reg[1]); |
693 | 742 | } |
694 | 743 | $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow; |
@@ -701,8 +750,12 @@ discard block |
||
701 | 750 | $link = '<a href="'.DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; |
702 | 751 | $linkend = '</a>'; |
703 | 752 | |
704 | - if ($withpicto) $result .= ($link.img_object($label, 'payment', 'class="classfortooltip pictofixedwidth"').$linkend); |
|
705 | - if ($withpicto != 2) $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend; |
|
753 | + if ($withpicto) { |
|
754 | + $result .= ($link.img_object($label, 'payment', 'class="classfortooltip pictofixedwidth"').$linkend); |
|
755 | + } |
|
756 | + if ($withpicto != 2) { |
|
757 | + $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend; |
|
758 | + } |
|
706 | 759 | } |
707 | 760 | |
708 | 761 | return $result; |
@@ -179,7 +179,9 @@ discard block |
||
179 | 179 | if (!$notrigger) { |
180 | 180 | // Call trigger |
181 | 181 | $result = $this->call_trigger('SALARY_MODIFY', $user); |
182 | - if ($result < 0) $error++; |
|
182 | + if ($result < 0) { |
|
183 | + $error++; |
|
184 | + } |
|
183 | 185 | // End call triggers |
184 | 186 | } |
185 | 187 | |
@@ -280,7 +282,9 @@ discard block |
||
280 | 282 | |
281 | 283 | // Call trigger |
282 | 284 | $result = $this->call_trigger('SALARY_DELETE', $user); |
283 | - if ($result < 0) return -1; |
|
285 | + if ($result < 0) { |
|
286 | + return -1; |
|
287 | + } |
|
284 | 288 | // End call triggers |
285 | 289 | |
286 | 290 | // Delete extrafields |
@@ -394,7 +398,9 @@ discard block |
||
394 | 398 | $sql .= ", salary"; |
395 | 399 | $sql .= ", fk_typepayment"; |
396 | 400 | $sql .= ", fk_account"; |
397 | - if ($this->note) $sql .= ", note"; |
|
401 | + if ($this->note) { |
|
402 | + $sql .= ", note"; |
|
403 | + } |
|
398 | 404 | $sql .= ", label"; |
399 | 405 | $sql .= ", datesp"; |
400 | 406 | $sql .= ", dateep"; |
@@ -412,7 +418,9 @@ discard block |
||
412 | 418 | $sql .= ", ".($this->salary > 0 ? ((double) $this->salary) : "null"); |
413 | 419 | $sql .= ", ".($this->type_payment > 0 ? ((int) $this->type_payment) : 0); |
414 | 420 | $sql .= ", ".($this->accountid > 0 ? ((int) $this->accountid) : "null"); |
415 | - if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'"; |
|
421 | + if ($this->note) { |
|
422 | + $sql .= ", '".$this->db->escape($this->note)."'"; |
|
423 | + } |
|
416 | 424 | $sql .= ", '".$this->db->escape($this->label)."'"; |
417 | 425 | $sql .= ", '".$this->db->idate($this->datesp)."'"; |
418 | 426 | $sql .= ", '".$this->db->idate($this->dateep)."'"; |
@@ -440,9 +448,13 @@ discard block |
||
440 | 448 | |
441 | 449 | // Call trigger |
442 | 450 | $result = $this->call_trigger('SALARY_CREATE', $user); |
443 | - if ($result < 0) $error++; |
|
451 | + if ($result < 0) { |
|
452 | + $error++; |
|
453 | + } |
|
444 | 454 | // End call triggers |
445 | - } else $error++; |
|
455 | + } else { |
|
456 | + $error++; |
|
457 | + } |
|
446 | 458 | |
447 | 459 | if (!$error) { |
448 | 460 | $this->db->commit(); |
@@ -496,7 +508,10 @@ discard block |
||
496 | 508 | global $dolibarr_main_authentication, $dolibarr_main_demo; |
497 | 509 | global $menumanager; |
498 | 510 | |
499 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
511 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
512 | + $notooltip = 1; |
|
513 | + } |
|
514 | + // Force disable tooltips |
|
500 | 515 | |
501 | 516 | $result = ''; |
502 | 517 | |
@@ -518,8 +533,12 @@ discard block |
||
518 | 533 | if ($option != 'nolink') { |
519 | 534 | // Add param to save lastsearch_values or not |
520 | 535 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
521 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; |
|
522 | - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; |
|
536 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
537 | + $add_save_lastsearch_values = 1; |
|
538 | + } |
|
539 | + if ($add_save_lastsearch_values) { |
|
540 | + $url .= '&save_lastsearch_values=1'; |
|
541 | + } |
|
523 | 542 | } |
524 | 543 | |
525 | 544 | $linkclose = ''; |
@@ -537,15 +556,21 @@ discard block |
||
537 | 556 | $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
538 | 557 | if ($reshook > 0) $linkclose = $hookmanager->resPrint; |
539 | 558 | */ |
540 | - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
559 | + } else { |
|
560 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
561 | + } |
|
541 | 562 | |
542 | 563 | $linkstart = '<a href="'.$url.'"'; |
543 | 564 | $linkstart .= $linkclose.'>'; |
544 | 565 | $linkend = '</a>'; |
545 | 566 | |
546 | 567 | $result .= $linkstart; |
547 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1); |
|
548 | - if ($withpicto != 2) $result .= $this->ref; |
|
568 | + if ($withpicto) { |
|
569 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1); |
|
570 | + } |
|
571 | + if ($withpicto != 2) { |
|
572 | + $result .= $this->ref; |
|
573 | + } |
|
549 | 574 | $result .= $linkend; |
550 | 575 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
551 | 576 | |
@@ -553,8 +578,11 @@ discard block |
||
553 | 578 | $hookmanager->initHooks(array('salarypayment')); |
554 | 579 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
555 | 580 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
556 | - if ($reshook > 0) $result = $hookmanager->resPrint; |
|
557 | - else $result .= $hookmanager->resPrint; |
|
581 | + if ($reshook > 0) { |
|
582 | + $result = $hookmanager->resPrint; |
|
583 | + } else { |
|
584 | + $result .= $hookmanager->resPrint; |
|
585 | + } |
|
558 | 586 | |
559 | 587 | return $result; |
560 | 588 | } |
@@ -580,7 +608,9 @@ discard block |
||
580 | 608 | $amount = 0; |
581 | 609 | |
582 | 610 | $obj = $this->db->fetch_object($resql); |
583 | - if ($obj) $amount = $obj->amount ? $obj->amount : 0; |
|
611 | + if ($obj) { |
|
612 | + $amount = $obj->amount ? $obj->amount : 0; |
|
613 | + } |
|
584 | 614 | |
585 | 615 | $this->db->free($resql); |
586 | 616 | return $amount; |
@@ -634,8 +664,11 @@ discard block |
||
634 | 664 | $sql .= " paye = 1"; |
635 | 665 | $sql .= " WHERE rowid = ".((int) $this->id); |
636 | 666 | $return = $this->db->query($sql); |
637 | - if ($return) return 1; |
|
638 | - else return -1; |
|
667 | + if ($return) { |
|
668 | + return 1; |
|
669 | + } else { |
|
670 | + return -1; |
|
671 | + } |
|
639 | 672 | } |
640 | 673 | |
641 | 674 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
@@ -652,8 +685,11 @@ discard block |
||
652 | 685 | $sql .= " paye = 0"; |
653 | 686 | $sql .= " WHERE rowid = ".((int) $this->id); |
654 | 687 | $return = $this->db->query($sql); |
655 | - if ($return) return 1; |
|
656 | - else return -1; |
|
688 | + if ($return) { |
|
689 | + return 1; |
|
690 | + } else { |
|
691 | + return -1; |
|
692 | + } |
|
657 | 693 | } |
658 | 694 | |
659 | 695 | |
@@ -695,15 +731,23 @@ discard block |
||
695 | 731 | //$langs->load("mymodule"); |
696 | 732 | $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('BillStatusNotPaid'); |
697 | 733 | $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('BillStatusPaid'); |
698 | - if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted"); |
|
734 | + if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) { |
|
735 | + $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted"); |
|
736 | + } |
|
699 | 737 | $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('BillStatusNotPaid'); |
700 | 738 | $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('BillStatusPaid'); |
701 | - if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted"); |
|
739 | + if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) { |
|
740 | + $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted"); |
|
741 | + } |
|
702 | 742 | } |
703 | 743 | |
704 | 744 | $statusType = 'status1'; |
705 | - if ($status == 0 && $alreadypaid <> 0) $statusType = 'status3'; |
|
706 | - if ($status == 1) $statusType = 'status6'; |
|
745 | + if ($status == 0 && $alreadypaid <> 0) { |
|
746 | + $statusType = 'status3'; |
|
747 | + } |
|
748 | + if ($status == 1) { |
|
749 | + $statusType = 'status6'; |
|
750 | + } |
|
707 | 751 | |
708 | 752 | return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); |
709 | 753 | } |
@@ -37,13 +37,17 @@ |
||
37 | 37 | <?php |
38 | 38 | |
39 | 39 | // Other attributes |
40 | -if (!isset($parameters)) $parameters = array(); |
|
40 | +if (!isset($parameters)) { |
|
41 | + $parameters = array(); |
|
42 | +} |
|
41 | 43 | |
42 | 44 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
43 | 45 | print $hookmanager->resPrint; |
44 | 46 | if (empty($reshook)) { |
45 | 47 | $params = array(); |
46 | - if (isset($tpl_context)) $params['tpl_context'] = $tpl_context; |
|
48 | + if (isset($tpl_context)) { |
|
49 | + $params['tpl_context'] = $tpl_context; |
|
50 | + } |
|
47 | 51 | $params['cols'] = $parameters['colspanvalue']; |
48 | 52 | print $object->showOptionals($extrafields, 'create', $params); |
49 | 53 | } |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | // Load translation files required by the page |
39 | 39 | $langs->loadLangs(array("stocks", "other", "productbatch", "companies")); |
40 | - if (isModEnabled('incoterm')) $langs->load('incoterm'); |
|
40 | + if (isModEnabled('incoterm')) { |
|
41 | + $langs->load('incoterm'); |
|
42 | + } |
|
41 | 43 | |
42 | 44 | // Get parameters |
43 | 45 | $id = GETPOST('id', 'int'); |
@@ -72,10 +74,14 @@ discard block |
||
72 | 74 | $search_all = trim(GETPOST("search_all", 'alpha')); |
73 | 75 | $search = array(); |
74 | 76 | foreach ($object->fields as $key => $val) { |
75 | - if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
76 | -} |
|
77 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
78 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
79 | + } |
|
80 | + } |
|
77 | 81 | |
78 | -if (empty($action) && empty($id) && empty($ref)) $action = 'view'; |
|
82 | +if (empty($action) && empty($id) && empty($ref)) { |
|
83 | + $action = 'view'; |
|
84 | +} |
|
79 | 85 | |
80 | 86 | // Load object |
81 | 87 | include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
@@ -94,7 +100,9 @@ discard block |
||
94 | 100 | //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); |
95 | 101 | //$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); |
96 | 102 | |
97 | -if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); |
|
103 | +if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) { |
|
104 | + accessforbidden(); |
|
105 | +} |
|
98 | 106 | |
99 | 107 | |
100 | 108 | /* |
@@ -107,7 +115,9 @@ discard block |
||
107 | 115 | |
108 | 116 | $parameters = array(); |
109 | 117 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
110 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
118 | +if ($reshook < 0) { |
|
119 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
120 | +} |
|
111 | 121 | |
112 | 122 | if (empty($reshook)) { |
113 | 123 | $error = 0; |
@@ -116,8 +126,11 @@ discard block |
||
116 | 126 | |
117 | 127 | if (empty($backtopage) || ($cancel && empty($id))) { |
118 | 128 | if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { |
119 | - if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; |
|
120 | - else $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); |
|
129 | + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
|
130 | + $backtopage = $backurlforlist; |
|
131 | + } else { |
|
132 | + $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); |
|
133 | + } |
|
121 | 134 | } |
122 | 135 | } |
123 | 136 | $triggermodname = 'STOCKTRANSFER_STOCKTRANSFER_MODIFY'; // Name of trigger action code to execute when we modify record |
@@ -184,7 +197,9 @@ discard block |
||
184 | 197 | if (empty($error)) { |
185 | 198 | $line = new StockTransferLine($db); |
186 | 199 | $records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'" ).')')); |
187 | - if (!empty($records[key($records)])) $line = $records[key($records)]; |
|
200 | + if (!empty($records[key($records)])) { |
|
201 | + $line = $records[key($records)]; |
|
202 | + } |
|
188 | 203 | $line->fk_stocktransfer = $id; |
189 | 204 | $line->qty += $qty; |
190 | 205 | $line->fk_warehouse_source = $fk_warehouse_source; |
@@ -193,8 +208,9 @@ discard block |
||
193 | 208 | $line->batch = $batch; |
194 | 209 | |
195 | 210 | $line->pmp = $prod->pmp; |
196 | - if ($line->id > 0) $line->update($user); |
|
197 | - else { |
|
211 | + if ($line->id > 0) { |
|
212 | + $line->update($user); |
|
213 | + } else { |
|
198 | 214 | $line->rang = count($object->lines) + 1; |
199 | 215 | $line->create($user); |
200 | 216 | } |
@@ -257,10 +273,15 @@ discard block |
||
257 | 273 | $db->begin(); |
258 | 274 | foreach ($lines as $line) { |
259 | 275 | $res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source); |
260 | - if ($res <= 0) $error++; |
|
276 | + if ($res <= 0) { |
|
277 | + $error++; |
|
278 | + } |
|
279 | + } |
|
280 | + if (empty($error)) { |
|
281 | + $db->commit(); |
|
282 | + } else { |
|
283 | + $db->rollback(); |
|
261 | 284 | } |
262 | - if (empty($error)) $db->commit(); |
|
263 | - else $db->rollback(); |
|
264 | 285 | } |
265 | 286 | if (empty($error)) { |
266 | 287 | $object->setStatut($object::STATUS_TRANSFERED, $id); |
@@ -278,10 +299,15 @@ discard block |
||
278 | 299 | $db->begin(); |
279 | 300 | foreach ($lines as $line) { |
280 | 301 | $res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source, 0); |
281 | - if ($res <= 0) $error++; |
|
302 | + if ($res <= 0) { |
|
303 | + $error++; |
|
304 | + } |
|
305 | + } |
|
306 | + if (empty($error)) { |
|
307 | + $db->commit(); |
|
308 | + } else { |
|
309 | + $db->rollback(); |
|
282 | 310 | } |
283 | - if (empty($error)) $db->commit(); |
|
284 | - else $db->rollback(); |
|
285 | 311 | } |
286 | 312 | if (empty($error)) { |
287 | 313 | $object->setStatut($object::STATUS_VALIDATED, $id); |
@@ -299,10 +325,15 @@ discard block |
||
299 | 325 | $db->begin(); |
300 | 326 | foreach ($lines as $line) { |
301 | 327 | $res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination, 0); |
302 | - if ($res <= 0) $error++; |
|
328 | + if ($res <= 0) { |
|
329 | + $error++; |
|
330 | + } |
|
331 | + } |
|
332 | + if (empty($error)) { |
|
333 | + $db->commit(); |
|
334 | + } else { |
|
335 | + $db->rollback(); |
|
303 | 336 | } |
304 | - if (empty($error)) $db->commit(); |
|
305 | - else $db->rollback(); |
|
306 | 337 | } |
307 | 338 | if (empty($error)) { |
308 | 339 | $object->setStatut($object::STATUS_CLOSED, $id); |
@@ -320,10 +351,15 @@ discard block |
||
320 | 351 | $db->begin(); |
321 | 352 | foreach ($lines as $line) { |
322 | 353 | $res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination); |
323 | - if ($res <= 0) $error++; |
|
354 | + if ($res <= 0) { |
|
355 | + $error++; |
|
356 | + } |
|
357 | + } |
|
358 | + if (empty($error)) { |
|
359 | + $db->commit(); |
|
360 | + } else { |
|
361 | + $db->rollback(); |
|
324 | 362 | } |
325 | - if (empty($error)) $db->commit(); |
|
326 | - else $db->rollback(); |
|
327 | 363 | } |
328 | 364 | if (empty($error)) { |
329 | 365 | $object->setStatut($object::STATUS_TRANSFERED, $id); |
@@ -368,7 +404,9 @@ discard block |
||
368 | 404 | // Affichage alerte date prévue de départ si transfert concerné |
369 | 405 | $date_prevue_depart = $object->date_prevue_depart; |
370 | 406 | $date_prevue_depart_plus_delai = $date_prevue_depart; |
371 | -if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day'); |
|
407 | +if ($object->lead_time_for_warning > 0) { |
|
408 | + $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day'); |
|
409 | +} |
|
372 | 410 | if (!empty($date_prevue_depart) && $date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) { |
373 | 411 | print "$('.valuefield.fieldname_date_prevue_depart').append('"; |
374 | 412 | print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); |
@@ -386,8 +424,12 @@ discard block |
||
386 | 424 | print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
387 | 425 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
388 | 426 | print '<input type="hidden" name="action" value="add">'; |
389 | - if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
390 | - if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
427 | + if ($backtopage) { |
|
428 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
429 | + } |
|
430 | + if ($backtopageforcancel) { |
|
431 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
432 | + } |
|
391 | 433 | |
392 | 434 | print dol_get_fiche_head(array(), ''); |
393 | 435 | |
@@ -443,8 +485,12 @@ discard block |
||
443 | 485 | print '<input type="hidden" name="token" value="' . newToken() . '">'; |
444 | 486 | print '<input type="hidden" name="action" value="update">'; |
445 | 487 | print '<input type="hidden" name="id" value="' . $object->id . '">'; |
446 | - if ($backtopage) print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
447 | - if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
488 | + if ($backtopage) { |
|
489 | + print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
490 | + } |
|
491 | + if ($backtopageforcancel) { |
|
492 | + print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
493 | + } |
|
448 | 494 | |
449 | 495 | print dol_get_fiche_head(); |
450 | 496 | |
@@ -545,8 +591,11 @@ discard block |
||
545 | 591 | // Call Hook formConfirm |
546 | 592 | $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); |
547 | 593 | $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
548 | - if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; |
|
549 | - elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; |
|
594 | + if (empty($reshook)) { |
|
595 | + $formconfirm .= $hookmanager->resPrint; |
|
596 | + } elseif ($reshook > 0) { |
|
597 | + $formconfirm = $hookmanager->resPrint; |
|
598 | + } |
|
550 | 599 | |
551 | 600 | // Print form confirm |
552 | 601 | print $formconfirm; |
@@ -616,8 +665,11 @@ discard block |
||
616 | 665 | print '<table width="100%" class="nobordernopadding"><tr><td>'; |
617 | 666 | print $langs->trans('IncotermLabel'); |
618 | 667 | print '<td><td class="right">'; |
619 | - if ($permissiontoadd && $action != 'editincoterm') print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>'; |
|
620 | - else print ' '; |
|
668 | + if ($permissiontoadd && $action != 'editincoterm') { |
|
669 | + print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>'; |
|
670 | + } else { |
|
671 | + print ' '; |
|
672 | + } |
|
621 | 673 | print '</td></tr></table>'; |
622 | 674 | print '</td>'; |
623 | 675 | print '<td>'; |
@@ -706,7 +758,9 @@ discard block |
||
706 | 758 | <input type="hidden" name="mode" value=""> |
707 | 759 | <input type="hidden" name="id" value="' . $object->id.'"> |
708 | 760 | '; |
709 | - if ($lineid > 0) print '<input type="hidden" name="lineid" value="'.$lineid.'" />'; |
|
761 | + if ($lineid > 0) { |
|
762 | + print '<input type="hidden" name="lineid" value="'.$lineid.'" />'; |
|
763 | + } |
|
710 | 764 | print '<table id="tablelines" class="liste centpercent">'; |
711 | 765 | //print '<div class="tagtable centpercent">'; |
712 | 766 | |
@@ -753,32 +807,48 @@ discard block |
||
753 | 807 | |
754 | 808 | print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.'>'; |
755 | 809 | print '<td class="titlefield">'; |
756 | - if ($action === 'editline' && $line->id == $lineid) $form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1); |
|
757 | - else print $productstatic->getNomUrl(1).' - '.$productstatic->label; |
|
810 | + if ($action === 'editline' && $line->id == $lineid) { |
|
811 | + $form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1); |
|
812 | + } else { |
|
813 | + print $productstatic->getNomUrl(1).' - '.$productstatic->label; |
|
814 | + } |
|
758 | 815 | print '</td>'; |
759 | 816 | if (isModEnabled('productbatch')) { |
760 | 817 | print '<td>'; |
761 | - if ($action === 'editline' && $line->id == $lineid) print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>'; |
|
762 | - else { |
|
818 | + if ($action === 'editline' && $line->id == $lineid) { |
|
819 | + print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>'; |
|
820 | + } else { |
|
763 | 821 | $productlot = new Productlot($db); |
764 | 822 | if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) { |
765 | 823 | print $productlot->getNomUrl(1); |
766 | - } elseif (!empty($line->batch)) print $line->batch.' '.img_warning($langs->trans('BatchNotFound'));; |
|
824 | + } elseif (!empty($line->batch)) { |
|
825 | + print $line->batch.' '.img_warning($langs->trans('BatchNotFound')); |
|
826 | + } |
|
827 | + ; |
|
767 | 828 | } |
768 | 829 | print '</td>'; |
769 | 830 | } |
770 | 831 | |
771 | 832 | print '<td>'; |
772 | 833 | |
773 | - if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource); |
|
774 | - else print $warehousestatics->getNomUrl(1); |
|
834 | + if ($action === 'editline' && $line->id == $lineid) { |
|
835 | + print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource); |
|
836 | + } else { |
|
837 | + print $warehousestatics->getNomUrl(1); |
|
838 | + } |
|
775 | 839 | print '</td>'; |
776 | 840 | print '<td>'; |
777 | - if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination); |
|
778 | - else print $warehousestatict->getNomUrl(1); |
|
841 | + if ($action === 'editline' && $line->id == $lineid) { |
|
842 | + print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination); |
|
843 | + } else { |
|
844 | + print $warehousestatict->getNomUrl(1); |
|
845 | + } |
|
779 | 846 | print '</td>'; |
780 | - if ($action === 'editline' && $line->id == $lineid) print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>'; |
|
781 | - else print '<td class="center">'.$line->qty.'</td>'; |
|
847 | + if ($action === 'editline' && $line->id == $lineid) { |
|
848 | + print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>'; |
|
849 | + } else { |
|
850 | + print '<td class="center">'.$line->qty.'</td>'; |
|
851 | + } |
|
782 | 852 | |
783 | 853 | if ($conf->global->PRODUCT_USE_UNITS) { |
784 | 854 | print '<td class="linecoluseunit nowrap left">'; |
@@ -840,7 +910,9 @@ discard block |
||
840 | 910 | // Product |
841 | 911 | print '<td class="titlefield">'; |
842 | 912 | $filtertype = 0; |
843 | - if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype = ''; |
|
913 | + if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) { |
|
914 | + $filtertype = ''; |
|
915 | + } |
|
844 | 916 | if ($conf->global->PRODUIT_LIMIT_SIZE <= 0) { |
845 | 917 | $limit = ''; |
846 | 918 | } else { |
@@ -864,7 +936,9 @@ discard block |
||
864 | 936 | $source_ent = new Entrepot($db); |
865 | 937 | $source_ent->fetch($object->fk_warehouse_source); |
866 | 938 | foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) { |
867 | - if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id']; |
|
939 | + if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) { |
|
940 | + $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id']; |
|
941 | + } |
|
868 | 942 | } |
869 | 943 | } |
870 | 944 | |
@@ -874,7 +948,9 @@ discard block |
||
874 | 948 | $dest_ent = new Entrepot($db); |
875 | 949 | $dest_ent->fetch($object->fk_warehouse_destination); |
876 | 950 | foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) { |
877 | - if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id']; |
|
951 | + if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) { |
|
952 | + $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id']; |
|
953 | + } |
|
878 | 954 | } |
879 | 955 | } |
880 | 956 | |
@@ -919,7 +995,9 @@ discard block |
||
919 | 995 | print '<div class="tabsAction">'."\n"; |
920 | 996 | $parameters = array(); |
921 | 997 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
922 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
998 | + if ($reshook < 0) { |
|
999 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1000 | + } |
|
923 | 1001 | |
924 | 1002 | if (empty($reshook)) { |
925 | 1003 | // Send |
@@ -1043,7 +1121,9 @@ discard block |
||
1043 | 1121 | } |
1044 | 1122 | |
1045 | 1123 | //Select mail models is same action as presend |
1046 | - if (GETPOST('modelselected')) $action = 'presend'; |
|
1124 | + if (GETPOST('modelselected')) { |
|
1125 | + $action = 'presend'; |
|
1126 | + } |
|
1047 | 1127 | |
1048 | 1128 | // Presend form |
1049 | 1129 | $modelmail = 'stocktransfer'; |
@@ -43,8 +43,10 @@ discard block |
||
43 | 43 | |
44 | 44 | if (GETPOST('actioncode', 'array')) { |
45 | 45 | $actioncode = GETPOST('actioncode', 'array', 3); |
46 | - if (!count($actioncode)) $actioncode = '0'; |
|
47 | -} else { |
|
46 | + if (!count($actioncode)) { |
|
47 | + $actioncode = '0'; |
|
48 | + } |
|
49 | + } else { |
|
48 | 50 | $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); |
49 | 51 | } |
50 | 52 | $search_agenda_label = GETPOST('search_agenda_label'); |
@@ -57,8 +59,12 @@ discard block |
||
57 | 59 | $offset = $limit * $page; |
58 | 60 | $pageprev = $page - 1; |
59 | 61 | $pagenext = $page + 1; |
60 | -if (!$sortfield) $sortfield = 'a.datep,a.id'; |
|
61 | -if (!$sortorder) $sortorder = 'DESC,DESC'; |
|
62 | +if (!$sortfield) { |
|
63 | + $sortfield = 'a.datep,a.id'; |
|
64 | +} |
|
65 | +if (!$sortorder) { |
|
66 | + $sortorder = 'DESC,DESC'; |
|
67 | +} |
|
62 | 68 | |
63 | 69 | // Initialize technical objects |
64 | 70 | $object = new StockTransfer($db); |
@@ -70,7 +76,9 @@ discard block |
||
70 | 76 | |
71 | 77 | // Load object |
72 | 78 | include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
73 | -if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id; |
|
79 | +if ($id > 0 || !empty($ref)) { |
|
80 | + $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id; |
|
81 | +} |
|
74 | 82 | |
75 | 83 | // Security check - Protection if external user |
76 | 84 | //if ($user->socid > 0) accessforbidden(); |
@@ -86,7 +94,9 @@ discard block |
||
86 | 94 | |
87 | 95 | $parameters = array('id'=>$id); |
88 | 96 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
89 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
97 | +if ($reshook < 0) { |
|
98 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
99 | +} |
|
90 | 100 | |
91 | 101 | if (empty($reshook)) { |
92 | 102 | // Cancel |
@@ -116,7 +126,9 @@ discard block |
||
116 | 126 | $help_url = ''; |
117 | 127 | llxHeader('', $title, $help_url); |
118 | 128 | |
119 | - if (isModEnabled('notification')) $langs->load("mails"); |
|
129 | + if (isModEnabled('notification')) { |
|
130 | + $langs->load("mails"); |
|
131 | + } |
|
120 | 132 | $head = stocktransferPrepareHead($object); |
121 | 133 | |
122 | 134 | |
@@ -190,7 +202,9 @@ discard block |
||
190 | 202 | $permok = $user->rights->agenda->myactions->create; |
191 | 203 | if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { |
192 | 204 | //$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'; |
193 | - if (get_class($objthirdparty) == 'Societe') $out .= '&socid='.$objthirdparty->id; |
|
205 | + if (get_class($objthirdparty) == 'Societe') { |
|
206 | + $out .= '&socid='.$objthirdparty->id; |
|
207 | + } |
|
194 | 208 | $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage=1'; |
195 | 209 | //$out.=$langs->trans("AddAnAction").' '; |
196 | 210 | //$out.=img_picto($langs->trans("AddAnAction"),'filenew'); |
@@ -212,8 +226,12 @@ discard block |
||
212 | 226 | |
213 | 227 | if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { |
214 | 228 | $param = '&id='.$object->id.'&socid='.$socid; |
215 | - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
216 | - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
229 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
230 | + $param .= '&contextpage='.urlencode($contextpage); |
|
231 | + } |
|
232 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
233 | + $param .= '&limit='.urlencode($limit); |
|
234 | + } |
|
217 | 235 | |
218 | 236 | |
219 | 237 | //print load_fiche_titre($langs->trans("ActionsOnStockTransfer"), '', ''); |
@@ -66,8 +66,12 @@ |
||
66 | 66 | //if ($user->socid > 0) $socid = $user->socid; |
67 | 67 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
68 | 68 | //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
69 | -if (empty($conf->bookcal->enabled)) accessforbidden(); |
|
70 | -if (!$permissiontoread) accessforbidden(); |
|
69 | +if (empty($conf->bookcal->enabled)) { |
|
70 | + accessforbidden(); |
|
71 | +} |
|
72 | +if (!$permissiontoread) { |
|
73 | + accessforbidden(); |
|
74 | +} |
|
71 | 75 | |
72 | 76 | |
73 | 77 | /* |
@@ -143,13 +143,19 @@ |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | // Security check (enable the most restrictive one) |
146 | -if ($user->socid > 0) accessforbidden(); |
|
146 | +if ($user->socid > 0) { |
|
147 | + accessforbidden(); |
|
148 | +} |
|
147 | 149 | //if ($user->socid > 0) accessforbidden(); |
148 | 150 | //$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
149 | 151 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
150 | 152 | //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
151 | -if (empty($conf->bookcal->enabled)) accessforbidden('Module not enabled'); |
|
152 | -if (!$permissiontoread) accessforbidden(); |
|
153 | +if (empty($conf->bookcal->enabled)) { |
|
154 | + accessforbidden('Module not enabled'); |
|
155 | +} |
|
156 | +if (!$permissiontoread) { |
|
157 | + accessforbidden(); |
|
158 | +} |
|
153 | 159 | |
154 | 160 | |
155 | 161 | /* |