diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 5ba1b818137..1b53388bcaa 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -110,12 +110,13 @@ $permissiontoadd = $user->rights->salaries->write; // Used by the include of act $permissiontodelete = $user->rights->salaries->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -/** +/* * Actions */ $parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +// Note that $action and $object may be modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } @@ -123,14 +124,14 @@ if ($reshook < 0) { if (empty($reshook)) { $error = 0; - $backurlforlist = dol_buildpath('/salaries/list.php', 1); + $backurlforlist = DOL_URL_ROOT.'/salaries/list.php'; if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = dol_buildpath('/salaries/card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + $backtopage = DOL_URL_ROOT.'/salaries/card.php?id='.($id > 0 ? $id : '__ID__'); } } } @@ -444,9 +445,10 @@ $form = new Form($db); $formfile = new FormFile($db); if (isModEnabled('project')) $formproject = new FormProjets($db); -$title = $langs->trans('Salary')." - ".$langs->trans('Card'); +$title = $langs->trans('Salary')." - ".$object->ref; $help_url = ""; -llxHeader("", $title, $help_url); + +llxHeader('', $title, $help_url); if ($id > 0) { @@ -458,7 +460,7 @@ if ($id > 0) { } // Create -if ($action == 'create') { +if ($action == 'create' && $permissiontoadd) { $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; @@ -480,7 +482,7 @@ if ($action == 'create') { $datesp = dol_get_first_day($pastmonthyear, $pastmonth, false); $dateep = dol_get_last_day($pastmonthyear, $pastmonth, false); } - print '