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');
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)) {
70 if ($user->hasRight(
'salaries',
'readall')) {
73 if ($user->hasRight(
'salaries',
'read') &&
$object->fk_user > 0 && in_array(
$object->fk_user, $childids)) {
83$permissiontoread = $user->hasRight(
'salaries',
'read');
84$permissiontoadd = $user->hasRight(
'salaries',
'write');
85$permissiontodelete = $user->hasRight(
'salaries',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_UNPAID);
93if ($action ==
'classin' && $permissiontoadd) {
95 $object->setProject($projectid);
99if ($action ==
'setlabel' && $permissiontoadd) {
111$form =
new Form($db);
112if (isModEnabled(
'project')) {
116$title = $langs->trans(
'Salary').
" - ".$langs->trans(
'Info');
123$head = salaries_prepare_head($object);
127$linkback =
'<a href="'.DOL_URL_ROOT.
'/salaries/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
129$morehtmlref =
'<div class="refidno">';
131$userstatic =
new User($db);
132$userstatic->fetch(
$object->fk_user);
136if ($action !=
'editlabel') {
137 $morehtmlref .= $form->editfieldkey(
"Label",
'label',
$object->label, $object, $permissiontoadd,
'string',
'', 0, 1);
138 $morehtmlref .=
$object->label;
140 $morehtmlref .= $langs->trans(
'Label').
' : ';
141 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
142 $morehtmlref .=
'<input type="hidden" name="action" value="setlabel">';
143 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
144 $morehtmlref .=
'<input type="text" name="label" value="'.$object->label.
'"/>';
145 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
146 $morehtmlref .=
'</form>';
149$morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(-1);
151$usercancreate = $permissiontoadd;
154if (isModEnabled(
'project')) {
155 $langs->load(
"projects");
156 $morehtmlref .=
'<br>';
157 if ($usercancreate) {
158 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
159 if ($action !=
'classify') {
160 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
162 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, -1,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
164 if (!empty(
$object->fk_project)) {
166 $proj->fetch(
$object->fk_project);
167 $morehtmlref .= $proj->getNomUrl(1);
169 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
175$morehtmlref .=
'</div>';
177dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
179print
'<div class="fichecenter">';
180print
'<div class="underbanner clearboth"></div>';
184print
'<table class="centpercent"><tr><td>';
186print
'</td></tr></table>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage projects.
Class to manage salary payments.
Class to manage Dolibarr users.
dol_print_object_info($object, $usetable=0)
Show information on an object TODO Move this into html.formother.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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 edit/modify 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.