Go to the documentation of this file.
27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/salaries.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
37 $langs->loadLangs(array(
"compta",
"bills",
"users",
"salaries",
"hrm"));
41 $action =
GETPOST(
'action',
'aZ09');
43 $label =
GETPOST(
'label',
'alphanohtml');
44 $projectid = (
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') :
GETPOST(
'fk_project',
'int'));
47 $socid =
GETPOST(
'socid',
'int');
49 $socid = $user->socid;
55 $childids = $user->getAllChildIds(1);
58 $extrafields->fetch_name_optionals_label($object->table_element);
61 if ($id > 0 || !empty($ref)) {
62 $object->fetch($id, $ref);
66 if (!empty($user->rights->salaries->readall)) {
69 if (!empty($user->rights->salaries->read) && $object->fk_user > 0 && in_array($object->fk_user, $childids)) {
85 if ($action ==
'classin' && $user->rights->banque->modifier) {
87 $object->setProject($projectid);
91 if ($action ==
'setlabel' && $user->rights->salaries->write) {
93 $object->label = $label;
94 $object->update($user);
105 $title = $langs->trans(
'Salary').
" - ".$langs->trans(
'Info');
109 $object =
new Salary($db);
113 $head = salaries_prepare_head($object);
115 print
dol_get_fiche_head($head,
'info', $langs->trans(
"SalaryPayment"), -1,
'salary');
117 $linkback =
'<a href="'.DOL_URL_ROOT.
'/salaries/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
119 $morehtmlref =
'<div class="refidno">';
121 $userstatic =
new User($db);
122 $userstatic->fetch($object->fk_user);
126 if ($action !=
'editlabel') {
127 $morehtmlref .=
$form->editfieldkey(
"Label",
'label', $object->label, $object, $user->rights->salaries->write,
'string',
'', 0, 1);
128 $morehtmlref .= $object->label;
130 $morehtmlref .= $langs->trans(
'Label').
' : ';
131 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
132 $morehtmlref .=
'<input type="hidden" name="action" value="setlabel">';
133 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
134 $morehtmlref .=
'<input type="text" name="label" value="'.$object->label.
'"/>';
135 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
136 $morehtmlref .=
'</form>';
139 $morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(-1);
143 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
144 if ($user->rights->salaries->write) {
145 if ($action !=
'classify') {
146 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
148 if ($action ==
'classify') {
150 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
151 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
152 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
153 $morehtmlref .= $formproject->select_projects(-1, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1, 0,
'maxwidth500');
154 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
155 $morehtmlref .=
'</form>';
157 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
160 if (!empty($object->fk_project)) {
162 $proj->fetch($object->fk_project);
163 $morehtmlref .=
' : '.$proj->getNomUrl(1);
165 $morehtmlref .=
' - '.$proj->title;
173 $morehtmlref .=
'</div>';
175 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
177 print
'<div class="fichecenter">';
178 print
'<div class="underbanner clearboth"></div>';
182 print
'<table width="100%"><tr><td>';
184 print
'</td></tr></table>';
restrictedArea($user, $features, $objectid=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.
Class to manage projects.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
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.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
isModEnabled($module)
Is Dolibarr module enabled.
Class to manage Dolibarr users.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
Class to manage salary payments.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.