@@ -64,7 +64,9 @@ discard block |
||
| 64 | 64 | } elseif ($objecttype == "user") { |
| 65 | 65 | $object = new User($db); |
| 66 | 66 | } |
| 67 | -} else accessforbidden($langs->trans('ErrorBadObjectType')); |
|
| 67 | +} else { |
|
| 68 | + accessforbidden($langs->trans('ErrorBadObjectType')); |
|
| 69 | +} |
|
| 68 | 70 | |
| 69 | 71 | $hookmanager->initHooks(array('skilltab', 'globalcard')); // Note that conf->hooks_modules contains array |
| 70 | 72 | |
@@ -75,9 +77,15 @@ discard block |
||
| 75 | 77 | $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
| 76 | 78 | |
| 77 | 79 | // Security check (enable the most restrictive one) |
| 78 | -if ($user->socid > 0) accessforbidden(); |
|
| 79 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
| 80 | -if (!$permissiontoread) accessforbidden(); |
|
| 80 | +if ($user->socid > 0) { |
|
| 81 | + accessforbidden(); |
|
| 82 | +} |
|
| 83 | +if (empty($conf->hrm->enabled)) { |
|
| 84 | + accessforbidden(); |
|
| 85 | +} |
|
| 86 | +if (!$permissiontoread) { |
|
| 87 | + accessforbidden(); |
|
| 88 | +} |
|
| 81 | 89 | |
| 82 | 90 | |
| 83 | 91 | /* |
@@ -120,10 +128,14 @@ discard block |
||
| 120 | 128 | $skillAdded->fk_object = $id; |
| 121 | 129 | $skillAdded->objecttype = $objecttype; |
| 122 | 130 | $ret = $skillAdded->create($user); |
| 123 | - if ($ret < 0) setEventMessages($skillAdded->error, null, 'errors'); |
|
| 131 | + if ($ret < 0) { |
|
| 132 | + setEventMessages($skillAdded->error, null, 'errors'); |
|
| 133 | + } |
|
| 124 | 134 | //else unset($TSkillsToAdd); |
| 125 | 135 | } |
| 126 | - if ($ret > 0) setEventMessages($langs->trans("SaveAddSkill"), null); |
|
| 136 | + if ($ret > 0) { |
|
| 137 | + setEventMessages($langs->trans("SaveAddSkill"), null); |
|
| 138 | + } |
|
| 127 | 139 | } |
| 128 | 140 | } elseif ($action == 'saveSkill') { |
| 129 | 141 | if (!empty($TNote)) { |
@@ -380,9 +392,13 @@ discard block |
||
| 380 | 392 | } |
| 381 | 393 | |
| 382 | 394 | print '</table>'; |
| 383 | - if ($objecttype != 'user' && $permissiontoadd) print '<td><input class="button pull-right" type="submit" value="' . $langs->trans('SaveRank') . '"></td>'; |
|
| 395 | + if ($objecttype != 'user' && $permissiontoadd) { |
|
| 396 | + print '<td><input class="button pull-right" type="submit" value="' . $langs->trans('SaveRank') . '"></td>'; |
|
| 397 | + } |
|
| 384 | 398 | print '</div>'; |
| 385 | - if ($objecttype != 'user' && $permissiontoadd) print '</form>'; |
|
| 399 | + if ($objecttype != 'user' && $permissiontoadd) { |
|
| 400 | + print '</form>'; |
|
| 401 | + } |
|
| 386 | 402 | |
| 387 | 403 | |
| 388 | 404 | // liste des compétences liées |