@@ -34,14 +34,19 @@ discard block |
||
34 | 34 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
35 | 35 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
36 | 36 | $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
37 | -if (!$sortorder) $sortorder = "DESC"; |
|
38 | -if (!$sortfield) $sortfield = "date"; |
|
37 | +if (!$sortorder) { |
|
38 | + $sortorder = "DESC"; |
|
39 | +} |
|
40 | +if (!$sortfield) { |
|
41 | + $sortfield = "date"; |
|
42 | +} |
|
39 | 43 | if (empty($page) || $page == -1) { $page = 0; } |
40 | 44 | $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
41 | 45 | $offset = $limit * $page; |
42 | 46 | |
43 | -if (!$user->admin) |
|
47 | +if (!$user->admin) { |
|
44 | 48 | accessforbidden(); |
49 | +} |
|
45 | 50 | |
46 | 51 | |
47 | 52 | /* |
@@ -54,13 +59,19 @@ discard block |
||
54 | 59 | { |
55 | 60 | $file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha')); |
56 | 61 | $ret = dol_delete_file($file, 1); |
57 | - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); |
|
58 | - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); |
|
62 | + if ($ret) { |
|
63 | + setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); |
|
64 | + } else { |
|
65 | + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); |
|
66 | + } |
|
59 | 67 | } else { |
60 | 68 | $file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha')); |
61 | 69 | $ret = dol_delete_file($file, 1); |
62 | - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); |
|
63 | - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); |
|
70 | + if ($ret) { |
|
71 | + setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); |
|
72 | + } else { |
|
73 | + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); |
|
74 | + } |
|
64 | 75 | } |
65 | 76 | $action = ''; |
66 | 77 | } |
@@ -453,7 +464,9 @@ discard block |
||
453 | 464 | if (!$val['function'] || function_exists($val['function'])) { |
454 | 465 | // Enabled export format |
455 | 466 | $checked = ''; |
456 | - if ($key == 'gz') $checked = ' checked'; |
|
467 | + if ($key == 'gz') { |
|
468 | + $checked = ' checked'; |
|
469 | + } |
|
457 | 470 | print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>'; |
458 | 471 | print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; |
459 | 472 | } else { |
@@ -568,10 +581,14 @@ discard block |
||
568 | 581 | $i = 0; |
569 | 582 | foreach ($filecompression as $key => $val) |
570 | 583 | { |
571 | - if (!$val['function'] || function_exists($val['function'])) // Enabled export format |
|
584 | + if (!$val['function'] || function_exists($val['function'])) { |
|
585 | + // Enabled export format |
|
572 | 586 | { |
573 | 587 | $checked = ''; |
574 | - if ($key == 'gz') $checked = ' checked'; |
|
588 | + } |
|
589 | + if ($key == 'gz') { |
|
590 | + $checked = ' checked'; |
|
591 | + } |
|
575 | 592 | print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>'; |
576 | 593 | print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; |
577 | 594 | } else // Disabled export format |
@@ -33,8 +33,9 @@ |
||
33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
34 | 34 | |
35 | 35 | |
36 | -if (!$user->admin) |
|
36 | +if (!$user->admin) { |
|
37 | 37 | accessforbidden(); |
38 | +} |
|
38 | 39 | |
39 | 40 | // Load translation files required by the page |
40 | 41 | $langs->loadLangs(array('admin', 'other', 'ecm')); |
@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | |
70 | 70 | // Security check |
71 | 71 | $id = GETPOST("id", 'int'); |
72 | -if ($user->socid) $socid = $user->socid; |
|
72 | +if ($user->socid) { |
|
73 | + $socid = $user->socid; |
|
74 | +} |
|
73 | 75 | $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); |
74 | 76 | |
75 | 77 | |
@@ -118,8 +120,12 @@ discard block |
||
118 | 120 | { |
119 | 121 | // Check current user can read this expense report |
120 | 122 | $canread = 0; |
121 | - if (!empty($user->rights->expensereport->readall)) $canread = 1; |
|
122 | - if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) $canread = 1; |
|
123 | + if (!empty($user->rights->expensereport->readall)) { |
|
124 | + $canread = 1; |
|
125 | + } |
|
126 | + if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) { |
|
127 | + $canread = 1; |
|
128 | + } |
|
123 | 129 | if (!$canread) |
124 | 130 | { |
125 | 131 | accessforbidden(); |
@@ -133,7 +139,9 @@ discard block |
||
133 | 139 | |
134 | 140 | $parameters = array('socid' => $socid); |
135 | 141 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
136 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
142 | +if ($reshook < 0) { |
|
143 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
144 | +} |
|
137 | 145 | |
138 | 146 | if (empty($reshook)) |
139 | 147 | { |
@@ -160,10 +168,16 @@ discard block |
||
160 | 168 | |
161 | 169 | include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; |
162 | 170 | |
163 | - if (GETPOSTISSET('sendit')) // If we just submit a file |
|
171 | + if (GETPOSTISSET('sendit')) { |
|
172 | + // If we just submit a file |
|
164 | 173 | { |
165 | - if ($action == 'updateline') $action = 'editline'; // To avoid to make the updateline now |
|
166 | - else $action = ''; // To avoid to make the addline now |
|
174 | + if ($action == 'updateline') $action = 'editline'; |
|
175 | + } |
|
176 | + // To avoid to make the updateline now |
|
177 | + else { |
|
178 | + $action = ''; |
|
179 | + } |
|
180 | + // To avoid to make the addline now |
|
167 | 181 | } |
168 | 182 | |
169 | 183 | include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once |
@@ -222,7 +236,9 @@ discard block |
||
222 | 236 | $object->date_fin = $date_end; |
223 | 237 | |
224 | 238 | $object->fk_user_author = GETPOST('fk_user_author', 'int'); |
225 | - if (!($object->fk_user_author > 0)) $object->fk_user_author = $user->id; |
|
239 | + if (!($object->fk_user_author > 0)) { |
|
240 | + $object->fk_user_author = $user->id; |
|
241 | + } |
|
226 | 242 | |
227 | 243 | // Check that expense report is for a user inside the hierarchy or advanced permission for all is set |
228 | 244 | if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->writeall_advance))) { |
@@ -249,7 +265,9 @@ discard block |
||
249 | 265 | if (!$error) |
250 | 266 | { |
251 | 267 | $ret = $extrafields->setOptionalsFromPost(null, $object); |
252 | - if ($ret < 0) $error++; |
|
268 | + if ($ret < 0) { |
|
269 | + $error++; |
|
270 | + } |
|
253 | 271 | } |
254 | 272 | |
255 | 273 | if (!$error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin)) |
@@ -316,7 +334,9 @@ discard block |
||
316 | 334 | |
317 | 335 | // Fill array 'array_options' with data from update form |
318 | 336 | $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); |
319 | - if ($ret < 0) $error++; |
|
337 | + if ($ret < 0) { |
|
338 | + $error++; |
|
339 | + } |
|
320 | 340 | |
321 | 341 | if (!$error) |
322 | 342 | { |
@@ -329,8 +349,9 @@ discard block |
||
329 | 349 | } |
330 | 350 | } |
331 | 351 | |
332 | - if ($error) |
|
333 | - $action = 'edit_extras'; |
|
352 | + if ($error) { |
|
353 | + $action = 'edit_extras'; |
|
354 | + } |
|
334 | 355 | } |
335 | 356 | |
336 | 357 | if ($action == "confirm_validate" && GETPOST("confirm", 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->creer) |
@@ -351,8 +372,12 @@ discard block |
||
351 | 372 | { |
352 | 373 | $outputlangs = $langs; |
353 | 374 | $newlang = ''; |
354 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
355 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
375 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
376 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
377 | + } |
|
378 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
379 | + $newlang = $object->thirdparty->default_lang; |
|
380 | + } |
|
356 | 381 | if (!empty($newlang)) { |
357 | 382 | $outputlangs = new Translate("", $conf); |
358 | 383 | $outputlangs->setDefaultLang($newlang); |
@@ -387,7 +412,9 @@ discard block |
||
387 | 412 | |
388 | 413 | // SUBJECT |
389 | 414 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
390 | - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
415 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
416 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
417 | + } |
|
391 | 418 | |
392 | 419 | $subject = $societeName." - ".$langs->transnoentities("ExpenseReportWaitingForApproval"); |
393 | 420 | |
@@ -464,8 +491,12 @@ discard block |
||
464 | 491 | { |
465 | 492 | $outputlangs = $langs; |
466 | 493 | $newlang = ''; |
467 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
468 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
494 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
495 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
496 | + } |
|
497 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
498 | + $newlang = $object->thirdparty->default_lang; |
|
499 | + } |
|
469 | 500 | if (!empty($newlang)) { |
470 | 501 | $outputlangs = new Translate("", $conf); |
471 | 502 | $outputlangs->setDefaultLang($newlang); |
@@ -497,7 +528,9 @@ discard block |
||
497 | 528 | |
498 | 529 | // SUBJECT |
499 | 530 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
500 | - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
531 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
532 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
533 | + } |
|
501 | 534 | |
502 | 535 | $subject = $societeName." - ".$langs->transnoentities("ExpenseReportWaitingForReApproval"); |
503 | 536 | |
@@ -576,8 +609,12 @@ discard block |
||
576 | 609 | { |
577 | 610 | $outputlangs = $langs; |
578 | 611 | $newlang = ''; |
579 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
580 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
612 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
613 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
614 | + } |
|
615 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
616 | + $newlang = $object->thirdparty->default_lang; |
|
617 | + } |
|
581 | 618 | if (!empty($newlang)) { |
582 | 619 | $outputlangs = new Translate("", $conf); |
583 | 620 | $outputlangs->setDefaultLang($newlang); |
@@ -600,7 +637,9 @@ discard block |
||
600 | 637 | |
601 | 638 | // CC |
602 | 639 | $emailCC = $conf->global->NDF_CC_EMAILS; |
603 | - if (empty($emailTo)) $emailTo = $emailCC; |
|
640 | + if (empty($emailTo)) { |
|
641 | + $emailTo = $emailCC; |
|
642 | + } |
|
604 | 643 | |
605 | 644 | // FROM |
606 | 645 | $expediteur = new User($db); |
@@ -613,7 +652,9 @@ discard block |
||
613 | 652 | |
614 | 653 | // SUBJECT |
615 | 654 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
616 | - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
655 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
656 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
657 | + } |
|
617 | 658 | |
618 | 659 | $subject = $societeName." - ".$langs->transnoentities("ExpenseReportApproved"); |
619 | 660 | |
@@ -690,8 +731,12 @@ discard block |
||
690 | 731 | { |
691 | 732 | $outputlangs = $langs; |
692 | 733 | $newlang = ''; |
693 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
694 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
734 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
735 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
736 | + } |
|
737 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
738 | + $newlang = $object->thirdparty->default_lang; |
|
739 | + } |
|
695 | 740 | if (!empty($newlang)) { |
696 | 741 | $outputlangs = new Translate("", $conf); |
697 | 742 | $outputlangs->setDefaultLang($newlang); |
@@ -723,7 +768,9 @@ discard block |
||
723 | 768 | |
724 | 769 | // SUBJECT |
725 | 770 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
726 | - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
771 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
772 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
773 | + } |
|
727 | 774 | |
728 | 775 | $subject = $societeName." - ".$langs->transnoentities("ExpenseReportRefused"); |
729 | 776 | |
@@ -808,8 +855,12 @@ discard block |
||
808 | 855 | { |
809 | 856 | $outputlangs = $langs; |
810 | 857 | $newlang = ''; |
811 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
812 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
858 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
859 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
860 | + } |
|
861 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
862 | + $newlang = $object->thirdparty->default_lang; |
|
863 | + } |
|
813 | 864 | if (!empty($newlang)) { |
814 | 865 | $outputlangs = new Translate("", $conf); |
815 | 866 | $outputlangs->setDefaultLang($newlang); |
@@ -841,7 +892,9 @@ discard block |
||
841 | 892 | |
842 | 893 | // SUBJECT |
843 | 894 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
844 | - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
895 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
896 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
897 | + } |
|
845 | 898 | |
846 | 899 | $subject = $societeName." - ".$langs->transnoentities("ExpenseReportCanceled"); |
847 | 900 | |
@@ -923,8 +976,12 @@ discard block |
||
923 | 976 | { |
924 | 977 | $outputlangs = $langs; |
925 | 978 | $newlang = ''; |
926 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
927 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
979 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
980 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
981 | + } |
|
982 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
983 | + $newlang = $object->thirdparty->default_lang; |
|
984 | + } |
|
928 | 985 | if (!empty($newlang)) { |
929 | 986 | $outputlangs = new Translate("", $conf); |
930 | 987 | $outputlangs->setDefaultLang($newlang); |
@@ -962,8 +1019,12 @@ discard block |
||
962 | 1019 | { |
963 | 1020 | $outputlangs = $langs; |
964 | 1021 | $newlang = ''; |
965 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
966 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
1022 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
1023 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
1024 | + } |
|
1025 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
1026 | + $newlang = $object->thirdparty->default_lang; |
|
1027 | + } |
|
967 | 1028 | if (!empty($newlang)) { |
968 | 1029 | $outputlangs = new Translate("", $conf); |
969 | 1030 | $outputlangs->setDefaultLang($newlang); |
@@ -990,8 +1051,12 @@ discard block |
||
990 | 1051 | { |
991 | 1052 | $outputlangs = $langs; |
992 | 1053 | $newlang = ''; |
993 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
994 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
1054 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
1055 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
1056 | + } |
|
1057 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
1058 | + $newlang = $object->thirdparty->default_lang; |
|
1059 | + } |
|
995 | 1060 | if (!empty($newlang)) { |
996 | 1061 | $outputlangs = new Translate("", $conf); |
997 | 1062 | $outputlangs->setDefaultLang($newlang); |
@@ -1018,8 +1083,12 @@ discard block |
||
1018 | 1083 | { |
1019 | 1084 | $outputlangs = $langs; |
1020 | 1085 | $newlang = ''; |
1021 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
1022 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
1086 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
1087 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
1088 | + } |
|
1089 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
1090 | + $newlang = $object->thirdparty->default_lang; |
|
1091 | + } |
|
1023 | 1092 | if (!empty($newlang)) { |
1024 | 1093 | $outputlangs = new Translate("", $conf); |
1025 | 1094 | $outputlangs->setDefaultLang($newlang); |
@@ -1051,7 +1120,9 @@ discard block |
||
1051 | 1120 | |
1052 | 1121 | // SUBJECT |
1053 | 1122 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
1054 | - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
1123 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
1124 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
1125 | + } |
|
1055 | 1126 | |
1056 | 1127 | $subject = $societeName." - ".$langs->transnoentities("ExpenseReportPaid"); |
1057 | 1128 | |
@@ -1123,7 +1194,9 @@ discard block |
||
1123 | 1194 | } |
1124 | 1195 | |
1125 | 1196 | // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. |
1126 | - if (empty($vatrate)) $vatrate = "0.000"; |
|
1197 | + if (empty($vatrate)) { |
|
1198 | + $vatrate = "0.000"; |
|
1199 | + } |
|
1127 | 1200 | $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate)); |
1128 | 1201 | |
1129 | 1202 | $value_unit_ht = price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); |
@@ -1136,7 +1209,9 @@ discard block |
||
1136 | 1209 | $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int'); |
1137 | 1210 | |
1138 | 1211 | $qty = GETPOST('qty', 'int'); |
1139 | - if (empty($qty)) $qty = 1; |
|
1212 | + if (empty($qty)) { |
|
1213 | + $qty = 1; |
|
1214 | + } |
|
1140 | 1215 | |
1141 | 1216 | if (!($fk_c_type_fees > 0)) |
1142 | 1217 | { |
@@ -1185,8 +1260,9 @@ discard block |
||
1185 | 1260 | // Define output language |
1186 | 1261 | $outputlangs = $langs; |
1187 | 1262 | $newlang = GETPOST('lang_id', 'alpha'); |
1188 | - if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
1189 | - $newlang = $object->thirdparty->default_lang; |
|
1263 | + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { |
|
1264 | + $newlang = $object->thirdparty->default_lang; |
|
1265 | + } |
|
1190 | 1266 | if (!empty($newlang)) { |
1191 | 1267 | $outputlangs = new Translate("", $conf); |
1192 | 1268 | $outputlangs->setDefaultLang($newlang); |
@@ -1232,8 +1308,12 @@ discard block |
||
1232 | 1308 | { |
1233 | 1309 | $outputlangs = $langs; |
1234 | 1310 | $newlang = ''; |
1235 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
1236 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
1311 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
1312 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
1313 | + } |
|
1314 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
1315 | + $newlang = $object->thirdparty->default_lang; |
|
1316 | + } |
|
1237 | 1317 | if (!empty($newlang)) { |
1238 | 1318 | $outputlangs = new Translate("", $conf); |
1239 | 1319 | $outputlangs->setDefaultLang($newlang); |
@@ -1282,7 +1362,9 @@ discard block |
||
1282 | 1362 | $vatrate = GETPOST('vatrate', 'alpha'); |
1283 | 1363 | |
1284 | 1364 | // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. |
1285 | - if (empty($vatrate)) $vatrate = "0.000"; |
|
1365 | + if (empty($vatrate)) { |
|
1366 | + $vatrate = "0.000"; |
|
1367 | + } |
|
1286 | 1368 | $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate)); |
1287 | 1369 | |
1288 | 1370 | $value_unit_ht = price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); |
@@ -1324,8 +1406,12 @@ discard block |
||
1324 | 1406 | { |
1325 | 1407 | $outputlangs = $langs; |
1326 | 1408 | $newlang = ''; |
1327 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
1328 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
1409 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
1410 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
1411 | + } |
|
1412 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
1413 | + $newlang = $object->thirdparty->default_lang; |
|
1414 | + } |
|
1329 | 1415 | if (!empty($newlang)) { |
1330 | 1416 | $outputlangs = new Translate("", $conf); |
1331 | 1417 | $outputlangs->setDefaultLang($newlang); |
@@ -1416,9 +1502,13 @@ discard block |
||
1416 | 1502 | print '<td class="fieldrequired">'.$langs->trans("User").'</td>'; |
1417 | 1503 | print '<td>'; |
1418 | 1504 | $defaultselectuser = $user->id; |
1419 | - if (GETPOST('fk_user_author', 'int') > 0) $defaultselectuser = GETPOST('fk_user_author', 'int'); |
|
1505 | + if (GETPOST('fk_user_author', 'int') > 0) { |
|
1506 | + $defaultselectuser = GETPOST('fk_user_author', 'int'); |
|
1507 | + } |
|
1420 | 1508 | $include_users = 'hierarchyme'; |
1421 | - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expensereport->writeall_advance)) $include_users = array(); |
|
1509 | + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expensereport->writeall_advance)) { |
|
1510 | + $include_users = array(); |
|
1511 | + } |
|
1422 | 1512 | $s = $form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users, '', '0,'.$conf->entity); |
1423 | 1513 | print $s; |
1424 | 1514 | print '</td>'; |
@@ -1430,11 +1520,17 @@ discard block |
||
1430 | 1520 | print '<td>'; |
1431 | 1521 | $object = new ExpenseReport($db); |
1432 | 1522 | $include_users = $object->fetch_users_approver_expensereport(); |
1433 | - if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateExpenseReport"); |
|
1434 | - else { |
|
1523 | + if (empty($include_users)) { |
|
1524 | + print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateExpenseReport"); |
|
1525 | + } else { |
|
1435 | 1526 | $defaultselectuser = (empty($user->fk_user_expense_validator) ? $user->fk_user : $user->fk_user_expense_validator); // Will work only if supervisor has permission to approve so is inside include_users |
1436 | - if (!empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) $defaultselectuser = $conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR; // Can force default approver |
|
1437 | - if (GETPOST('fk_user_validator', 'int') > 0) $defaultselectuser = GETPOST('fk_user_validator', 'int'); |
|
1527 | + if (!empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) { |
|
1528 | + $defaultselectuser = $conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR; |
|
1529 | + } |
|
1530 | + // Can force default approver |
|
1531 | + if (GETPOST('fk_user_validator', 'int') > 0) { |
|
1532 | + $defaultselectuser = GETPOST('fk_user_validator', 'int'); |
|
1533 | + } |
|
1438 | 1534 | $s = $form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", ((empty($defaultselectuser) || empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE)) ? 0 : 1), $include_users); |
1439 | 1535 | print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); |
1440 | 1536 | } |
@@ -1631,7 +1727,9 @@ discard block |
||
1631 | 1727 | if ($action == 'clone') { |
1632 | 1728 | // Create an array for form |
1633 | 1729 | $criteriaforfilter = 'hierarchyme'; |
1634 | - if (!empty($user->rights->expensereport->readall)) $criteriaforfilter = ''; |
|
1730 | + if (!empty($user->rights->expensereport->readall)) { |
|
1731 | + $criteriaforfilter = ''; |
|
1732 | + } |
|
1635 | 1733 | $formquestion = array( |
1636 | 1734 | 'text' => '', |
1637 | 1735 | array('type' => 'other', 'name' => 'fk_user_author', 'label' => $langs->trans("SelectTargetUser"), 'value' => $form->select_dolusers((GETPOST('fk_user_author', 'int') > 0 ? GETPOST('fk_user_author', 'int') : $user->id), 'fk_user_author', 0, null, 0, $criteriaforfilter, '', '0', 0, 0, '', 0, '', 'maxwidth150')) |
@@ -1676,9 +1774,11 @@ discard block |
||
1676 | 1774 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("BrouillonnerTrip"), $langs->trans("ConfirmBrouillonnerTrip"), "confirm_setdraft", "", "", 1); |
1677 | 1775 | } |
1678 | 1776 | |
1679 | - if ($action == 'refuse') // Deny |
|
1777 | + if ($action == 'refuse') { |
|
1778 | + // Deny |
|
1680 | 1779 | { |
1681 | 1780 | $array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text", 'label'=>$langs->trans("Comment"), 'name'=>"detail_refuse", 'value'=>"")); |
1781 | + } |
|
1682 | 1782 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Deny"), '', "confirm_refuse", $array_input, "yes", 1); |
1683 | 1783 | } |
1684 | 1784 | |
@@ -1750,8 +1850,11 @@ discard block |
||
1750 | 1850 | { |
1751 | 1851 | $userauthor = new User($db); |
1752 | 1852 | $result = $userauthor->fetch($object->fk_user_author); |
1753 | - if ($result < 0) dol_print_error('', $userauthor->error); |
|
1754 | - elseif ($result > 0) print $userauthor->getNomUrl(-1); |
|
1853 | + if ($result < 0) { |
|
1854 | + dol_print_error('', $userauthor->error); |
|
1855 | + } elseif ($result > 0) { |
|
1856 | + print $userauthor->getNomUrl(-1); |
|
1857 | + } |
|
1755 | 1858 | } |
1756 | 1859 | print '</td></tr>'; |
1757 | 1860 | |
@@ -1773,22 +1876,30 @@ discard block |
||
1773 | 1876 | print '<tr>'; |
1774 | 1877 | print '<td>'.$langs->trans("DATE_SAVE").'</td>'; |
1775 | 1878 | print '<td>'.dol_print_date($object->date_valid, 'dayhour'); |
1776 | - if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late")); |
|
1777 | - if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late")); |
|
1879 | + if ($object->status == 2 && $object->hasDelay('toapprove')) { |
|
1880 | + print ' '.img_warning($langs->trans("Late")); |
|
1881 | + } |
|
1882 | + if ($object->status == 5 && $object->hasDelay('topay')) { |
|
1883 | + print ' '.img_warning($langs->trans("Late")); |
|
1884 | + } |
|
1778 | 1885 | print '</td></tr>'; |
1779 | 1886 | print '</tr>'; |
1780 | 1887 | |
1781 | 1888 | // User to inform for approval |
1782 | - if ($object->status <= ExpenseReport::STATUS_VALIDATED) // informed |
|
1889 | + if ($object->status <= ExpenseReport::STATUS_VALIDATED) { |
|
1890 | + // informed |
|
1783 | 1891 | { |
1784 | 1892 | print '<tr>'; |
1893 | + } |
|
1785 | 1894 | print '<td>'.$langs->trans("VALIDATOR").'</td>'; // approver |
1786 | 1895 | print '<td>'; |
1787 | 1896 | if ($object->fk_user_validator > 0) |
1788 | 1897 | { |
1789 | 1898 | $userfee = new User($db); |
1790 | 1899 | $result = $userfee->fetch($object->fk_user_validator); |
1791 | - if ($result > 0) print $userfee->getNomUrl(-1); |
|
1900 | + if ($result > 0) { |
|
1901 | + print $userfee->getNomUrl(-1); |
|
1902 | + } |
|
1792 | 1903 | if (empty($userfee->email) || !isValidEmail($userfee->email)) |
1793 | 1904 | { |
1794 | 1905 | $langs->load("errors"); |
@@ -1805,7 +1916,9 @@ discard block |
||
1805 | 1916 | { |
1806 | 1917 | $userfee = new User($db); |
1807 | 1918 | $result = $userfee->fetch($object->fk_user_cancel); |
1808 | - if ($result > 0) print $userfee->getNomUrl(-1); |
|
1919 | + if ($result > 0) { |
|
1920 | + print $userfee->getNomUrl(-1); |
|
1921 | + } |
|
1809 | 1922 | } |
1810 | 1923 | print '</td></tr>'; |
1811 | 1924 | |
@@ -1825,7 +1938,9 @@ discard block |
||
1825 | 1938 | { |
1826 | 1939 | $userapp = new User($db); |
1827 | 1940 | $result = $userapp->fetch($object->fk_user_approve); |
1828 | - if ($result > 0) print $userapp->getNomUrl(-1); |
|
1941 | + if ($result > 0) { |
|
1942 | + print $userapp->getNomUrl(-1); |
|
1943 | + } |
|
1829 | 1944 | } |
1830 | 1945 | print '</td></tr>'; |
1831 | 1946 | |
@@ -1842,13 +1957,17 @@ discard block |
||
1842 | 1957 | print '<td>'; |
1843 | 1958 | $userfee = new User($db); |
1844 | 1959 | $result = $userfee->fetch($object->fk_user_refuse); |
1845 | - if ($result > 0) print $userfee->getNomUrl(-1); |
|
1960 | + if ($result > 0) { |
|
1961 | + print $userfee->getNomUrl(-1); |
|
1962 | + } |
|
1846 | 1963 | print '</td></tr>'; |
1847 | 1964 | |
1848 | 1965 | print '<tr>'; |
1849 | 1966 | print '<td>'.$langs->trans("DATE_REFUS").'</td>'; |
1850 | 1967 | print '<td>'.dol_print_date($object->date_refuse, 'dayhour'); |
1851 | - if ($object->detail_refuse) print ' - '.$object->detail_refuse; |
|
1968 | + if ($object->detail_refuse) { |
|
1969 | + print ' - '.$object->detail_refuse; |
|
1970 | + } |
|
1852 | 1971 | print '</td>'; |
1853 | 1972 | print '</tr>'; |
1854 | 1973 | } |
@@ -1888,11 +2007,19 @@ discard block |
||
1888 | 2007 | print '<td class="titlefieldmiddle">'.$langs->trans("AmountHT").'</td>'; |
1889 | 2008 | print '<td class="nowrap amountcard">'.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).'</td>'; |
1890 | 2009 | $rowspan = 5; |
1891 | - if ($object->status <= ExpenseReport::STATUS_VALIDATED) $rowspan++; |
|
1892 | - elseif ($object->status == ExpenseReport::STATUS_CANCELED) $rowspan += 2; |
|
1893 | - else $rowspan += 2; |
|
1894 | - if ($object->status == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) $rowspan += 2; |
|
1895 | - if ($object->status == ExpenseReport::STATUS_CLOSED) $rowspan += 2; |
|
2010 | + if ($object->status <= ExpenseReport::STATUS_VALIDATED) { |
|
2011 | + $rowspan++; |
|
2012 | + } elseif ($object->status == ExpenseReport::STATUS_CANCELED) { |
|
2013 | + $rowspan += 2; |
|
2014 | + } else { |
|
2015 | + $rowspan += 2; |
|
2016 | + } |
|
2017 | + if ($object->status == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) { |
|
2018 | + $rowspan += 2; |
|
2019 | + } |
|
2020 | + if ($object->status == ExpenseReport::STATUS_CLOSED) { |
|
2021 | + $rowspan += 2; |
|
2022 | + } |
|
1896 | 2023 | print "</td>"; |
1897 | 2024 | print '</tr>'; |
1898 | 2025 | |
@@ -1977,8 +2104,9 @@ discard block |
||
1977 | 2104 | } |
1978 | 2105 | |
1979 | 2106 | print '<td class="right">'; |
1980 | - if ($bankaccountstatic->id) |
|
1981 | - print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
2107 | + if ($bankaccountstatic->id) { |
|
2108 | + print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
2109 | + } |
|
1982 | 2110 | print '</td>'; |
1983 | 2111 | } |
1984 | 2112 | print '<td class="right">'.price($objp->amount)."</td>"; |
@@ -2026,7 +2154,9 @@ discard block |
||
2026 | 2154 | print '<div style="clear: both;"></div>'; |
2027 | 2155 | |
2028 | 2156 | $actiontouse = 'updateline'; |
2029 | - if (($object->status == 0 || $object->status == 99) && $action != 'editline') $actiontouse = 'addline'; |
|
2157 | + if (($object->status == 0 || $object->status == 99) && $action != 'editline') { |
|
2158 | + $actiontouse = 'addline'; |
|
2159 | + } |
|
2030 | 2160 | |
2031 | 2161 | print '<form name="expensereport" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" method="post" >'; |
2032 | 2162 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
@@ -2045,9 +2175,13 @@ discard block |
||
2045 | 2175 | print '<td class="center">'.$langs->trans('LineNb').'</td>'; |
2046 | 2176 | //print '<td class="center">'.$langs->trans('Piece').'</td>'; |
2047 | 2177 | print '<td class="center">'.$langs->trans('Date').'</td>'; |
2048 | - if (!empty($conf->projet->enabled)) print '<td class="minwidth100imp">'.$langs->trans('Project').'</td>'; |
|
2178 | + if (!empty($conf->projet->enabled)) { |
|
2179 | + print '<td class="minwidth100imp">'.$langs->trans('Project').'</td>'; |
|
2180 | + } |
|
2049 | 2181 | print '<td class="center">'.$langs->trans('Type').'</td>'; |
2050 | - if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) print '<td>'.$langs->trans('CarCategory').'</td>'; |
|
2182 | + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { |
|
2183 | + print '<td>'.$langs->trans('CarCategory').'</td>'; |
|
2184 | + } |
|
2051 | 2185 | print '<td>'.$langs->trans('Description').'</td>'; |
2052 | 2186 | print '<td class="right">'.$langs->trans('VAT').'</td>'; |
2053 | 2187 | print '<td class="right">'.$langs->trans('PriceUHT').'</td>'; |
@@ -2153,7 +2287,10 @@ discard block |
||
2153 | 2287 | if (image_format_supported($fileinfo['basename']) > 0) |
2154 | 2288 | { |
2155 | 2289 | $minifile = getImageFileNameForSize($fileinfo['basename'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original |
2156 | - if (!dol_is_file($conf->expensereport->dir_output.'/'.$relativepath.'/'.$minifile)) $minifile = getImageFileNameForSize($fileinfo['basename'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension |
|
2290 | + if (!dol_is_file($conf->expensereport->dir_output.'/'.$relativepath.'/'.$minifile)) { |
|
2291 | + $minifile = getImageFileNameForSize($fileinfo['basename'], '_mini', '.png'); |
|
2292 | + } |
|
2293 | + // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension |
|
2157 | 2294 | //print $file['path'].'/'.$minifile.'<br>'; |
2158 | 2295 | $urlforhref = getAdvancedPreviewUrl($modulepart, $relativepath.'/'.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity)); |
2159 | 2296 | if (empty($urlforhref)) { |
@@ -2179,11 +2316,15 @@ discard block |
||
2179 | 2316 | // Conversion du PDF en image png si fichier png non existant |
2180 | 2317 | if (!file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf))) |
2181 | 2318 | { |
2182 | - if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here. |
|
2319 | + if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) { |
|
2320 | + // If you experience trouble with pdf thumb generation and imagick, you can disable here. |
|
2183 | 2321 | { |
2184 | 2322 | include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
2323 | + } |
|
2185 | 2324 | $ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png |
2186 | - if ($ret < 0) $error++; |
|
2325 | + if ($ret < 0) { |
|
2326 | + $error++; |
|
2327 | + } |
|
2187 | 2328 | } |
2188 | 2329 | } |
2189 | 2330 | } |
@@ -2191,7 +2332,9 @@ discard block |
||
2191 | 2332 | if ($pdfexists && !$error) |
2192 | 2333 | { |
2193 | 2334 | $heightforphotref = 70; |
2194 | - if (!empty($conf->dol_optimize_smallscreen)) $heightforphotref = 60; |
|
2335 | + if (!empty($conf->dol_optimize_smallscreen)) { |
|
2336 | + $heightforphotref = 60; |
|
2337 | + } |
|
2195 | 2338 | // If the preview file is found |
2196 | 2339 | if (file_exists($fileimage)) |
2197 | 2340 | { |
@@ -2232,8 +2375,12 @@ discard block |
||
2232 | 2375 | { |
2233 | 2376 | // Add line with link to add new file or attach line to an existing file |
2234 | 2377 | $colspan = 10; |
2235 | - if (!empty($conf->projet->enabled)) $colspan++; |
|
2236 | - if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; |
|
2378 | + if (!empty($conf->projet->enabled)) { |
|
2379 | + $colspan++; |
|
2380 | + } |
|
2381 | + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { |
|
2382 | + $colspan++; |
|
2383 | + } |
|
2237 | 2384 | |
2238 | 2385 | print '<tr class="tredited">'; |
2239 | 2386 | |
@@ -2370,9 +2517,15 @@ discard block |
||
2370 | 2517 | && $user->rights->expensereport->creer) |
2371 | 2518 | { |
2372 | 2519 | $colspan = 11; |
2373 | - if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; |
|
2374 | - if (!empty($conf->projet->enabled)) $colspan++; |
|
2375 | - if ($action != 'editline') $colspan++; |
|
2520 | + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { |
|
2521 | + $colspan++; |
|
2522 | + } |
|
2523 | + if (!empty($conf->projet->enabled)) { |
|
2524 | + $colspan++; |
|
2525 | + } |
|
2526 | + if ($action != 'editline') { |
|
2527 | + $colspan++; |
|
2528 | + } |
|
2376 | 2529 | |
2377 | 2530 | $nbFiles = $nbLinks = 0; |
2378 | 2531 | $arrayoffiles = array(); |
@@ -2485,7 +2638,9 @@ discard block |
||
2485 | 2638 | // Select VAT |
2486 | 2639 | print '<td class="right">'; |
2487 | 2640 | $defaultvat = -1; |
2488 | - if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; |
|
2641 | + if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) { |
|
2642 | + $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; |
|
2643 | + } |
|
2489 | 2644 | print $form->load_tva('vatrate', ($vatrate != '' ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1); |
2490 | 2645 | print '</td>'; |
2491 | 2646 |
@@ -45,17 +45,31 @@ discard block |
||
45 | 45 | // Load Dolibarr environment |
46 | 46 | $res = 0; |
47 | 47 | // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) |
48 | -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
48 | +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { |
|
49 | + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
50 | +} |
|
49 | 51 | // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME |
50 | 52 | $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; |
51 | 53 | while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } |
52 | -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
53 | -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
54 | +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { |
|
55 | + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
56 | +} |
|
57 | +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { |
|
58 | + $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
59 | +} |
|
54 | 60 | // Try main.inc.php using relative path |
55 | -if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php"; |
|
56 | -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; |
|
57 | -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; |
|
58 | -if (!$res) die("Include of main fails"); |
|
61 | +if (!$res && file_exists("../main.inc.php")) { |
|
62 | + $res = @include "../main.inc.php"; |
|
63 | +} |
|
64 | +if (!$res && file_exists("../../main.inc.php")) { |
|
65 | + $res = @include "../../main.inc.php"; |
|
66 | +} |
|
67 | +if (!$res && file_exists("../../../main.inc.php")) { |
|
68 | + $res = @include "../../../main.inc.php"; |
|
69 | +} |
|
70 | +if (!$res) { |
|
71 | + die("Include of main fails"); |
|
72 | +} |
|
59 | 73 | |
60 | 74 | require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
61 | 75 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
@@ -76,8 +90,10 @@ discard block |
||
76 | 90 | |
77 | 91 | if (GETPOST('actioncode', 'array')) { |
78 | 92 | $actioncode = GETPOST('actioncode', 'array', 3); |
79 | - if (!count($actioncode)) $actioncode = '0'; |
|
80 | -} else { |
|
93 | + if (!count($actioncode)) { |
|
94 | + $actioncode = '0'; |
|
95 | + } |
|
96 | + } else { |
|
81 | 97 | $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); |
82 | 98 | } |
83 | 99 | $search_agenda_label = GETPOST('search_agenda_label'); |
@@ -90,8 +106,12 @@ discard block |
||
90 | 106 | $offset = $limit * $page; |
91 | 107 | $pageprev = $page - 1; |
92 | 108 | $pagenext = $page + 1; |
93 | -if (!$sortfield) $sortfield = 'a.datep,a.id'; |
|
94 | -if (!$sortorder) $sortorder = 'DESC,DESC'; |
|
109 | +if (!$sortfield) { |
|
110 | + $sortfield = 'a.datep,a.id'; |
|
111 | +} |
|
112 | +if (!$sortorder) { |
|
113 | + $sortorder = 'DESC,DESC'; |
|
114 | +} |
|
95 | 115 | |
96 | 116 | // Initialize technical objects |
97 | 117 | $object = new MyObject($db); |
@@ -103,7 +123,9 @@ discard block |
||
103 | 123 | |
104 | 124 | // Load object |
105 | 125 | 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 |
106 | -if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id; |
|
126 | +if ($id > 0 || !empty($ref)) { |
|
127 | + $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id; |
|
128 | +} |
|
107 | 129 | |
108 | 130 | // Security check - Protection if external user |
109 | 131 | //if ($user->socid > 0) accessforbidden(); |
@@ -119,7 +141,9 @@ discard block |
||
119 | 141 | |
120 | 142 | $parameters = array('id'=>$id); |
121 | 143 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
122 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
144 | +if ($reshook < 0) { |
|
145 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
146 | +} |
|
123 | 147 | |
124 | 148 | if (empty($reshook)) |
125 | 149 | { |
@@ -131,9 +155,11 @@ discard block |
||
131 | 155 | } |
132 | 156 | |
133 | 157 | // Purge search criteria |
134 | - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
158 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
159 | + // All tests are required to be compatible with all browsers |
|
135 | 160 | { |
136 | 161 | $actioncode = ''; |
162 | + } |
|
137 | 163 | $search_agenda_label = ''; |
138 | 164 | } |
139 | 165 | } |
@@ -153,7 +179,9 @@ discard block |
||
153 | 179 | $help_url = ''; |
154 | 180 | llxHeader('', $title, $help_url); |
155 | 181 | |
156 | - if (!empty($conf->notification->enabled)) $langs->load("mails"); |
|
182 | + if (!empty($conf->notification->enabled)) { |
|
183 | + $langs->load("mails"); |
|
184 | + } |
|
157 | 185 | $head = myobjectPrepareHead($object); |
158 | 186 | |
159 | 187 | |
@@ -230,7 +258,9 @@ discard block |
||
230 | 258 | if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) |
231 | 259 | { |
232 | 260 | //$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'; |
233 | - if (get_class($objthirdparty) == 'Societe') $out .= '&socid='.urlencode($objthirdparty->id); |
|
261 | + if (get_class($objthirdparty) == 'Societe') { |
|
262 | + $out .= '&socid='.urlencode($objthirdparty->id); |
|
263 | + } |
|
234 | 264 | $out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '').'&percentage=-1'; |
235 | 265 | //$out.=$langs->trans("AddAnAction").' '; |
236 | 266 | //$out.=img_picto($langs->trans("AddAnAction"),'filenew'); |
@@ -255,8 +285,12 @@ discard block |
||
255 | 285 | if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) |
256 | 286 | { |
257 | 287 | $param = '&id='.$object->id.'&socid='.$socid; |
258 | - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
259 | - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
288 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
289 | + $param .= '&contextpage='.urlencode($contextpage); |
|
290 | + } |
|
291 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
292 | + $param .= '&limit='.urlencode($limit); |
|
293 | + } |
|
260 | 294 | |
261 | 295 | |
262 | 296 | //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); |
@@ -270,8 +270,9 @@ |
||
270 | 270 | if ($sumpaid < $objp->amount) |
271 | 271 | { |
272 | 272 | $namef = "amount_".$objp->id; |
273 | - if (!empty($conf->use_javascript_ajax)) |
|
274 | - print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".price($objp->amount - $sumpaid)."'"); |
|
273 | + if (!empty($conf->use_javascript_ajax)) { |
|
274 | + print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".price($objp->amount - $sumpaid)."'"); |
|
275 | + } |
|
275 | 276 | print '<input type="text" size="8" name="'.$namef.'">'; |
276 | 277 | } else { |
277 | 278 | print '-'; |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | $langs->loadLangs(array("main"), "categories", "takepos", "printing"); |
36 | 36 | |
37 | -if (!$user->rights->categorie->lire) accessforbidden(); |
|
37 | +if (!$user->rights->categorie->lire) { |
|
38 | + accessforbidden(); |
|
39 | +} |
|
38 | 40 | |
39 | 41 | $id = GETPOST('id', 'int'); |
40 | 42 | $type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT); |
@@ -44,32 +46,41 @@ discard block |
||
44 | 46 | $printer2 = GETPOST('printer2', 'alpha'); |
45 | 47 | $printer3 = GETPOST('printer3', 'alpha'); |
46 | 48 | |
47 | -if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility |
|
49 | +if (is_numeric($type)) { |
|
50 | + $type = Categorie::$MAP_ID_TO_CODE[$type]; |
|
51 | +} |
|
52 | +// For backward compatibility |
|
48 | 53 | |
49 | 54 | /* |
50 | 55 | * Actions |
51 | 56 | */ |
52 | 57 | if ($action == "SavePrinter1") { |
53 | 58 | $printedcategories = ";"; |
54 | - if (is_array($printer1)) foreach ($printer1 as $cat) { |
|
59 | + if (is_array($printer1)) { |
|
60 | + foreach ($printer1 as $cat) { |
|
55 | 61 | $printedcategories = $printedcategories.$cat.";"; |
56 | 62 | } |
63 | + } |
|
57 | 64 | dolibarr_set_const($db, "TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories, 'chaine', 0, '', $conf->entity); |
58 | 65 | } |
59 | 66 | |
60 | 67 | if ($action == "SavePrinter2") { |
61 | 68 | $printedcategories = ";"; |
62 | - if (is_array($printer2)) foreach ($printer2 as $cat) { |
|
69 | + if (is_array($printer2)) { |
|
70 | + foreach ($printer2 as $cat) { |
|
63 | 71 | $printedcategories = $printedcategories.$cat.";"; |
64 | 72 | } |
73 | + } |
|
65 | 74 | dolibarr_set_const($db, "TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories, 'chaine', 0, '', $conf->entity); |
66 | 75 | } |
67 | 76 | |
68 | 77 | if ($action == "SavePrinter3") { |
69 | 78 | $printedcategories = ";"; |
70 | - if (is_array($printer3)) foreach ($printer3 as $cat) { |
|
79 | + if (is_array($printer3)) { |
|
80 | + foreach ($printer3 as $cat) { |
|
71 | 81 | $printedcategories = $printedcategories.$cat.";"; |
72 | 82 | } |
83 | + } |
|
73 | 84 | dolibarr_set_const($db, "TAKEPOS_PRINTED_CATEGORIES_3", $printedcategories, 'chaine', 0, '', $conf->entity); |
74 | 85 | } |
75 | 86 | |
@@ -173,8 +184,14 @@ discard block |
||
173 | 184 | print '<tr class="pair"><td colspan="3">'; |
174 | 185 | print '<input type="hidden" name="action" value="SavePrinter1">'; |
175 | 186 | foreach ($data as $row) { |
176 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) $checked = 'checked'; else $checked = ''; |
|
177 | - if ($row["fk_menu"] == 0) print '<input type="checkbox" name="printer1[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
187 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) { |
|
188 | + $checked = 'checked'; |
|
189 | + } else { |
|
190 | + $checked = ''; |
|
191 | + } |
|
192 | + if ($row["fk_menu"] == 0) { |
|
193 | + print '<input type="checkbox" name="printer1[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
194 | + } |
|
178 | 195 | } |
179 | 196 | print '</td></tr>'; |
180 | 197 | } else { |
@@ -201,8 +218,14 @@ discard block |
||
201 | 218 | print '<tr class="pair"><td colspan="3">'; |
202 | 219 | print '<input type="hidden" name="action" value="SavePrinter2">'; |
203 | 220 | foreach ($data as $row) { |
204 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) $checked = 'checked'; else $checked = ''; |
|
205 | - if ($row["fk_menu"] == 0) print '<input type="checkbox" name="printer2[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
221 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) { |
|
222 | + $checked = 'checked'; |
|
223 | + } else { |
|
224 | + $checked = ''; |
|
225 | + } |
|
226 | + if ($row["fk_menu"] == 0) { |
|
227 | + print '<input type="checkbox" name="printer2[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
228 | + } |
|
206 | 229 | } |
207 | 230 | print '</td></tr>'; |
208 | 231 | } else { |
@@ -227,8 +250,14 @@ discard block |
||
227 | 250 | print '<tr class="pair"><td colspan="3">'; |
228 | 251 | print '<input type="hidden" name="action" value="SavePrinter3">'; |
229 | 252 | foreach ($data as $row) { |
230 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_3, ';'.$row["rowid"].';') !== false) $checked = 'checked'; else $checked = ''; |
|
231 | - if ($row["fk_menu"] == 0) print '<input type="checkbox" name="printer3[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
253 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_3, ';'.$row["rowid"].';') !== false) { |
|
254 | + $checked = 'checked'; |
|
255 | + } else { |
|
256 | + $checked = ''; |
|
257 | + } |
|
258 | + if ($row["fk_menu"] == 0) { |
|
259 | + print '<input type="checkbox" name="printer3[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
260 | + } |
|
232 | 261 | } |
233 | 262 | print '</td></tr>'; |
234 | 263 | } else { |
@@ -23,13 +23,28 @@ discard block |
||
23 | 23 | * \brief File to return Ajax response on product list request |
24 | 24 | */ |
25 | 25 | |
26 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal |
|
27 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
28 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
29 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
30 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
31 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
32 | -if (empty($_GET['keysearch']) && !defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
26 | +if (!defined('NOTOKENRENEWAL')) { |
|
27 | + define('NOTOKENRENEWAL', 1); |
|
28 | +} |
|
29 | +// Disables token renewal |
|
30 | +if (!defined('NOREQUIREMENU')) { |
|
31 | + define('NOREQUIREMENU', '1'); |
|
32 | +} |
|
33 | +if (!defined('NOREQUIREHTML')) { |
|
34 | + define('NOREQUIREHTML', '1'); |
|
35 | +} |
|
36 | +if (!defined('NOREQUIREAJAX')) { |
|
37 | + define('NOREQUIREAJAX', '1'); |
|
38 | +} |
|
39 | +if (!defined('NOREQUIRESOC')) { |
|
40 | + define('NOREQUIRESOC', '1'); |
|
41 | +} |
|
42 | +if (!defined('NOCSRFCHECK')) { |
|
43 | + define('NOCSRFCHECK', '1'); |
|
44 | +} |
|
45 | +if (empty($_GET['keysearch']) && !defined('NOREQUIREHTML')) { |
|
46 | + define('NOREQUIREHTML', '1'); |
|
47 | +} |
|
33 | 48 | |
34 | 49 | require '../../main.inc.php'; |
35 | 50 | |
@@ -49,7 +64,9 @@ discard block |
||
49 | 64 | |
50 | 65 | top_httphead(); |
51 | 66 | |
52 | -if (empty($htmlname) && !GETPOST('mode', 'aZ09')) return; |
|
67 | +if (empty($htmlname) && !GETPOST('mode', 'aZ09')) { |
|
68 | + return; |
|
69 | +} |
|
53 | 70 | |
54 | 71 | // Mode to get list of projects |
55 | 72 | if (!GETPOST('mode', 'aZ09') || GETPOST('mode', 'aZ09') != 'gettasks') { |
@@ -66,10 +66,14 @@ discard block |
||
66 | 66 | $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); |
67 | 67 | if ($fielvalue) |
68 | 68 | { |
69 | - if ($user->socid) $socid = $user->socid; |
|
69 | + if ($user->socid) { |
|
70 | + $socid = $user->socid; |
|
71 | + } |
|
70 | 72 | $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype); |
71 | 73 | } else { |
72 | - if ($user->socid) $socid = $user->socid; |
|
74 | + if ($user->socid) { |
|
75 | + $socid = $user->socid; |
|
76 | + } |
|
73 | 77 | $result = restrictedArea($user, 'banque'); |
74 | 78 | } |
75 | 79 | |
@@ -91,20 +95,28 @@ discard block |
||
91 | 95 | $search_num_releve = GETPOST("search_num_releve", 'alpha'); |
92 | 96 | $search_conciliated = GETPOST("search_conciliated", 'int'); |
93 | 97 | $num_releve = GETPOST("num_releve", "alpha"); |
94 | -if (empty($dateop)) $dateop = -1; |
|
98 | +if (empty($dateop)) { |
|
99 | + $dateop = -1; |
|
100 | +} |
|
95 | 101 | |
96 | 102 | $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
97 | 103 | $sortfield = GETPOST("sortfield", 'alpha'); |
98 | 104 | $sortorder = GETPOST("sortorder", 'alpha'); |
99 | 105 | $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
100 | 106 | $pageplusone = GETPOST("pageplusone", 'int'); |
101 | -if ($pageplusone) $page = $pageplusone - 1; |
|
107 | +if ($pageplusone) { |
|
108 | + $page = $pageplusone - 1; |
|
109 | +} |
|
102 | 110 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
103 | 111 | $offset = $limit * $page; |
104 | 112 | $pageprev = $page - 1; |
105 | 113 | $pagenext = $page + 1; |
106 | -if (!$sortorder) $sortorder = 'desc,desc,desc'; |
|
107 | -if (!$sortfield) $sortfield = 'b.datev,b.dateo,b.rowid'; |
|
114 | +if (!$sortorder) { |
|
115 | + $sortorder = 'desc,desc,desc'; |
|
116 | +} |
|
117 | +if (!$sortfield) { |
|
118 | + $sortfield = 'b.datev,b.dateo,b.rowid'; |
|
119 | +} |
|
108 | 120 | |
109 | 121 | $object = new Account($db); |
110 | 122 | if ($id > 0 || !empty($ref)) |
@@ -125,8 +137,10 @@ discard block |
||
125 | 137 | if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid')) |
126 | 138 | { |
127 | 139 | $sortfield = 'b.datev,b.dateo,b.rowid'; |
128 | - if ($id > 0 || !empty($ref) || $search_account > 0) $mode_balance_ok = true; |
|
129 | -} |
|
140 | + if ($id > 0 || !empty($ref) || $search_account > 0) { |
|
141 | + $mode_balance_ok = true; |
|
142 | + } |
|
143 | + } |
|
130 | 144 | |
131 | 145 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
132 | 146 | $hookmanager->initHooks(array('banktransactionlist', $contextpage)); |
@@ -157,8 +171,9 @@ discard block |
||
157 | 171 | { |
158 | 172 | foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) |
159 | 173 | { |
160 | - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) |
|
161 | - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); |
|
174 | + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { |
|
175 | + $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); |
|
176 | + } |
|
162 | 177 | } |
163 | 178 | } |
164 | 179 | $object->fields = dol_sort_array($object->fields, 'position'); |
@@ -175,13 +190,17 @@ discard block |
||
175 | 190 | |
176 | 191 | $parameters = array(); |
177 | 192 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
178 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
193 | +if ($reshook < 0) { |
|
194 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
195 | +} |
|
179 | 196 | |
180 | 197 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
181 | 198 | |
182 | -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
199 | +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
200 | + // All tests are required to be compatible with all browsers |
|
183 | 201 | { |
184 | 202 | $search_dt_start = ''; |
203 | +} |
|
185 | 204 | $search_dt_end = ''; |
186 | 205 | $search_dv_start = ''; |
187 | 206 | $search_dv_end = ''; |
@@ -198,8 +217,10 @@ discard block |
||
198 | 217 | $thirdparty = ''; |
199 | 218 | |
200 | 219 | $search_account = ""; |
201 | - if ($id > 0 || !empty($ref)) $search_account = $object->id; |
|
202 | -} |
|
220 | + if ($id > 0 || !empty($ref)) { |
|
221 | + $search_account = $object->id; |
|
222 | + } |
|
223 | + } |
|
203 | 224 | |
204 | 225 | if (empty($reshook)) |
205 | 226 | { |
@@ -255,18 +276,42 @@ discard block |
||
255 | 276 | { |
256 | 277 | $param = 'action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id; |
257 | 278 | $param .= '&search_conciliated='.urlencode($search_conciliated); |
258 | - if ($page) $param .= '&page='.urlencode($page); |
|
259 | - if ($offset) $param .= '&offset='.urlencode($offset); |
|
260 | - if ($search_thirdparty) $param .= '&search_thirdparty='.urlencode($search_thirdparty); |
|
261 | - if ($search_num_releve) $param .= '&search_num_releve='.urlencode($search_num_releve); |
|
262 | - if ($search_description) $param .= '&search_description='.urlencode($search_description); |
|
263 | - if ($search_start_dt) $param .= '&search_start_dt='.urlencode($search_start_dt); |
|
264 | - if ($search_end_dt) $param .= '&search_end_dt='.urlencode($search_end_dt); |
|
265 | - if ($search_start_dv) $param .= '&search_start_dv='.urlencode($search_start_dv); |
|
266 | - if ($search_end_dv) $param .= '&search_end_dv='.urlencode($search_end_dv); |
|
267 | - if ($search_type) $param .= '&search_type='.urlencode($search_type); |
|
268 | - if ($search_debit) $param .= '&search_debit='.urlencode($search_debit); |
|
269 | - if ($search_credit) $param .= '&search_credit='.urlencode($search_credit); |
|
279 | + if ($page) { |
|
280 | + $param .= '&page='.urlencode($page); |
|
281 | + } |
|
282 | + if ($offset) { |
|
283 | + $param .= '&offset='.urlencode($offset); |
|
284 | + } |
|
285 | + if ($search_thirdparty) { |
|
286 | + $param .= '&search_thirdparty='.urlencode($search_thirdparty); |
|
287 | + } |
|
288 | + if ($search_num_releve) { |
|
289 | + $param .= '&search_num_releve='.urlencode($search_num_releve); |
|
290 | + } |
|
291 | + if ($search_description) { |
|
292 | + $param .= '&search_description='.urlencode($search_description); |
|
293 | + } |
|
294 | + if ($search_start_dt) { |
|
295 | + $param .= '&search_start_dt='.urlencode($search_start_dt); |
|
296 | + } |
|
297 | + if ($search_end_dt) { |
|
298 | + $param .= '&search_end_dt='.urlencode($search_end_dt); |
|
299 | + } |
|
300 | + if ($search_start_dv) { |
|
301 | + $param .= '&search_start_dv='.urlencode($search_start_dv); |
|
302 | + } |
|
303 | + if ($search_end_dv) { |
|
304 | + $param .= '&search_end_dv='.urlencode($search_end_dv); |
|
305 | + } |
|
306 | + if ($search_type) { |
|
307 | + $param .= '&search_type='.urlencode($search_type); |
|
308 | + } |
|
309 | + if ($search_debit) { |
|
310 | + $param .= '&search_debit='.urlencode($search_debit); |
|
311 | + } |
|
312 | + if ($search_credit) { |
|
313 | + $param .= '&search_credit='.urlencode($search_credit); |
|
314 | + } |
|
270 | 315 | $param .= '&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder); |
271 | 316 | header('Location: '.$_SERVER["PHP_SELF"].'?'.$param); // To avoid to submit twice and allow the back button |
272 | 317 | exit; |
@@ -291,7 +336,9 @@ discard block |
||
291 | 336 | $cat1 = GETPOST("cat1", 'alpha'); |
292 | 337 | |
293 | 338 | $bankaccountid = $id; |
294 | - if (GETPOST('add_account', 'int') > 0) $bankaccountid = GETPOST('add_account', 'int'); |
|
339 | + if (GETPOST('add_account', 'int') > 0) { |
|
340 | + $bankaccountid = GETPOST('add_account', 'int'); |
|
341 | + } |
|
295 | 342 | |
296 | 343 | if (!$dateop) { |
297 | 344 | $error++; |
@@ -384,28 +431,72 @@ discard block |
||
384 | 431 | |
385 | 432 | // Must be before button action |
386 | 433 | $param = ''; |
387 | -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
388 | -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
389 | -if ($id > 0) $param .= '&id='.urlencode($id); |
|
390 | -if (!empty($ref)) $param .= '&ref='.urlencode($ref); |
|
391 | -if (!empty($search_ref)) $param .= '&search_ref='.urlencode($search_ref); |
|
392 | -if (!empty($search_description)) $param .= '&search_description='.urlencode($search_description); |
|
393 | -if (!empty($search_type)) $param .= '&type='.urlencode($search_type); |
|
394 | -if (!empty($search_thirdparty)) $param .= '&search_thirdparty='.urlencode($search_thirdparty); |
|
395 | -if (!empty($search_debit)) $param .= '&search_debit='.urlencode($search_debit); |
|
396 | -if (!empty($search_credit)) $param .= '&search_credit='.urlencode($search_credit); |
|
397 | -if (!empty($search_account)) $param .= '&search_account='.urlencode($search_account); |
|
398 | -if (!empty($search_num_releve)) $param .= '&search_num_releve='.urlencode($search_num_releve); |
|
399 | -if ($search_conciliated != '' && $search_conciliated != '-1') $param .= '&search_conciliated='.urlencode($search_conciliated); |
|
400 | -if ($search_bid > 0) $param .= '&search_bid='.urlencode($search_bid); |
|
401 | -if (dol_strlen($search_dt_start) > 0) $param .= '&search_start_dtmonth='.GETPOST('search_start_dtmonth', 'int').'&search_start_dtday='.GETPOST('search_start_dtday', 'int').'&search_start_dtyear='.GETPOST('search_start_dtyear', 'int'); |
|
402 | -if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth='.GETPOST('search_end_dtmonth', 'int').'&search_end_dtday='.GETPOST('search_end_dtday', 'int').'&search_end_dtyear='.GETPOST('search_end_dtyear', 'int'); |
|
403 | -if (dol_strlen($search_dv_start) > 0) $param .= '&search_start_dvmonth='.GETPOST('search_start_dvmonth', 'int').'&search_start_dvday='.GETPOST('search_start_dvday', 'int').'&search_start_dvyear='.GETPOST('search_start_dvyear', 'int'); |
|
404 | -if (dol_strlen($search_dv_end) > 0) $param .= '&search_end_dvmonth='.GETPOST('search_end_dvmonth', 'int').'&search_end_dvday='.GETPOST('search_end_dvday', 'int').'&search_end_dvyear='.GETPOST('search_end_dvyear', 'int'); |
|
405 | -if ($search_req_nb) $param .= '&req_nb='.urlencode($search_req_nb); |
|
406 | -if (GETPOST("search_thirdparty", 'int')) $param .= '&thirdparty='.urlencode(GETPOST("search_thirdparty", 'int')); |
|
407 | -if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); |
|
408 | -if ($action == 'reconcile') $param .= '&action=reconcile'; |
|
434 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
435 | + $param .= '&contextpage='.urlencode($contextpage); |
|
436 | +} |
|
437 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
438 | + $param .= '&limit='.urlencode($limit); |
|
439 | +} |
|
440 | +if ($id > 0) { |
|
441 | + $param .= '&id='.urlencode($id); |
|
442 | +} |
|
443 | +if (!empty($ref)) { |
|
444 | + $param .= '&ref='.urlencode($ref); |
|
445 | +} |
|
446 | +if (!empty($search_ref)) { |
|
447 | + $param .= '&search_ref='.urlencode($search_ref); |
|
448 | +} |
|
449 | +if (!empty($search_description)) { |
|
450 | + $param .= '&search_description='.urlencode($search_description); |
|
451 | +} |
|
452 | +if (!empty($search_type)) { |
|
453 | + $param .= '&type='.urlencode($search_type); |
|
454 | +} |
|
455 | +if (!empty($search_thirdparty)) { |
|
456 | + $param .= '&search_thirdparty='.urlencode($search_thirdparty); |
|
457 | +} |
|
458 | +if (!empty($search_debit)) { |
|
459 | + $param .= '&search_debit='.urlencode($search_debit); |
|
460 | +} |
|
461 | +if (!empty($search_credit)) { |
|
462 | + $param .= '&search_credit='.urlencode($search_credit); |
|
463 | +} |
|
464 | +if (!empty($search_account)) { |
|
465 | + $param .= '&search_account='.urlencode($search_account); |
|
466 | +} |
|
467 | +if (!empty($search_num_releve)) { |
|
468 | + $param .= '&search_num_releve='.urlencode($search_num_releve); |
|
469 | +} |
|
470 | +if ($search_conciliated != '' && $search_conciliated != '-1') { |
|
471 | + $param .= '&search_conciliated='.urlencode($search_conciliated); |
|
472 | +} |
|
473 | +if ($search_bid > 0) { |
|
474 | + $param .= '&search_bid='.urlencode($search_bid); |
|
475 | +} |
|
476 | +if (dol_strlen($search_dt_start) > 0) { |
|
477 | + $param .= '&search_start_dtmonth='.GETPOST('search_start_dtmonth', 'int').'&search_start_dtday='.GETPOST('search_start_dtday', 'int').'&search_start_dtyear='.GETPOST('search_start_dtyear', 'int'); |
|
478 | +} |
|
479 | +if (dol_strlen($search_dt_end) > 0) { |
|
480 | + $param .= '&search_end_dtmonth='.GETPOST('search_end_dtmonth', 'int').'&search_end_dtday='.GETPOST('search_end_dtday', 'int').'&search_end_dtyear='.GETPOST('search_end_dtyear', 'int'); |
|
481 | +} |
|
482 | +if (dol_strlen($search_dv_start) > 0) { |
|
483 | + $param .= '&search_start_dvmonth='.GETPOST('search_start_dvmonth', 'int').'&search_start_dvday='.GETPOST('search_start_dvday', 'int').'&search_start_dvyear='.GETPOST('search_start_dvyear', 'int'); |
|
484 | +} |
|
485 | +if (dol_strlen($search_dv_end) > 0) { |
|
486 | + $param .= '&search_end_dvmonth='.GETPOST('search_end_dvmonth', 'int').'&search_end_dvday='.GETPOST('search_end_dvday', 'int').'&search_end_dvyear='.GETPOST('search_end_dvyear', 'int'); |
|
487 | +} |
|
488 | +if ($search_req_nb) { |
|
489 | + $param .= '&req_nb='.urlencode($search_req_nb); |
|
490 | +} |
|
491 | +if (GETPOST("search_thirdparty", 'int')) { |
|
492 | + $param .= '&thirdparty='.urlencode(GETPOST("search_thirdparty", 'int')); |
|
493 | +} |
|
494 | +if ($optioncss != '') { |
|
495 | + $param .= '&optioncss='.urlencode($optioncss); |
|
496 | +} |
|
497 | +if ($action == 'reconcile') { |
|
498 | + $param .= '&action=reconcile'; |
|
499 | +} |
|
409 | 500 | // Add $param from extra fields |
410 | 501 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
411 | 502 | |
@@ -468,33 +559,59 @@ discard block |
||
468 | 559 | $sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; |
469 | 560 | // Add fields from extrafields |
470 | 561 | if (!empty($extrafields->attributes[$object->table_element]['label'])) { |
471 | - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
|
472 | -} |
|
562 | + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { |
|
563 | + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
|
564 | + } |
|
565 | + } |
|
473 | 566 | // Add fields from hooks |
474 | 567 | $parameters = array(); |
475 | 568 | $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook |
476 | 569 | $sql .= $hookmanager->resPrint; |
477 | 570 | $sql .= " FROM "; |
478 | -if ($search_bid > 0) $sql .= MAIN_DB_PREFIX."bank_class as l,"; |
|
571 | +if ($search_bid > 0) { |
|
572 | + $sql .= MAIN_DB_PREFIX."bank_class as l,"; |
|
573 | +} |
|
479 | 574 | $sql .= " ".MAIN_DB_PREFIX."bank_account as ba,"; |
480 | 575 | $sql .= " ".MAIN_DB_PREFIX."bank as b"; |
481 | -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)"; |
|
576 | +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { |
|
577 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)"; |
|
578 | +} |
|
482 | 579 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'"; |
483 | 580 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; |
484 | 581 | $sql .= " WHERE b.fk_account = ba.rowid"; |
485 | 582 | $sql .= " AND ba.entity IN (".getEntity('bank_account').")"; |
486 | -if ($search_account > 0) $sql .= " AND b.fk_account = ".$search_account; |
|
583 | +if ($search_account > 0) { |
|
584 | + $sql .= " AND b.fk_account = ".$search_account; |
|
585 | +} |
|
487 | 586 | // Search period criteria |
488 | -if (dol_strlen($search_dt_start) > 0) $sql .= " AND b.dateo >= '".$db->idate($search_dt_start)."'"; |
|
489 | -if (dol_strlen($search_dt_end) > 0) $sql .= " AND b.dateo <= '".$db->idate($search_dt_end)."'"; |
|
587 | +if (dol_strlen($search_dt_start) > 0) { |
|
588 | + $sql .= " AND b.dateo >= '".$db->idate($search_dt_start)."'"; |
|
589 | +} |
|
590 | +if (dol_strlen($search_dt_end) > 0) { |
|
591 | + $sql .= " AND b.dateo <= '".$db->idate($search_dt_end)."'"; |
|
592 | +} |
|
490 | 593 | // Search period criteria |
491 | -if (dol_strlen($search_dv_start) > 0) $sql .= " AND b.datev >= '".$db->idate($search_dv_start)."'"; |
|
492 | -if (dol_strlen($search_dv_end) > 0) $sql .= " AND b.datev <= '".$db->idate($search_dv_end)."'"; |
|
493 | -if ($search_ref) $sql .= natural_search("b.rowid", $search_ref, 1); |
|
494 | -if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb); |
|
495 | -if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve); |
|
496 | -if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".$search_conciliated; |
|
497 | -if ($search_thirdparty) $sql .= natural_search("s.nom", $search_thirdparty); |
|
594 | +if (dol_strlen($search_dv_start) > 0) { |
|
595 | + $sql .= " AND b.datev >= '".$db->idate($search_dv_start)."'"; |
|
596 | +} |
|
597 | +if (dol_strlen($search_dv_end) > 0) { |
|
598 | + $sql .= " AND b.datev <= '".$db->idate($search_dv_end)."'"; |
|
599 | +} |
|
600 | +if ($search_ref) { |
|
601 | + $sql .= natural_search("b.rowid", $search_ref, 1); |
|
602 | +} |
|
603 | +if ($search_req_nb) { |
|
604 | + $sql .= natural_search("b.num_chq", $search_req_nb); |
|
605 | +} |
|
606 | +if ($search_num_releve) { |
|
607 | + $sql .= natural_search("b.num_releve", $search_num_releve); |
|
608 | +} |
|
609 | +if ($search_conciliated != '' && $search_conciliated != '-1') { |
|
610 | + $sql .= " AND b.rappro = ".$search_conciliated; |
|
611 | +} |
|
612 | +if ($search_thirdparty) { |
|
613 | + $sql .= natural_search("s.nom", $search_thirdparty); |
|
614 | +} |
|
498 | 615 | if ($search_description) |
499 | 616 | { |
500 | 617 | $search_description_to_use = $search_description; |
@@ -518,13 +635,21 @@ discard block |
||
518 | 635 | } |
519 | 636 | $sql .= natural_search("b.label", $search_description_to_use); // Warning some text are just translation keys, not translated strings |
520 | 637 | } |
521 | -if ($search_bid > 0) $sql .= " AND b.rowid=l.lineid AND l.fk_categ=".$search_bid; |
|
522 | -if (!empty($search_type)) $sql .= " AND b.fk_type = '".$db->escape($search_type)."' "; |
|
638 | +if ($search_bid > 0) { |
|
639 | + $sql .= " AND b.rowid=l.lineid AND l.fk_categ=".$search_bid; |
|
640 | +} |
|
641 | +if (!empty($search_type)) { |
|
642 | + $sql .= " AND b.fk_type = '".$db->escape($search_type)."' "; |
|
643 | +} |
|
523 | 644 | // Search criteria amount |
524 | 645 | $search_debit = price2num(str_replace('-', '', $search_debit)); |
525 | 646 | $search_credit = price2num(str_replace('-', '', $search_credit)); |
526 | -if ($search_debit) $sql .= natural_search('- b.amount', $search_debit, 1); |
|
527 | -if ($search_credit) $sql .= natural_search('b.amount', $search_credit, 1); |
|
647 | +if ($search_debit) { |
|
648 | + $sql .= natural_search('- b.amount', $search_debit, 1); |
|
649 | +} |
|
650 | +if ($search_credit) { |
|
651 | + $sql .= natural_search('b.amount', $search_credit, 1); |
|
652 | +} |
|
528 | 653 | // Add where from extra fields |
529 | 654 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
530 | 655 | |
@@ -550,28 +675,50 @@ discard block |
||
550 | 675 | // We force on last page. |
551 | 676 | $page = ($nbtotalofpages - 1); |
552 | 677 | $offset = $limit * $page; |
553 | - if ($page < 0) $page = 0; |
|
554 | -} |
|
678 | + if ($page < 0) { |
|
679 | + $page = 0; |
|
680 | + } |
|
681 | + } |
|
555 | 682 | if ($page >= $nbtotalofpages) |
556 | 683 | { |
557 | 684 | // If we made a search and result has low page than the page number we were on |
558 | 685 | $page = ($nbtotalofpages - 1); |
559 | 686 | $offset = $limit * $page; |
560 | - if ($page < 0) $page = 0; |
|
561 | -} |
|
687 | + if ($page < 0) { |
|
688 | + $page = 0; |
|
689 | + } |
|
690 | + } |
|
562 | 691 | |
563 | 692 | |
564 | 693 | // If not account defined $mode_balance_ok=false |
565 | -if (empty($search_account)) $mode_balance_ok = false; |
|
694 | +if (empty($search_account)) { |
|
695 | + $mode_balance_ok = false; |
|
696 | +} |
|
566 | 697 | // If a search is done $mode_balance_ok=false |
567 | -if (!empty($search_ref)) $mode_balance_ok = false; |
|
568 | -if (!empty($search_description)) $mode_balance_ok = false; |
|
569 | -if (!empty($search_type)) $mode_balance_ok = false; |
|
570 | -if (!empty($search_debit)) $mode_balance_ok = false; |
|
571 | -if (!empty($search_credit)) $mode_balance_ok = false; |
|
572 | -if (!empty($search_thirdparty)) $mode_balance_ok = false; |
|
573 | -if ($search_conciliated != '' && $search_conciliated != '-1') $mode_balance_ok = false; |
|
574 | -if (!empty($search_num_releve)) $mode_balance_ok = false; |
|
698 | +if (!empty($search_ref)) { |
|
699 | + $mode_balance_ok = false; |
|
700 | +} |
|
701 | +if (!empty($search_description)) { |
|
702 | + $mode_balance_ok = false; |
|
703 | +} |
|
704 | +if (!empty($search_type)) { |
|
705 | + $mode_balance_ok = false; |
|
706 | +} |
|
707 | +if (!empty($search_debit)) { |
|
708 | + $mode_balance_ok = false; |
|
709 | +} |
|
710 | +if (!empty($search_credit)) { |
|
711 | + $mode_balance_ok = false; |
|
712 | +} |
|
713 | +if (!empty($search_thirdparty)) { |
|
714 | + $mode_balance_ok = false; |
|
715 | +} |
|
716 | +if ($search_conciliated != '' && $search_conciliated != '-1') { |
|
717 | + $mode_balance_ok = false; |
|
718 | +} |
|
719 | +if (!empty($search_num_releve)) { |
|
720 | + $mode_balance_ok = false; |
|
721 | +} |
|
575 | 722 | |
576 | 723 | $sql .= $db->plimit($limit + 1, $offset); |
577 | 724 | //print $sql; |
@@ -589,7 +736,9 @@ discard block |
||
589 | 736 | //'builddoc'=>$langs->trans("PDFMerge"), |
590 | 737 | ); |
591 | 738 | //if ($user->rights->bank->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); |
592 | - if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); |
|
739 | + if (in_array($massaction, array('presend', 'predelete'))) { |
|
740 | + $arrayofmassactions = array(); |
|
741 | + } |
|
593 | 742 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
594 | 743 | |
595 | 744 | // Confirmation delete |
@@ -601,7 +750,9 @@ discard block |
||
601 | 750 | |
602 | 751 | // Lines of title fields |
603 | 752 | print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n"; |
604 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
753 | + if ($optioncss != '') { |
|
754 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
755 | + } |
|
605 | 756 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
606 | 757 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
607 | 758 | print '<input type="hidden" name="action" value="'.($action ? $action : 'search').'">'; |
@@ -611,7 +762,9 @@ discard block |
||
611 | 762 | print '<input type="hidden" name="page" value="'.$page.'">'; |
612 | 763 | print '<input type="hidden" name="id" value="'.$id.'">'; |
613 | 764 | print '<input type="hidden" name="ref" value="'.$ref.'">'; |
614 | - if (GETPOST('bid')) print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">'; |
|
765 | + if (GETPOST('bid')) { |
|
766 | + print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">'; |
|
767 | + } |
|
615 | 768 | |
616 | 769 | // Form to reconcile |
617 | 770 | if ($user->rights->banque->consolidate && $action == 'reconcile') |
@@ -658,9 +811,13 @@ discard block |
||
658 | 811 | $i++; |
659 | 812 | $liste = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$id.'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste; |
660 | 813 | } |
661 | - if ($numr >= $nbmax) $liste = "... ".$liste; |
|
814 | + if ($numr >= $nbmax) { |
|
815 | + $liste = "... ".$liste; |
|
816 | + } |
|
662 | 817 | print $liste; |
663 | - if ($numr <= 0) print '<b>'.$langs->trans("None").'</b>'; |
|
818 | + if ($numr <= 0) { |
|
819 | + print '<b>'.$langs->trans("None").'</b>'; |
|
820 | + } |
|
664 | 821 | } else { |
665 | 822 | dol_print_error($db); |
666 | 823 | } |
@@ -774,9 +931,11 @@ discard block |
||
774 | 931 | { |
775 | 932 | if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) |
776 | 933 | { |
777 | - if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // Default is to record miscellaneous direct entries using miscellaneous payments |
|
934 | + if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { |
|
935 | + // Default is to record miscellaneous direct entries using miscellaneous payments |
|
778 | 936 | { |
779 | 937 | $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); |
938 | + } |
|
780 | 939 | } else // If direct entries is not done using miscellaneous payments |
781 | 940 | { |
782 | 941 | $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier); |
@@ -801,12 +960,16 @@ discard block |
||
801 | 960 | $morehtml .= '<!-- Add New button -->'.$newcardbutton; |
802 | 961 | |
803 | 962 | $picto = 'bank_account'; |
804 | - if ($id > 0 || !empty($ref)) $picto = ''; |
|
963 | + if ($id > 0 || !empty($ref)) { |
|
964 | + $picto = ''; |
|
965 | + } |
|
805 | 966 | |
806 | 967 | print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); |
807 | 968 | |
808 | 969 | // We can add page now to param |
809 | - if ($page != '') $param .= '&page='.urlencode($page); |
|
970 | + if ($page != '') { |
|
971 | + $param .= '&page='.urlencode($page); |
|
972 | + } |
|
810 | 973 | |
811 | 974 | $moreforfilter = ''; |
812 | 975 | |
@@ -846,8 +1009,11 @@ discard block |
||
846 | 1009 | |
847 | 1010 | $parameters = array(); |
848 | 1011 | $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook |
849 | - if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; |
|
850 | - else $moreforfilter = $hookmanager->resPrint; |
|
1012 | + if (empty($reshook)) { |
|
1013 | + $moreforfilter .= $hookmanager->resPrint; |
|
1014 | + } else { |
|
1015 | + $moreforfilter = $hookmanager->resPrint; |
|
1016 | + } |
|
851 | 1017 | |
852 | 1018 | if ($moreforfilter) |
853 | 1019 | { |
@@ -953,20 +1119,48 @@ discard block |
||
953 | 1119 | |
954 | 1120 | // Fields title |
955 | 1121 | print '<tr class="liste_titre">'; |
956 | - if (!empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder); |
|
957 | - if (!empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER['PHP_SELF'], 'b.label', '', $param, '', $sortfield, $sortorder); |
|
958 | - if (!empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '', $sortfield, $sortorder, "center "); |
|
959 | - if (!empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, 'align="center"', $sortfield, $sortorder); |
|
960 | - if (!empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder); |
|
961 | - if (!empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, '', $sortfield, $sortorder, "center "); |
|
962 | - if (!empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder); |
|
963 | - if (!empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder); |
|
964 | - if (!empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right "); |
|
965 | - if (!empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right "); |
|
966 | - if (!empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right "); |
|
967 | - if (!empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right "); |
|
968 | - if (!empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'], $_SERVER['PHP_SELF'], 'b.num_releve', '', $param, '', $sortfield, $sortorder, "center "); |
|
969 | - if (!empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center "); |
|
1122 | + if (!empty($arrayfields['b.rowid']['checked'])) { |
|
1123 | + print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder); |
|
1124 | + } |
|
1125 | + if (!empty($arrayfields['b.label']['checked'])) { |
|
1126 | + print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER['PHP_SELF'], 'b.label', '', $param, '', $sortfield, $sortorder); |
|
1127 | + } |
|
1128 | + if (!empty($arrayfields['b.dateo']['checked'])) { |
|
1129 | + print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '', $sortfield, $sortorder, "center "); |
|
1130 | + } |
|
1131 | + if (!empty($arrayfields['b.datev']['checked'])) { |
|
1132 | + print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, 'align="center"', $sortfield, $sortorder); |
|
1133 | + } |
|
1134 | + if (!empty($arrayfields['type']['checked'])) { |
|
1135 | + print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder); |
|
1136 | + } |
|
1137 | + if (!empty($arrayfields['b.num_chq']['checked'])) { |
|
1138 | + print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, '', $sortfield, $sortorder, "center "); |
|
1139 | + } |
|
1140 | + if (!empty($arrayfields['bu.label']['checked'])) { |
|
1141 | + print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder); |
|
1142 | + } |
|
1143 | + if (!empty($arrayfields['ba.ref']['checked'])) { |
|
1144 | + print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder); |
|
1145 | + } |
|
1146 | + if (!empty($arrayfields['b.debit']['checked'])) { |
|
1147 | + print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right "); |
|
1148 | + } |
|
1149 | + if (!empty($arrayfields['b.credit']['checked'])) { |
|
1150 | + print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right "); |
|
1151 | + } |
|
1152 | + if (!empty($arrayfields['balancebefore']['checked'])) { |
|
1153 | + print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right "); |
|
1154 | + } |
|
1155 | + if (!empty($arrayfields['balance']['checked'])) { |
|
1156 | + print_liste_field_titre($arrayfields['balance']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right "); |
|
1157 | + } |
|
1158 | + if (!empty($arrayfields['b.num_releve']['checked'])) { |
|
1159 | + print_liste_field_titre($arrayfields['b.num_releve']['label'], $_SERVER['PHP_SELF'], 'b.num_releve', '', $param, '', $sortfield, $sortorder, "center "); |
|
1160 | + } |
|
1161 | + if (!empty($arrayfields['b.conciliated']['checked'])) { |
|
1162 | + print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center "); |
|
1163 | + } |
|
970 | 1164 | // Extra fields |
971 | 1165 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
972 | 1166 | // Hook fields |
@@ -1027,7 +1221,9 @@ discard block |
||
1027 | 1221 | $balance = $objforbalance->previoustotal; |
1028 | 1222 | } |
1029 | 1223 | } |
1030 | - } else dol_print_error($db); |
|
1224 | + } else { |
|
1225 | + dol_print_error($db); |
|
1226 | + } |
|
1031 | 1227 | |
1032 | 1228 | $balancecalculated = true; |
1033 | 1229 | |
@@ -1046,8 +1242,11 @@ discard block |
||
1046 | 1242 | } |
1047 | 1243 | if (!empty($arrayfields[$key]['checked'])) |
1048 | 1244 | { |
1049 | - if (!$balancefieldfound) $tmpnbfieldbeforebalance++; |
|
1050 | - else $tmpnbfieldafterbalance++; |
|
1245 | + if (!$balancefieldfound) { |
|
1246 | + $tmpnbfieldbeforebalance++; |
|
1247 | + } else { |
|
1248 | + $tmpnbfieldafterbalance++; |
|
1249 | + } |
|
1051 | 1250 | } |
1052 | 1251 | } |
1053 | 1252 | // Extra fields |
@@ -1060,8 +1259,11 @@ discard block |
||
1060 | 1259 | { |
1061 | 1260 | if (!empty($arrayfields[$key]['checked'])) |
1062 | 1261 | { |
1063 | - if (!$balancefieldfound) $tmpnbfieldbeforebalance++; |
|
1064 | - else $tmpnbfieldafterbalance++; |
|
1262 | + if (!$balancefieldfound) { |
|
1263 | + $tmpnbfieldbeforebalance++; |
|
1264 | + } else { |
|
1265 | + $tmpnbfieldafterbalance++; |
|
1266 | + } |
|
1065 | 1267 | } |
1066 | 1268 | } |
1067 | 1269 | } |
@@ -1155,7 +1357,9 @@ discard block |
||
1155 | 1357 | print '<td class="nowrap left">'; |
1156 | 1358 | print $banklinestatic->getNomUrl(1); |
1157 | 1359 | print '</td>'; |
1158 | - if (!$i) $totalarray['nbfield']++; |
|
1360 | + if (!$i) { |
|
1361 | + $totalarray['nbfield']++; |
|
1362 | + } |
|
1159 | 1363 | } |
1160 | 1364 | |
1161 | 1365 | // Description |
@@ -1166,8 +1370,9 @@ discard block |
||
1166 | 1370 | //print "<a href=\"line.php?rowid=".$objp->rowid."&account=".$objp->fk_account."\">"; |
1167 | 1371 | $reg = array(); |
1168 | 1372 | preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction |
1169 | - if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) print $langs->trans($reg[1]); |
|
1170 | - else { |
|
1373 | + if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) { |
|
1374 | + print $langs->trans($reg[1]); |
|
1375 | + } else { |
|
1171 | 1376 | if ($objp->label == '(payment_salary)') { |
1172 | 1377 | print dol_trunc($langs->trans("SalaryPayment", 40)); |
1173 | 1378 | } else { |
@@ -1271,12 +1476,16 @@ discard block |
||
1271 | 1476 | { |
1272 | 1477 | } else { |
1273 | 1478 | // Show link with label $links[$key]['label'] |
1274 | - if (!empty($objp->label) && !empty($links[$key]['label'])) print ' - '; |
|
1479 | + if (!empty($objp->label) && !empty($links[$key]['label'])) { |
|
1480 | + print ' - '; |
|
1481 | + } |
|
1275 | 1482 | print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; |
1276 | 1483 | if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) |
1277 | 1484 | { |
1278 | 1485 | // Label generique car entre parentheses. On l'affiche en le traduisant |
1279 | - if ($reg[1] == 'paiement') $reg[1] = 'Payment'; |
|
1486 | + if ($reg[1] == 'paiement') { |
|
1487 | + $reg[1] = 'Payment'; |
|
1488 | + } |
|
1280 | 1489 | print ' '.$langs->trans($reg[1]); |
1281 | 1490 | } else { |
1282 | 1491 | print ' '.$links[$key]['label']; |
@@ -1285,7 +1494,9 @@ discard block |
||
1285 | 1494 | } |
1286 | 1495 | } |
1287 | 1496 | print '</td>'; |
1288 | - if (!$i) $totalarray['nbfield']++; |
|
1497 | + if (!$i) { |
|
1498 | + $totalarray['nbfield']++; |
|
1499 | + } |
|
1289 | 1500 | } |
1290 | 1501 | |
1291 | 1502 | // Date ope |
@@ -1301,7 +1512,9 @@ discard block |
||
1301 | 1512 | print img_edit_add()."</a>"; |
1302 | 1513 | print '</span>'; |
1303 | 1514 | print "</td>\n"; |
1304 | - if (!$i) $totalarray['nbfield']++; |
|
1515 | + if (!$i) { |
|
1516 | + $totalarray['nbfield']++; |
|
1517 | + } |
|
1305 | 1518 | } |
1306 | 1519 | |
1307 | 1520 | // Date value |
@@ -1317,7 +1530,9 @@ discard block |
||
1317 | 1530 | print img_edit_add()."</a>"; |
1318 | 1531 | print '</span>'; |
1319 | 1532 | print "</td>\n"; |
1320 | - if (!$i) $totalarray['nbfield']++; |
|
1533 | + if (!$i) { |
|
1534 | + $totalarray['nbfield']++; |
|
1535 | + } |
|
1321 | 1536 | } |
1322 | 1537 | |
1323 | 1538 | // Payment type |
@@ -1325,17 +1540,26 @@ discard block |
||
1325 | 1540 | { |
1326 | 1541 | print '<td align="center" class="nowrap">'; |
1327 | 1542 | $labeltype = ($langs->trans("PaymentTypeShort".$objp->fk_type) != "PaymentTypeShort".$objp->fk_type) ? $langs->trans("PaymentTypeShort".$objp->fk_type) : $langs->getLabelFromKey($db, $objp->fk_type, 'c_paiement', 'code', 'libelle', '', 1); |
1328 | - if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance"); |
|
1329 | - else print $labeltype; |
|
1543 | + if ($labeltype == 'SOLD') { |
|
1544 | + print ' '; |
|
1545 | + } |
|
1546 | + //$langs->trans("InitialBankBalance"); |
|
1547 | + else { |
|
1548 | + print $labeltype; |
|
1549 | + } |
|
1330 | 1550 | print "</td>\n"; |
1331 | - if (!$i) $totalarray['nbfield']++; |
|
1551 | + if (!$i) { |
|
1552 | + $totalarray['nbfield']++; |
|
1553 | + } |
|
1332 | 1554 | } |
1333 | 1555 | |
1334 | 1556 | // Num cheque |
1335 | 1557 | if (!empty($arrayfields['b.num_chq']['checked'])) |
1336 | 1558 | { |
1337 | 1559 | print '<td class="nowrap" align="center">'.($objp->num_chq ? $objp->num_chq : "")."</td>\n"; |
1338 | - if (!$i) $totalarray['nbfield']++; |
|
1560 | + if (!$i) { |
|
1561 | + $totalarray['nbfield']++; |
|
1562 | + } |
|
1339 | 1563 | } |
1340 | 1564 | |
1341 | 1565 | // Third party |
@@ -1359,7 +1583,9 @@ discard block |
||
1359 | 1583 | print ' '; |
1360 | 1584 | } |
1361 | 1585 | print '</td>'; |
1362 | - if (!$i) $totalarray['nbfield']++; |
|
1586 | + if (!$i) { |
|
1587 | + $totalarray['nbfield']++; |
|
1588 | + } |
|
1363 | 1589 | } |
1364 | 1590 | |
1365 | 1591 | // Bank account |
@@ -1368,7 +1594,9 @@ discard block |
||
1368 | 1594 | print '<td class="nowrap">'; |
1369 | 1595 | print $bankaccount->getNomUrl(1); |
1370 | 1596 | print "</td>\n"; |
1371 | - if (!$i) $totalarray['nbfield']++; |
|
1597 | + if (!$i) { |
|
1598 | + $totalarray['nbfield']++; |
|
1599 | + } |
|
1372 | 1600 | } |
1373 | 1601 | |
1374 | 1602 | // Debit |
@@ -1381,8 +1609,12 @@ discard block |
||
1381 | 1609 | $totalarray['totaldeb'] += $objp->amount; |
1382 | 1610 | } |
1383 | 1611 | print "</td>\n"; |
1384 | - if (!$i) $totalarray['nbfield']++; |
|
1385 | - if (!$i) $totalarray['totaldebfield'] = $totalarray['nbfield']; |
|
1612 | + if (!$i) { |
|
1613 | + $totalarray['nbfield']++; |
|
1614 | + } |
|
1615 | + if (!$i) { |
|
1616 | + $totalarray['totaldebfield'] = $totalarray['nbfield']; |
|
1617 | + } |
|
1386 | 1618 | } |
1387 | 1619 | |
1388 | 1620 | // Credit |
@@ -1395,8 +1627,12 @@ discard block |
||
1395 | 1627 | $totalarray['totalcred'] += $objp->amount; |
1396 | 1628 | } |
1397 | 1629 | print "</td>\n"; |
1398 | - if (!$i) $totalarray['nbfield']++; |
|
1399 | - if (!$i) $totalarray['totalcredfield'] = $totalarray['nbfield']; |
|
1630 | + if (!$i) { |
|
1631 | + $totalarray['nbfield']++; |
|
1632 | + } |
|
1633 | + if (!$i) { |
|
1634 | + $totalarray['totalcredfield'] = $totalarray['nbfield']; |
|
1635 | + } |
|
1400 | 1636 | } |
1401 | 1637 | |
1402 | 1638 | // Balance before |
@@ -1413,7 +1649,9 @@ discard block |
||
1413 | 1649 | } else { |
1414 | 1650 | print '<td class="right">-</td>'; |
1415 | 1651 | } |
1416 | - if (!$i) $totalarray['nbfield']++; |
|
1652 | + if (!$i) { |
|
1653 | + $totalarray['nbfield']++; |
|
1654 | + } |
|
1417 | 1655 | } |
1418 | 1656 | // Balance |
1419 | 1657 | if (!empty($arrayfields['balance']['checked'])) |
@@ -1429,7 +1667,9 @@ discard block |
||
1429 | 1667 | } else { |
1430 | 1668 | print '<td class="right">-</td>'; |
1431 | 1669 | } |
1432 | - if (!$i) $totalarray['nbfield']++; |
|
1670 | + if (!$i) { |
|
1671 | + $totalarray['nbfield']++; |
|
1672 | + } |
|
1433 | 1673 | } |
1434 | 1674 | |
1435 | 1675 | if (!empty($arrayfields['b.num_releve']['checked'])) |
@@ -1444,7 +1684,9 @@ discard block |
||
1444 | 1684 | } |
1445 | 1685 | if (!$objp->conciliated && $action == 'reconcile') |
1446 | 1686 | { |
1447 | - if ($objp->num_releve) print ' '; |
|
1687 | + if ($objp->num_releve) { |
|
1688 | + print ' '; |
|
1689 | + } |
|
1448 | 1690 | print '<input class="flat" name="rowid['.$objp->rowid.']" type="checkbox" value="'.$objp->rowid.'" size="1"'.(!empty($_POST['rowid'][$objp->rowid]) ? ' checked' : '').'>'; |
1449 | 1691 | } |
1450 | 1692 | } |
@@ -1461,15 +1703,19 @@ discard block |
||
1461 | 1703 | print '<td class="nowraponall" align="center">'; |
1462 | 1704 | print $objp->conciliated ? $langs->trans("Yes") : $langs->trans("No"); |
1463 | 1705 | print '</td>'; |
1464 | - if (!$i) $totalarray['nbfield']++; |
|
1706 | + if (!$i) { |
|
1707 | + $totalarray['nbfield']++; |
|
1708 | + } |
|
1465 | 1709 | } |
1466 | 1710 | |
1467 | 1711 | // Action edit/delete |
1468 | 1712 | print '<td class="nowraponall" align="center">'; |
1469 | 1713 | // Transaction reconciliated or edit link |
1470 | - if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated |
|
1714 | + if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { |
|
1715 | + // If line not conciliated and account can be conciliated |
|
1471 | 1716 | { |
1472 | 1717 | print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">'; |
1718 | + } |
|
1473 | 1719 | print img_edit(); |
1474 | 1720 | print '</a>'; |
1475 | 1721 | } else { |
@@ -1498,18 +1744,26 @@ discard block |
||
1498 | 1744 | } |
1499 | 1745 | } |
1500 | 1746 | print '</td>'; |
1501 | - if (!$i) $totalarray['nbfield']++; |
|
1747 | + if (!$i) { |
|
1748 | + $totalarray['nbfield']++; |
|
1749 | + } |
|
1502 | 1750 | |
1503 | 1751 | // Action column |
1504 | 1752 | print '<td class="nowrap" align="center">'; |
1505 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
1753 | + if ($massactionbutton || $massaction) { |
|
1754 | + // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
1506 | 1755 | { |
1507 | 1756 | $selected = 0; |
1508 | - if (in_array($obj->rowid, $arrayofselected)) $selected = 1; |
|
1757 | + } |
|
1758 | + if (in_array($obj->rowid, $arrayofselected)) { |
|
1759 | + $selected = 1; |
|
1760 | + } |
|
1509 | 1761 | print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; |
1510 | 1762 | } |
1511 | 1763 | print '</td>'; |
1512 | - if (!$i) $totalarray['nbfield']++; |
|
1764 | + if (!$i) { |
|
1765 | + $totalarray['nbfield']++; |
|
1766 | + } |
|
1513 | 1767 | |
1514 | 1768 | print "</tr>"; |
1515 | 1769 | |
@@ -1526,16 +1780,25 @@ discard block |
||
1526 | 1780 | $i++; |
1527 | 1781 | if ($i == 1) |
1528 | 1782 | { |
1529 | - if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>'; |
|
1530 | - else print '<td class="left tdoverflowmax50" title="'.$langs->trans("Totalforthispage").'">'.$langs->trans("Totalforthispage").'</td>'; |
|
1531 | - } elseif ($totalarray['totaldebfield'] == $i) print '<td class="right">'.price(-1 * $totalarray['totaldeb']).'</td>'; |
|
1532 | - elseif ($totalarray['totalcredfield'] == $i) print '<td class="right">'.price($totalarray['totalcred']).'</td>'; |
|
1533 | - elseif ($i == $posconciliatecol) |
|
1783 | + if ($num < $limit && empty($offset)) { |
|
1784 | + print '<td class="left">'.$langs->trans("Total").'</td>'; |
|
1785 | + } else { |
|
1786 | + print '<td class="left tdoverflowmax50" title="'.$langs->trans("Totalforthispage").'">'.$langs->trans("Totalforthispage").'</td>'; |
|
1787 | + } |
|
1788 | + } elseif ($totalarray['totaldebfield'] == $i) { |
|
1789 | + print '<td class="right">'.price(-1 * $totalarray['totaldeb']).'</td>'; |
|
1790 | + } elseif ($totalarray['totalcredfield'] == $i) { |
|
1791 | + print '<td class="right">'.price($totalarray['totalcred']).'</td>'; |
|
1792 | + } elseif ($i == $posconciliatecol) |
|
1534 | 1793 | { |
1535 | 1794 | print '<td class="center">'; |
1536 | - if ($user->rights->banque->consolidate && $action == 'reconcile') print '<input class="button" name="confirm_reconcile" type="submit" value="'.$langs->trans("Conciliate").'">'; |
|
1795 | + if ($user->rights->banque->consolidate && $action == 'reconcile') { |
|
1796 | + print '<input class="button" name="confirm_reconcile" type="submit" value="'.$langs->trans("Conciliate").'">'; |
|
1797 | + } |
|
1537 | 1798 | print '</td>'; |
1538 | - } else print '<td></td>'; |
|
1799 | + } else { |
|
1800 | + print '<td></td>'; |
|
1801 | + } |
|
1539 | 1802 | } |
1540 | 1803 | print '</tr>'; |
1541 | 1804 | } |
@@ -1544,7 +1807,10 @@ discard block |
||
1544 | 1807 | if ($num == 0) |
1545 | 1808 | { |
1546 | 1809 | $colspan = 1; |
1547 | - foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } |
|
1810 | + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { |
|
1811 | + $colspan++; |
|
1812 | + } |
|
1813 | + } |
|
1548 | 1814 | print '<tr><td colspan="'.($colspan + 1).'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
1549 | 1815 | } |
1550 | 1816 |
@@ -63,10 +63,14 @@ discard block |
||
63 | 63 | $search = array(); |
64 | 64 | foreach ($object->fields as $key => $val) |
65 | 65 | { |
66 | - if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
67 | -} |
|
66 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
67 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
68 | + } |
|
69 | + } |
|
68 | 70 | |
69 | -if (empty($action) && empty($id) && empty($ref)) $action = 'view'; |
|
71 | +if (empty($action) && empty($id) && empty($ref)) { |
|
72 | + $action = 'view'; |
|
73 | +} |
|
70 | 74 | |
71 | 75 | // Load object |
72 | 76 | include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
@@ -103,7 +107,9 @@ discard block |
||
103 | 107 | |
104 | 108 | $parameters = array(); |
105 | 109 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
106 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
110 | +if ($reshook < 0) { |
|
111 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
112 | +} |
|
107 | 113 | |
108 | 114 | if (empty($reshook)) |
109 | 115 | { |
@@ -113,8 +119,11 @@ discard block |
||
113 | 119 | |
114 | 120 | if (empty($backtopage) || ($cancel && empty($id))) { |
115 | 121 | if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { |
116 | - if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; |
|
117 | - else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__'); |
|
122 | + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
|
123 | + $backtopage = $backurlforlist; |
|
124 | + } else { |
|
125 | + $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__'); |
|
126 | + } |
|
118 | 127 | } |
119 | 128 | } |
120 | 129 | if ($cancel && !empty($backtopageforcancel)) { |
@@ -161,8 +170,12 @@ discard block |
||
161 | 170 | { |
162 | 171 | $outputlangs = $langs; |
163 | 172 | $newlang = ''; |
164 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
165 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
173 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { |
|
174 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
175 | + } |
|
176 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
177 | + $newlang = $object->thirdparty->default_lang; |
|
178 | + } |
|
166 | 179 | if (!empty($newlang)) { |
167 | 180 | $outputlangs = new Translate("", $conf); |
168 | 181 | $outputlangs->setDefaultLang($newlang); |
@@ -215,8 +228,12 @@ discard block |
||
215 | 228 | print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
216 | 229 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
217 | 230 | print '<input type="hidden" name="action" value="add">'; |
218 | - if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
219 | - if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
231 | + if ($backtopage) { |
|
232 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
233 | + } |
|
234 | + if ($backtopageforcancel) { |
|
235 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
236 | + } |
|
220 | 237 | |
221 | 238 | print dol_get_fiche_head(array(), ''); |
222 | 239 | |
@@ -320,8 +337,12 @@ discard block |
||
320 | 337 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
321 | 338 | print '<input type="hidden" name="action" value="update">'; |
322 | 339 | print '<input type="hidden" name="id" value="'.$object->id.'">'; |
323 | - if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
324 | - if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
340 | + if ($backtopage) { |
|
341 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
342 | + } |
|
343 | + if ($backtopageforcancel) { |
|
344 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
345 | + } |
|
325 | 346 | |
326 | 347 | print dol_get_fiche_head(); |
327 | 348 | |
@@ -396,7 +417,10 @@ discard block |
||
396 | 417 | require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; |
397 | 418 | $formproduct = new FormProduct($db); |
398 | 419 | $forcecombo = 0; |
399 | - if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy |
|
420 | + if ($conf->browser->name == 'ie') { |
|
421 | + $forcecombo = 1; |
|
422 | + } |
|
423 | + // There is a bug in IE10 that make combo inside popup crazy |
|
400 | 424 | $formquestion = array( |
401 | 425 | // 'text' => $langs->trans("ConfirmClone"), |
402 | 426 | // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), |
@@ -417,8 +441,11 @@ discard block |
||
417 | 441 | // Call Hook formConfirm |
418 | 442 | $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); |
419 | 443 | $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
420 | - if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; |
|
421 | - elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; |
|
444 | + if (empty($reshook)) { |
|
445 | + $formconfirm .= $hookmanager->resPrint; |
|
446 | + } elseif ($reshook > 0) { |
|
447 | + $formconfirm = $hookmanager->resPrint; |
|
448 | + } |
|
422 | 449 | |
423 | 450 | // Print form confirm |
424 | 451 | print $formconfirm; |
@@ -443,8 +470,9 @@ discard block |
||
443 | 470 | $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
444 | 471 | if ($permissiontoadd) |
445 | 472 | { |
446 | - if ($action != 'classify') |
|
447 | - $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
473 | + if ($action != 'classify') { |
|
474 | + $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
475 | + } |
|
448 | 476 | if ($action == 'classify') { |
449 | 477 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_soc, $object->fk_project, 'projectid', 0, 0, 1, 1); |
450 | 478 | $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
@@ -534,7 +562,9 @@ discard block |
||
534 | 562 | $i = 0; |
535 | 563 | foreach ($object->lines as $line) { |
536 | 564 | if ($line->role == 'toconsume') { |
537 | - if ($i) print ', '; |
|
565 | + if ($i) { |
|
566 | + print ', '; |
|
567 | + } |
|
538 | 568 | $tmpproduct = new Product($db); |
539 | 569 | $tmpproduct->fetch($line->fk_product); |
540 | 570 | print $tmpproduct->getNomUrl(1); |
@@ -553,7 +583,9 @@ discard block |
||
553 | 583 | $i = 0; |
554 | 584 | foreach ($object->lines as $line) { |
555 | 585 | if ($line->role == 'toproduce') { |
556 | - if ($i) print ', '; |
|
586 | + if ($i) { |
|
587 | + print ', '; |
|
588 | + } |
|
557 | 589 | $tmpproduct = new Product($db); |
558 | 590 | $tmpproduct->fetch($line->fk_product); |
559 | 591 | print $tmpproduct->getNomUrl(1); |
@@ -578,7 +610,9 @@ discard block |
||
578 | 610 | print '<div class="tabsAction">'."\n"; |
579 | 611 | $parameters = array(); |
580 | 612 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
581 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
613 | + if ($reshook < 0) { |
|
614 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
615 | + } |
|
582 | 616 | |
583 | 617 | if (empty($reshook)) |
584 | 618 | { |
@@ -706,7 +740,9 @@ discard block |
||
706 | 740 | } |
707 | 741 | |
708 | 742 | //Select mail models is same action as presend |
709 | - if (GETPOST('modelselected')) $action = 'presend'; |
|
743 | + if (GETPOST('modelselected')) { |
|
744 | + $action = 'presend'; |
|
745 | + } |
|
710 | 746 | |
711 | 747 | // Presend form |
712 | 748 | $modelmail = 'mo'; |