28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/salaries.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
32if (isModEnabled(
'project')) {
33 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
38$langs->loadLangs(array(
"compta",
"bills",
"users",
"salaries",
"hrm"));
42$action =
GETPOST(
'action',
'aZ09');
44$label =
GETPOST(
'label',
'alphanohtml');
45$projectid = (
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') :
GETPOST(
'fk_project',
'int'));
48$socid =
GETPOST(
'socid',
'int');
50 $socid = $user->socid;
56$childids = $user->getAllChildIds(1);
59$extrafields->fetch_name_optionals_label($object->table_element);
62$hookmanager->initHooks(array(
'salaryinfo',
'globalcard'));
65if ($id > 0 || !empty($ref)) {
66 $object->fetch($id, $ref);
70 if (!empty($user->rights->salaries->readall)) {
73 if (!empty($user->rights->salaries->read) && $object->fk_user > 0 && in_array($object->fk_user, $childids)) {
83$permissiontoread = $user->rights->salaries->read;
84$permissiontoadd = $user->rights->salaries->write;
85$permissiontodelete = $user->rights->salaries->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
93if ($action ==
'classin' && $user->rights->banque->modifier) {
95 $object->setProject($projectid);
99if ($action ==
'setlabel' && $user->rights->salaries->write) {
101 $object->label = $label;
102 $object->update($user);
111if (isModEnabled(
'project')) $formproject =
new FormProjets($db);
113$title = $langs->trans(
'Salary').
" - ".$langs->trans(
'Info');
120$head = salaries_prepare_head($object);
124$linkback =
'<a href="'.DOL_URL_ROOT.
'/salaries/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
126$morehtmlref =
'<div class="refidno">';
128$userstatic =
new User($db);
129$userstatic->fetch($object->fk_user);
133if ($action !=
'editlabel') {
134 $morehtmlref .= $form->editfieldkey(
"Label",
'label', $object->label, $object, $user->rights->salaries->write,
'string',
'', 0, 1);
135 $morehtmlref .= $object->label;
137 $morehtmlref .= $langs->trans(
'Label').
' : ';
138 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
139 $morehtmlref .=
'<input type="hidden" name="action" value="setlabel">';
140 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
141 $morehtmlref .=
'<input type="text" name="label" value="'.$object->label.
'"/>';
142 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
143 $morehtmlref .=
'</form>';
146$morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(-1);
148$usercancreate = $permissiontoadd;
151if (isModEnabled(
'project')) {
152 $langs->load(
"projects");
153 $morehtmlref .=
'<br>';
154 if ($usercancreate) {
155 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
156 if ($action !=
'classify') {
157 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
159 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
161 if (!empty($object->fk_project)) {
163 $proj->fetch($object->fk_project);
164 $morehtmlref .= $proj->getNomUrl(1);
166 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
172$morehtmlref .=
'</div>';
174dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
176print
'<div class="fichecenter">';
177print
'<div class="underbanner clearboth"></div>';
181print
'<table class="centpercent"><tr><td>';
183print
'</td></tr></table>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage projects.
Class to manage salary payments.
Class to manage Dolibarr users.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.