@@ -55,11 +55,17 @@ discard block |
||
55 | 55 | $permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php |
56 | 56 | |
57 | 57 | // Security check (enable the most restrictive one) |
58 | -if ($user->socid > 0) accessforbidden(); |
|
58 | +if ($user->socid > 0) { |
|
59 | + accessforbidden(); |
|
60 | +} |
|
59 | 61 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
60 | 62 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
61 | -if (!isModEnabled('asset')) accessforbidden(); |
|
62 | -if (!empty($object->not_depreciated)) accessforbidden(); |
|
63 | +if (!isModEnabled('asset')) { |
|
64 | + accessforbidden(); |
|
65 | +} |
|
66 | +if (!empty($object->not_depreciated)) { |
|
67 | + accessforbidden(); |
|
68 | +} |
|
63 | 69 | |
64 | 70 | $object->asset_depreciation_options = &$assetdepreciationoptions; |
65 | 71 | $result = $assetdepreciationoptions->fetchDeprecationOptions($object->id); |
@@ -103,7 +109,9 @@ discard block |
||
103 | 109 | |
104 | 110 | if ($action == "update") { |
105 | 111 | $result = $assetdepreciationoptions->setDeprecationOptionsFromPost(); |
106 | - if ($result > 0) $result = $assetdepreciationoptions->updateDeprecationOptions($user, $object->id); |
|
112 | + if ($result > 0) { |
|
113 | + $result = $assetdepreciationoptions->updateDeprecationOptions($user, $object->id); |
|
114 | + } |
|
107 | 115 | if ($result < 0) { |
108 | 116 | setEventMessages($assetdepreciationoptions->error, $assetdepreciationoptions->errors, 'errors'); |
109 | 117 | $action = 'edit'; |
@@ -55,10 +55,14 @@ |
||
55 | 55 | $permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php |
56 | 56 | |
57 | 57 | // Security check (enable the most restrictive one) |
58 | -if ($user->socid > 0) accessforbidden(); |
|
58 | +if ($user->socid > 0) { |
|
59 | + accessforbidden(); |
|
60 | +} |
|
59 | 61 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
60 | 62 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
61 | -if (!isModEnabled('asset')) accessforbidden(); |
|
63 | +if (!isModEnabled('asset')) { |
|
64 | + accessforbidden(); |
|
65 | +} |
|
62 | 66 | |
63 | 67 | $result = $assetaccountancycodes->fetchAccountancyCodes($object->id); |
64 | 68 | if ($result < 0) { |
@@ -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 = ""; |
@@ -40,13 +40,17 @@ |
||
40 | 40 | $id = GETPOST("id", 'int'); |
41 | 41 | $action = GETPOST('action', 'aZ09'); |
42 | 42 | $confirm = GETPOST('confirm'); |
43 | -if ($user->socid) $socid = $user->socid; |
|
43 | +if ($user->socid) { |
|
44 | + $socid = $user->socid; |
|
45 | +} |
|
44 | 46 | |
45 | 47 | $object = new PaymentSalary($db); |
46 | 48 | if ($id > 0) { |
47 | 49 | $result = $object->fetch($id); |
48 | - if (!$result) dol_print_error($db, 'Failed to get payment id '.$id); |
|
49 | -} |
|
50 | + if (!$result) { |
|
51 | + dol_print_error($db, 'Failed to get payment id '.$id); |
|
52 | + } |
|
53 | + } |
|
50 | 54 | restrictedArea($user, 'salaries', $object->fk_salary, 'salary', ''); // $object is payment of salary |
51 | 55 | |
52 | 56 |
@@ -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 = ""; |
@@ -234,8 +234,9 @@ discard block |
||
234 | 234 | */ |
235 | 235 | function num2Alpha($n) |
236 | 236 | { |
237 | - for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) |
|
238 | - $r = chr($n % 26 + 0x41) . $r; |
|
237 | + for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) { |
|
238 | + $r = chr($n % 26 + 0x41) . $r; |
|
239 | + } |
|
239 | 240 | return $r; |
240 | 241 | } |
241 | 242 | |
@@ -3144,18 +3145,29 @@ discard block |
||
3144 | 3145 | if (empty($profID) || empty($profIDtype)) { |
3145 | 3146 | return ''; |
3146 | 3147 | } |
3147 | - if (empty($countrycode)) $countrycode = $mysoc->country_code; |
|
3148 | + if (empty($countrycode)) { |
|
3149 | + $countrycode = $mysoc->country_code; |
|
3150 | + } |
|
3148 | 3151 | $newProfID = $profID; |
3149 | 3152 | $id = substr($profIDtype, -1); |
3150 | 3153 | $ret = ''; |
3151 | 3154 | if (strtoupper($countrycode) == 'FR') { |
3152 | 3155 | // France |
3153 | - if ($id == 1 && dol_strlen($newProfID) == 9) $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3); |
|
3154 | - if ($id == 2 && dol_strlen($newProfID) == 14) $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3).$separ.substr($newProfID, 9, 5); |
|
3155 | - if ($profIDtype === 'VAT' && dol_strlen($newProfID) == 13) $newProfID = substr($newProfID, 0, 4).$separ.substr($newProfID, 4, 3).$separ.substr($newProfID, 7, 3).$separ.substr($newProfID, 10, 3); |
|
3156 | + if ($id == 1 && dol_strlen($newProfID) == 9) { |
|
3157 | + $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3); |
|
3158 | + } |
|
3159 | + if ($id == 2 && dol_strlen($newProfID) == 14) { |
|
3160 | + $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3).$separ.substr($newProfID, 9, 5); |
|
3161 | + } |
|
3162 | + if ($profIDtype === 'VAT' && dol_strlen($newProfID) == 13) { |
|
3163 | + $newProfID = substr($newProfID, 0, 4).$separ.substr($newProfID, 4, 3).$separ.substr($newProfID, 7, 3).$separ.substr($newProfID, 10, 3); |
|
3164 | + } |
|
3165 | + } |
|
3166 | + if (!empty($addcpButton)) { |
|
3167 | + $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID); |
|
3168 | + } else { |
|
3169 | + $ret = $newProfID; |
|
3156 | 3170 | } |
3157 | - if (!empty($addcpButton)) $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID); |
|
3158 | - else $ret = $newProfID; |
|
3159 | 3171 | return $ret; |
3160 | 3172 | } |
3161 | 3173 | |
@@ -9522,7 +9534,9 @@ discard block |
||
9522 | 9534 | if (preg_match('/^!/', $tmpcrit)) { |
9523 | 9535 | $newres .= $field." NOT LIKE '"; // ! as exclude character |
9524 | 9536 | $tmpcrit2 = preg_replace('/^!/', '', $tmpcrit2); |
9525 | - } else $newres .= $field." LIKE '"; |
|
9537 | + } else { |
|
9538 | + $newres .= $field." LIKE '"; |
|
9539 | + } |
|
9526 | 9540 | |
9527 | 9541 | if (preg_match('/^[\^\$]/', $tmpcrit)) { |
9528 | 9542 | $tmpbefore = ''; |
@@ -10450,13 +10464,15 @@ discard block |
||
10450 | 10464 | global $hookmanager, $action, $object, $langs; |
10451 | 10465 | |
10452 | 10466 | //var_dump($params); |
10453 | - if (!empty($params['isDropdown'])) |
|
10454 | - $class = "dropdown-item"; |
|
10455 | - else { |
|
10467 | + if (!empty($params['isDropdown'])) { |
|
10468 | + $class = "dropdown-item"; |
|
10469 | + } else { |
|
10456 | 10470 | $class = 'butAction'; |
10457 | 10471 | if ($actionType == 'danger' || $actionType == 'delete') { |
10458 | 10472 | $class = 'butActionDelete'; |
10459 | - if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken(); |
|
10473 | + if (!empty($url) && strpos($url, 'token=') === false) { |
|
10474 | + $url .= '&token='.newToken(); |
|
10475 | + } |
|
10460 | 10476 | } |
10461 | 10477 | } |
10462 | 10478 | $attr = array( |
@@ -10554,7 +10570,9 @@ discard block |
||
10554 | 10570 | ); |
10555 | 10571 | |
10556 | 10572 | $reshook = $hookmanager->executeHooks('dolGetButtonAction', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
10557 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
10573 | + if ($reshook < 0) { |
|
10574 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
10575 | + } |
|
10558 | 10576 | |
10559 | 10577 | if (empty($reshook)) { |
10560 | 10578 | if (dol_textishtml($text)) { // If content already HTML encoded |
@@ -1253,7 +1253,9 @@ |
||
1253 | 1253 | $i = 0; |
1254 | 1254 | foreach ($tickets as $ticket) { |
1255 | 1255 | $i++; |
1256 | - if ($i > $limit) break; |
|
1256 | + if ($i > $limit) { |
|
1257 | + break; |
|
1258 | + } |
|
1257 | 1259 | |
1258 | 1260 | print "\t".'<tr class="oddeven">'."\n"; |
1259 | 1261 | print '<td class="nowrap" valign="top">'; |
@@ -53,8 +53,12 @@ discard block |
||
53 | 53 | $permissiontoread = $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read; |
54 | 54 | $permissiontoadd = 0; |
55 | 55 | |
56 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
57 | -if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); |
|
56 | +if (empty($conf->hrm->enabled)) { |
|
57 | + accessforbidden(); |
|
58 | +} |
|
59 | +if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) { |
|
60 | + accessforbidden(); |
|
61 | +} |
|
58 | 62 | |
59 | 63 | |
60 | 64 | /* |
@@ -119,7 +123,9 @@ discard block |
||
119 | 123 | |
120 | 124 | $fk_usergroup2 = 0; |
121 | 125 | $fk_job = (int) GETPOST('fk_job'); |
122 | -if ($fk_job <= 0) $fk_usergroup2 = GETPOST('fk_usergroup2'); |
|
126 | +if ($fk_job <= 0) { |
|
127 | + $fk_usergroup2 = GETPOST('fk_usergroup2'); |
|
128 | +} |
|
123 | 129 | |
124 | 130 | $fk_usergroup1 = GETPOST('fk_usergroup1'); |
125 | 131 | |
@@ -288,11 +294,17 @@ discard block |
||
288 | 294 | foreach ($TMergedSkills as $id => &$sk) { |
289 | 295 | $class = 'diffnote'; |
290 | 296 | |
291 | - if (empty($sk->rate2)) $class .= ' toohappy'; |
|
292 | - elseif (empty($sk->rate1)) $class .= ' toosad'; |
|
293 | - elseif ($sk->rate1 == $sk->rate2) $class .= ' happy'; |
|
294 | - elseif ($sk->rate2 < $sk->rate1) $class .= ' veryhappy'; |
|
295 | - elseif ($sk->rate2 > $sk->rate1) $class .= ' sad'; |
|
297 | + if (empty($sk->rate2)) { |
|
298 | + $class .= ' toohappy'; |
|
299 | + } elseif (empty($sk->rate1)) { |
|
300 | + $class .= ' toosad'; |
|
301 | + } elseif ($sk->rate1 == $sk->rate2) { |
|
302 | + $class .= ' happy'; |
|
303 | + } elseif ($sk->rate2 < $sk->rate1) { |
|
304 | + $class .= ' veryhappy'; |
|
305 | + } elseif ($sk->rate2 > $sk->rate1) { |
|
306 | + $class .= ' sad'; |
|
307 | + } |
|
296 | 308 | |
297 | 309 | $out .= '<li fk_skill="' . $id . '" class="' . $class . '" style="text-align:center;"> |
298 | 310 | <span class="' . $class . '"> </span> |
@@ -327,8 +339,11 @@ discard block |
||
327 | 339 | $how_many = ($field === 'rate1') ? $sk->how_many_max1 : $sk->how_many_max2; |
328 | 340 | } |
329 | 341 | |
330 | - if ($field === 'rate2' && $fk_job > 0) $trad = $langs->trans('RequiredRank'); |
|
331 | - else $trad = $langs->trans('HighestRank'); |
|
342 | + if ($field === 'rate2' && $fk_job > 0) { |
|
343 | + $trad = $langs->trans('RequiredRank'); |
|
344 | + } else { |
|
345 | + $trad = $langs->trans('HighestRank'); |
|
346 | + } |
|
332 | 347 | |
333 | 348 | $out .= '<li fk_skill="' . $id . '" style="text-align:center;"> |
334 | 349 | <p><span class="' . $class . ' classfortooltip" title="' . $trad . '">' . $note . '</span>' . ($how_many > 0 ? '<span class="bubble classfortooltip" title="' . $langs->trans('HowManyUserWithThisMaxNote') . '">' . $how_many . '</span>' : '') . '</p> |
@@ -376,7 +391,9 @@ discard block |
||
376 | 391 | $Tab = array(); |
377 | 392 | |
378 | 393 | foreach ($TSkill1 as &$sk) { |
379 | - if (empty($Tab[$sk->fk_skill])) $Tab[$sk->fk_skill] = new stdClass; |
|
394 | + if (empty($Tab[$sk->fk_skill])) { |
|
395 | + $Tab[$sk->fk_skill] = new stdClass; |
|
396 | + } |
|
380 | 397 | |
381 | 398 | $Tab[$sk->fk_skill]->rate1 = $sk->rankorder; |
382 | 399 | $Tab[$sk->fk_skill]->how_many_max1 = $sk->how_many_max; |
@@ -385,7 +402,9 @@ discard block |
||
385 | 402 | } |
386 | 403 | |
387 | 404 | foreach ($TSkill2 as &$sk) { |
388 | - if (empty($Tab[$sk->fk_skill])) $Tab[$sk->fk_skill] = new stdClass; |
|
405 | + if (empty($Tab[$sk->fk_skill])) { |
|
406 | + $Tab[$sk->fk_skill] = new stdClass; |
|
407 | + } |
|
389 | 408 | $Tab[$sk->fk_skill]->rate2 = $sk->rankorder; |
390 | 409 | $Tab[$sk->fk_skill]->label = $sk->label; |
391 | 410 | $Tab[$sk->fk_skill]->description = $sk->description; |
@@ -433,12 +452,16 @@ discard block |
||
433 | 452 | $user->fetch($obj->rowid); |
434 | 453 | |
435 | 454 | $name = $user->getFullName($langs); |
436 | - if (empty($name)) $name = $user->login; |
|
455 | + if (empty($name)) { |
|
456 | + $name = $user->login; |
|
457 | + } |
|
437 | 458 | |
438 | 459 | if (in_array($user->id, $TExcludedId)) { |
439 | 460 | $class .= ' disabled'; |
440 | 461 | } else { |
441 | - if (!in_array($user->id, $TUser)) $TUser[] = $user->id; |
|
462 | + if (!in_array($user->id, $TUser)) { |
|
463 | + $TUser[] = $user->id; |
|
464 | + } |
|
442 | 465 | } |
443 | 466 | |
444 | 467 | |
@@ -456,7 +479,9 @@ discard block |
||
456 | 479 | $desc .= $langs->trans('NoEval'); |
457 | 480 | } |
458 | 481 | |
459 | - if (!empty($user->array_options['options_DDA'])) $desc .= '<br>' . $langs->trans('Anciennete') . ' : ' . dol_print_date(strtotime($user->array_options['options_DDA'])); |
|
482 | + if (!empty($user->array_options['options_DDA'])) { |
|
483 | + $desc .= '<br>' . $langs->trans('Anciennete') . ' : ' . dol_print_date(strtotime($user->array_options['options_DDA'])); |
|
484 | + } |
|
460 | 485 | |
461 | 486 | $out .= '<li fk_user="' . $user->id . '" class="' . $class . '"> |
462 | 487 | ' . $form->showphoto('userphoto', $user, 0, 0, 0, 'photoref', 'small', 1, 0, 1) . ' |
@@ -484,7 +509,9 @@ discard block |
||
484 | 509 | global $db; |
485 | 510 | |
486 | 511 | //I go back to the user with the highest score in a given group for all the skills assessed in that group |
487 | - if (empty($TUser)) return array(); |
|
512 | + if (empty($TUser)) { |
|
513 | + return array(); |
|
514 | + } |
|
488 | 515 | |
489 | 516 | $sql = 'SELECT sk.rowid, sk.label, sk.description, sk.skill_type, sr.fk_object, sr.objecttype, sr.fk_skill, '; |
490 | 517 | $sql.= ' MAX(sr.rankorder) as "rankorder"'; |
@@ -539,7 +566,9 @@ discard block |
||
539 | 566 | { |
540 | 567 | global $db; |
541 | 568 | |
542 | - if (empty($fk_job)) return array(); |
|
569 | + if (empty($fk_job)) { |
|
570 | + return array(); |
|
571 | + } |
|
543 | 572 | |
544 | 573 | $sql = 'SELECT sk.rowid, sk.label, sk.description, sk.skill_type, sr.fk_object, sr.objecttype, sr.fk_skill, '; |
545 | 574 | $sql.= ' MAX(sr.rankorder) as "rankorder"'; |
@@ -179,7 +179,9 @@ discard block |
||
179 | 179 | //$inventorycode = 'INV'.$object->id; |
180 | 180 | $inventorycode = 'INV-'.$object->ref; |
181 | 181 | $price = 0; |
182 | - if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) $price = $line->pmp_real; |
|
182 | + if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { |
|
183 | + $price = $line->pmp_real; |
|
184 | + } |
|
183 | 185 | |
184 | 186 | $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch); |
185 | 187 | if ($idstockmove < 0) { |
@@ -1060,8 +1062,11 @@ discard block |
||
1060 | 1062 | |
1061 | 1063 | if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { |
1062 | 1064 | //PMP Expected |
1063 | - if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; |
|
1064 | - else $pmp_expected = $product_static->pmp; |
|
1065 | + if (!empty($obj->pmp_expected)) { |
|
1066 | + $pmp_expected = $obj->pmp_expected; |
|
1067 | + } else { |
|
1068 | + $pmp_expected = $product_static->pmp; |
|
1069 | + } |
|
1065 | 1070 | $pmp_valuation = $pmp_expected * $valuetoshow; |
1066 | 1071 | print '<td class="right">'; |
1067 | 1072 | print price($pmp_expected); |
@@ -1082,8 +1087,11 @@ discard block |
||
1082 | 1087 | print '<td class="right">'; |
1083 | 1088 | |
1084 | 1089 | |
1085 | - if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; |
|
1086 | - else $pmp_real = $product_static->pmp; |
|
1090 | + if (!empty($obj->pmp_real)) { |
|
1091 | + $pmp_real = $obj->pmp_real; |
|
1092 | + } else { |
|
1093 | + $pmp_real = $product_static->pmp; |
|
1094 | + } |
|
1087 | 1095 | $pmp_valuation_real = $pmp_real * $qty_view; |
1088 | 1096 | print '<input type="text" class="maxwidth75 right realpmp'.$obj->fk_product.'" name="realpmp_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input_pmp" value="'.price2num($pmp_real).'">'; |
1089 | 1097 | print '</td>'; |
@@ -1111,8 +1119,11 @@ discard block |
||
1111 | 1119 | } else { |
1112 | 1120 | if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { |
1113 | 1121 | //PMP Expected |
1114 | - if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; |
|
1115 | - else $pmp_expected = $product_static->pmp; |
|
1122 | + if (!empty($obj->pmp_expected)) { |
|
1123 | + $pmp_expected = $obj->pmp_expected; |
|
1124 | + } else { |
|
1125 | + $pmp_expected = $product_static->pmp; |
|
1126 | + } |
|
1116 | 1127 | $pmp_valuation = $pmp_expected * $valuetoshow; |
1117 | 1128 | print '<td class="right">'; |
1118 | 1129 | print price($pmp_expected); |
@@ -1127,8 +1138,11 @@ discard block |
||
1127 | 1138 | |
1128 | 1139 | //PMP Real |
1129 | 1140 | print '<td class="right">'; |
1130 | - if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; |
|
1131 | - else $pmp_real = $product_static->pmp; |
|
1141 | + if (!empty($obj->pmp_real)) { |
|
1142 | + $pmp_real = $obj->pmp_real; |
|
1143 | + } else { |
|
1144 | + $pmp_real = $product_static->pmp; |
|
1145 | + } |
|
1132 | 1146 | $pmp_valuation_real = $pmp_real * $obj->qty_view; |
1133 | 1147 | print price($pmp_real); |
1134 | 1148 | print '</td>'; |