@@ -75,10 +75,14 @@ |
||
75 | 75 | $permissiontoadd = $user->rights->asset->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php |
76 | 76 | |
77 | 77 | // Security check (enable the most restrictive one) |
78 | -if ($user->socid > 0) accessforbidden(); |
|
78 | +if ($user->socid > 0) { |
|
79 | + accessforbidden(); |
|
80 | +} |
|
79 | 81 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
80 | 82 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
81 | -if (!isModEnabled('asset')) accessforbidden(); |
|
83 | +if (!isModEnabled('asset')) { |
|
84 | + accessforbidden(); |
|
85 | +} |
|
82 | 86 | |
83 | 87 | |
84 | 88 | /* |
@@ -100,7 +100,9 @@ |
||
100 | 100 | * View |
101 | 101 | */ |
102 | 102 | |
103 | -if (isModEnabled('project')) $formproject = new FormProjets($db); |
|
103 | +if (isModEnabled('project')) { |
|
104 | + $formproject = new FormProjets($db); |
|
105 | +} |
|
104 | 106 | |
105 | 107 | $title = $langs->trans('Salary')." - ".$langs->trans('Info'); |
106 | 108 | $help_url = ""; |
@@ -132,7 +132,9 @@ |
||
132 | 132 | */ |
133 | 133 | |
134 | 134 | $form = new Form($db); |
135 | -if (isModEnabled('project')) $formproject = new FormProjets($db); |
|
135 | +if (isModEnabled('project')) { |
|
136 | + $formproject = new FormProjets($db); |
|
137 | +} |
|
136 | 138 | |
137 | 139 | $title = $langs->trans('Salary')." - ".$langs->trans('Documents'); |
138 | 140 | $help_url = ""; |
@@ -48,8 +48,12 @@ discard block |
||
48 | 48 | $offset = $limit * $page; |
49 | 49 | $pageprev = $page - 1; |
50 | 50 | $pagenext = $page + 1; |
51 | -if (!$sortorder) $sortorder = "ASC"; |
|
52 | -if (!$sortfield) $sortfield = "name"; |
|
51 | +if (!$sortorder) { |
|
52 | + $sortorder = "ASC"; |
|
53 | +} |
|
54 | +if (!$sortfield) { |
|
55 | + $sortfield = "name"; |
|
56 | +} |
|
53 | 57 | //if (! $sortfield) $sortfield="position_name"; |
54 | 58 | |
55 | 59 | // Initialize technical objects |
@@ -64,7 +68,9 @@ discard block |
||
64 | 68 | 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 |
65 | 69 | |
66 | 70 | //if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity?$object->entity:$conf->entity] . "/stocktransfer/" . dol_sanitizeFileName($object->id); |
67 | -if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity ? $object->entity : $conf->entity]."/stocktransfer/".dol_sanitizeFileName($object->ref); |
|
71 | +if ($id > 0 || !empty($ref)) { |
|
72 | + $upload_dir = $conf->stocktransfer->multidir_output[$object->entity ? $object->entity : $conf->entity]."/stocktransfer/".dol_sanitizeFileName($object->ref); |
|
73 | +} |
|
68 | 74 | |
69 | 75 | // Security check - Protection if external user |
70 | 76 | //if ($user->socid > 0) accessforbidden(); |
@@ -898,8 +898,12 @@ discard block |
||
898 | 898 | print dol_get_fiche_head(null, '', '', 0); |
899 | 899 | |
900 | 900 | $rowspan = 4; |
901 | - if (isModEnabled('project')) $rowspan++; |
|
902 | - if ($object->fk_account > 0) $rowspan++; |
|
901 | + if (isModEnabled('project')) { |
|
902 | + $rowspan++; |
|
903 | + } |
|
904 | + if ($object->fk_account > 0) { |
|
905 | + $rowspan++; |
|
906 | + } |
|
903 | 907 | |
904 | 908 | print '<table class="border centpercent">'; |
905 | 909 | |
@@ -1576,9 +1580,12 @@ discard block |
||
1576 | 1580 | |
1577 | 1581 | $parameters = array(); |
1578 | 1582 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
1579 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1580 | - if (empty($reshook)) |
|
1581 | - global $senderissupplier; |
|
1583 | + if ($reshook < 0) { |
|
1584 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
1585 | + } |
|
1586 | + if (empty($reshook)) { |
|
1587 | + global $senderissupplier; |
|
1588 | + } |
|
1582 | 1589 | $senderissupplier = 2; |
1583 | 1590 | $object->formAddObjectLine(0, $object->thirdparty, $mysoc); // No date selector for template invoice |
1584 | 1591 | } |
@@ -40,7 +40,10 @@ |
||
40 | 40 | //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler |
41 | 41 | //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
42 | 42 | //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification |
43 | -if (!defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions |
|
43 | +if (!defined('NOSESSION')) { |
|
44 | + define('NOSESSION', '1'); |
|
45 | +} |
|
46 | +// On CLI mode, no need to use web sessions |
|
44 | 47 | |
45 | 48 | |
46 | 49 | $sapi_type = php_sapi_name(); |
@@ -149,7 +149,9 @@ |
||
149 | 149 | if (!isModEnabled("mymodule")) { |
150 | 150 | accessforbidden(); |
151 | 151 | } |
152 | -if (!$permissiontoread) accessforbidden(); |
|
152 | +if (!$permissiontoread) { |
|
153 | + accessforbidden(); |
|
154 | +} |
|
153 | 155 | |
154 | 156 | |
155 | 157 | /* |
@@ -192,7 +192,9 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | // Security check (enable the most restrictive one) |
195 | -if ($user->socid > 0) accessforbidden(); |
|
195 | +if ($user->socid > 0) { |
|
196 | + accessforbidden(); |
|
197 | +} |
|
196 | 198 | //if ($user->socid > 0) accessforbidden(); |
197 | 199 | //$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
198 | 200 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
@@ -200,7 +202,9 @@ discard block |
||
200 | 202 | if (!isModEnabled("mymodule")) { |
201 | 203 | accessforbidden('Module mymodule not enabled'); |
202 | 204 | } |
203 | -if (!$permissiontoread) accessforbidden(); |
|
205 | +if (!$permissiontoread) { |
|
206 | + accessforbidden(); |
|
207 | +} |
|
204 | 208 | |
205 | 209 | |
206 | 210 | /* |
@@ -197,9 +197,10 @@ discard block |
||
197 | 197 | if ($action == 'setmode' && $user->rights->salaries->write) { |
198 | 198 | $object->fetch($id); |
199 | 199 | $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); |
200 | - if ($result < 0) |
|
201 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
202 | -} |
|
200 | + if ($result < 0) { |
|
201 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
202 | + } |
|
203 | + } |
|
203 | 204 | |
204 | 205 | // bank account |
205 | 206 | if ($action == 'setbankaccount' && $user->rights->salaries->write) { |
@@ -213,7 +214,9 @@ discard block |
||
213 | 214 | if ($action == 'add' && empty($cancel)) { |
214 | 215 | $error = 0; |
215 | 216 | |
216 | - if (empty($datev)) $datev = $datep; |
|
217 | + if (empty($datev)) { |
|
218 | + $datev = $datep; |
|
219 | + } |
|
217 | 220 | |
218 | 221 | $type_payment = GETPOST("paymenttype", 'alpha'); |
219 | 222 | $amount = price2num(GETPOST("amount", 'alpha'), 'MT', 2); |
@@ -390,8 +393,12 @@ discard block |
||
390 | 393 | $newdatestart = dol_mktime(0, 0, 0, GETPOST('clone_date_startmonth', 'int'), GETPOST('clone_date_startday', 'int'), GETPOST('clone_date_startyear', 'int')); |
391 | 394 | $newdateend = dol_mktime(0, 0, 0, GETPOST('clone_date_endmonth', 'int'), GETPOST('clone_date_endday', 'int'), GETPOST('clone_date_endyear', 'int')); |
392 | 395 | |
393 | - if ($newdatestart) $object->datesp = $newdatestart; |
|
394 | - if ($newdateend) $object->dateep = $newdateend; |
|
396 | + if ($newdatestart) { |
|
397 | + $object->datesp = $newdatestart; |
|
398 | + } |
|
399 | + if ($newdateend) { |
|
400 | + $object->dateep = $newdateend; |
|
401 | + } |
|
395 | 402 | |
396 | 403 | $id = $object->create($user); |
397 | 404 | if ($id > 0) { |
@@ -443,7 +450,9 @@ discard block |
||
443 | 450 | |
444 | 451 | $form = new Form($db); |
445 | 452 | $formfile = new FormFile($db); |
446 | -if (isModEnabled('project')) $formproject = new FormProjets($db); |
|
453 | +if (isModEnabled('project')) { |
|
454 | + $formproject = new FormProjets($db); |
|
455 | +} |
|
447 | 456 | |
448 | 457 | $title = $langs->trans('Salary')." - ".$object->ref; |
449 | 458 | $help_url = ""; |
@@ -870,8 +879,9 @@ discard block |
||
870 | 879 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
871 | 880 | print $langs->trans('DefaultPaymentMode'); |
872 | 881 | print '</td>'; |
873 | - if ($action != 'editmode') |
|
874 | - print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
882 | + if ($action != 'editmode') { |
|
883 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
884 | + } |
|
875 | 885 | print '</tr></table>'; |
876 | 886 | print '</td><td>'; |
877 | 887 | |
@@ -978,8 +988,9 @@ discard block |
||
978 | 988 | } |
979 | 989 | |
980 | 990 | print '<td class="right">'; |
981 | - if ($bankaccountstatic->id) |
|
982 | - print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
991 | + if ($bankaccountstatic->id) { |
|
992 | + print $bankaccountstatic->getNomUrl(1, 'transactions'); |
|
993 | + } |
|
983 | 994 | print '</td>'; |
984 | 995 | } |
985 | 996 | print '<td class="right nowrap amountcard">'.price($objp->amount)."</td>\n"; |