Debug v17
This commit is contained in:
parent
8f196c1214
commit
a36ed6a3c4
@ -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 '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
if ($backtopage) {
|
||||
@ -522,7 +524,7 @@ if ($action == 'create') {
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
print dol_get_fiche_head('', '');
|
||||
print dol_get_fiche_head('');
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
@ -692,13 +694,8 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* View mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($id) {
|
||||
// View mode
|
||||
if ($id > 0) {
|
||||
$head = salaries_prepare_head($object);
|
||||
$formconfirm = '';
|
||||
|
||||
@ -794,34 +791,26 @@ if ($id) {
|
||||
$morehtmlref .= '</form>';
|
||||
}
|
||||
|
||||
$usercancreate = $permissiontoadd;
|
||||
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->salaries->write) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>';
|
||||
if ($usercancreate) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, '');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= ' : '.$proj->getNomUrl(1);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
if ($proj->title) {
|
||||
$morehtmlref .= ' - '.$proj->title;
|
||||
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
|
||||
}
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,9 @@ $childids = $user->getAllChildIds(1);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$object = new Salary($db);
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('salarydoc', 'globalcard'));
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
@ -105,7 +107,9 @@ if ($user->socid) {
|
||||
}
|
||||
restrictedArea($user, 'salaries', $object->id, 'salary', '');
|
||||
|
||||
$permissiontoread = $user->rights->salaries->read;
|
||||
$permissiontoadd = $user->rights->salaries->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles
|
||||
$permissiontodelete = $user->rights->salaries->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
|
||||
|
||||
/*
|
||||
@ -176,34 +180,26 @@ if ($object->id) {
|
||||
|
||||
$morehtmlref .= '<br>'.$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1);
|
||||
|
||||
$usercancreate = $permissiontoadd;
|
||||
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->salaries->write) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>';
|
||||
if ($usercancreate) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, -1, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, '');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= ' : '.$proj->getNomUrl(1);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
if ($proj->title) {
|
||||
$morehtmlref .= ' - '.$proj->title;
|
||||
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
|
||||
}
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,9 @@ $childids = $user->getAllChildIds(1);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('salaryinfo', 'globalcard'));
|
||||
|
||||
$object = new Salary($db);
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$object->fetch($id, $ref);
|
||||
@ -77,6 +80,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
restrictedArea($user, 'salaries', $object->id, 'salary', '');
|
||||
|
||||
$permissiontoread = $user->rights->salaries->read;
|
||||
$permissiontoadd = $user->rights->salaries->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles
|
||||
$permissiontodelete = $user->rights->salaries->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -107,7 +114,6 @@ $title = $langs->trans('Salary')." - ".$langs->trans('Info');
|
||||
$help_url = "";
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
$object = new Salary($db);
|
||||
$object->fetch($id);
|
||||
$object->info($id);
|
||||
|
||||
@ -139,34 +145,26 @@ if ($action != 'editlabel') {
|
||||
|
||||
$morehtmlref .= '<br>'.$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1);
|
||||
|
||||
$usercancreate = $permissiontoadd;
|
||||
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->salaries->write) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>';
|
||||
if ($usercancreate) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, '');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= ' : '.$proj->getNomUrl(1);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
if ($proj->title) {
|
||||
$morehtmlref .= ' - '.$proj->title;
|
||||
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
|
||||
}
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -180,7 +178,7 @@ print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
print '<table class="centpercent"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user