@@ -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"; |
@@ -3640,9 +3640,12 @@ |
||
3640 | 3640 | |
3641 | 3641 | $parameters = array(); |
3642 | 3642 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
3643 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
3644 | - if (empty($reshook)) |
|
3645 | - $object->formAddObjectLine(1, $societe, $mysoc); |
|
3643 | + if ($reshook < 0) { |
|
3644 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
3645 | + } |
|
3646 | + if (empty($reshook)) { |
|
3647 | + $object->formAddObjectLine(1, $societe, $mysoc); |
|
3648 | + } |
|
3646 | 3649 | } |
3647 | 3650 | } |
3648 | 3651 |
@@ -687,8 +687,9 @@ discard block |
||
687 | 687 | $newlang = ''; |
688 | 688 | if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { |
689 | 689 | $newlang = $object->thirdparty->default_lang; |
690 | - if (GETPOST('lang_id', 'aZ09')) |
|
691 | - $newlang = GETPOST('lang_id', 'aZ09'); |
|
690 | + if (GETPOST('lang_id', 'aZ09')) { |
|
691 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
692 | + } |
|
692 | 693 | } |
693 | 694 | if (!empty($newlang)) { |
694 | 695 | $outputlangs = new Translate("", $conf); |
@@ -2427,9 +2428,12 @@ discard block |
||
2427 | 2428 | |
2428 | 2429 | $parameters = array(); |
2429 | 2430 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
2430 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2431 | - if (empty($reshook)) |
|
2432 | - $object->formAddObjectLine(1, $societe, $mysoc); |
|
2431 | + if ($reshook < 0) { |
|
2432 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2433 | + } |
|
2434 | + if (empty($reshook)) { |
|
2435 | + $object->formAddObjectLine(1, $societe, $mysoc); |
|
2436 | + } |
|
2433 | 2437 | } |
2434 | 2438 | } |
2435 | 2439 | print '</table>'; |
@@ -68,8 +68,12 @@ discard block |
||
68 | 68 | $offset = $limit * $page; |
69 | 69 | $pageprev = $page - 1; |
70 | 70 | $pagenext = $page + 1; |
71 | -if (!$sortfield) $sortfield = "cr.date_sync"; |
|
72 | -if (!$sortorder) $sortorder = "DESC"; |
|
71 | +if (!$sortfield) { |
|
72 | + $sortfield = "cr.date_sync"; |
|
73 | +} |
|
74 | +if (!$sortorder) { |
|
75 | + $sortorder = "DESC"; |
|
76 | +} |
|
73 | 77 | |
74 | 78 | |
75 | 79 | // Initialize technical objects |
@@ -217,7 +221,9 @@ discard block |
||
217 | 221 | |
218 | 222 | $parameters = array(); |
219 | 223 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
220 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
224 | +if ($reshook < 0) { |
|
225 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
226 | +} |
|
221 | 227 | if (empty($reshook)) { |
222 | 228 | // Selection of new fields |
223 | 229 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
@@ -303,14 +309,20 @@ discard block |
||
303 | 309 | $sql .= $hookmanager->resPrint; |
304 | 310 | $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr '; |
305 | 311 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid"; |
306 | -if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); |
|
312 | +if ($sall) { |
|
313 | + $sql .= natural_search(array_keys($fieldstosearchall), $sall); |
|
314 | +} |
|
307 | 315 | if ($search_date_sync && $search_date_sync_end ) { |
308 | 316 | $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; |
309 | 317 | } elseif ($search_date_sync && !$search_date_sync_end) { |
310 | 318 | $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); |
311 | 319 | } |
312 | -if ($search_rate) $sql .= natural_search('cr.rate', $search_rate); |
|
313 | -if ($search_code) $sql .= natural_search('m.code', $search_code); |
|
320 | +if ($search_rate) { |
|
321 | + $sql .= natural_search('cr.rate', $search_rate); |
|
322 | +} |
|
323 | +if ($search_code) { |
|
324 | + $sql .= natural_search('m.code', $search_code); |
|
325 | +} |
|
314 | 326 | $sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'"; |
315 | 327 | |
316 | 328 | // Add where from hooks |
@@ -360,10 +372,18 @@ discard block |
||
360 | 372 | $param .= "&sall=".urlencode($sall); |
361 | 373 | } |
362 | 374 | |
363 | - if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync; |
|
364 | - if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end; |
|
365 | - if ($search_rate) $param = "&search_rate=".urlencode($search_rate); |
|
366 | - if ($search_code != '') $param.="&search_code=".urlencode($search_code); |
|
375 | + if ($search_date_sync) { |
|
376 | + $param = "&search_date_sync=".$search_date_sync; |
|
377 | + } |
|
378 | + if ($search_date_sync_end) { |
|
379 | + $param="&search_date_sync_end=".$search_date_sync_end; |
|
380 | + } |
|
381 | + if ($search_rate) { |
|
382 | + $param = "&search_rate=".urlencode($search_rate); |
|
383 | + } |
|
384 | + if ($search_code != '') { |
|
385 | + $param.="&search_code=".urlencode($search_code); |
|
386 | + } |
|
367 | 387 | |
368 | 388 | // Add $param from extra fields |
369 | 389 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
@@ -506,7 +526,9 @@ discard block |
||
506 | 526 | print '<td class="tdoverflowmax200">'; |
507 | 527 | print $obj->date_sync; |
508 | 528 | print "</td>\n"; |
509 | - if (!$i) $totalarray['nbfield']++; |
|
529 | + if (!$i) { |
|
530 | + $totalarray['nbfield']++; |
|
531 | + } |
|
510 | 532 | } |
511 | 533 | |
512 | 534 | // code |
@@ -516,7 +538,9 @@ discard block |
||
516 | 538 | print ' - <span class="opacitymedium">'.$obj->name.'</span>'; |
517 | 539 | print "</td>\n"; |
518 | 540 | |
519 | - if (! $i) $totalarray['nbfield']++; |
|
541 | + if (! $i) { |
|
542 | + $totalarray['nbfield']++; |
|
543 | + } |
|
520 | 544 | } |
521 | 545 | |
522 | 546 | // rate |
@@ -524,7 +548,9 @@ discard block |
||
524 | 548 | print '<td class="tdoverflowmax200">'; |
525 | 549 | print $obj->rate; |
526 | 550 | print "</td>\n"; |
527 | - if (! $i) $totalarray['nbfield']++; |
|
551 | + if (! $i) { |
|
552 | + $totalarray['nbfield']++; |
|
553 | + } |
|
528 | 554 | } |
529 | 555 | |
530 | 556 |
@@ -23,7 +23,9 @@ |
||
23 | 23 | * \brief Main page for ECM section area |
24 | 24 | */ |
25 | 25 | |
26 | -if (! defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); |
|
26 | +if (! defined('DISABLE_JS_GRAHP')) { |
|
27 | + define('DISABLE_JS_GRAPH', 1); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | // Load Dolibarr environment |
29 | 31 | require '../main.inc.php'; |
@@ -258,7 +258,9 @@ |
||
258 | 258 | if (empty($senderissupplier)) { |
259 | 259 | $statustoshow = 1; |
260 | 260 | $statuswarehouse = 'warehouseopen,warehouseinternal'; |
261 | - if (!empty($conf->global->ENTREPOT_WAREHOUSEINTERNAL_NOT_SELL)) $statuswarehouse = 'warehouseopen'; |
|
261 | + if (!empty($conf->global->ENTREPOT_WAREHOUSEINTERNAL_NOT_SELL)) { |
|
262 | + $statuswarehouse = 'warehouseopen'; |
|
263 | + } |
|
262 | 264 | if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { |
263 | 265 | // hide products in closed warehouse, but show products for internal transfer |
264 | 266 | $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, $statuswarehouse, GETPOST('combinations', 'array')); |