29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/salaries.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
33if (isModEnabled(
'project')) {
34 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
47$langs->loadLangs(array(
"compta",
"bills",
"users",
"salaries",
"hrm"));
51$action =
GETPOST(
'action',
'aZ09');
53$label =
GETPOST(
'label',
'alphanohtml');
59 $socid = $user->socid;
65$childids = $user->getAllChildIds(1);
68$extrafields->fetch_name_optionals_label(
$object->table_element);
71$hookmanager->initHooks(array(
'salaryinfo',
'globalcard'));
74if ($id > 0 || !empty($ref)) {
79 if ($user->hasRight(
'salaries',
'readall')) {
82 if ($user->hasRight(
'salaries',
'read') &&
$object->fk_user > 0 && in_array(
$object->fk_user, $childids)) {
92$permissiontoread = $user->hasRight(
'salaries',
'read');
93$permissiontoadd = $user->hasRight(
'salaries',
'write');
94$permissiontodelete = $user->hasRight(
'salaries',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_UNPAID);
102if ($action ==
'classin' && $permissiontoadd) {
104 $object->setProject($projectid);
108if ($action ==
'setlabel' && $permissiontoadd) {
120$form =
new Form($db);
121if (isModEnabled(
'project')) {
125$title = $langs->trans(
'Salary').
" - ".$langs->trans(
'Info');
132$head = salaries_prepare_head($object);
136$linkback =
'<a href="'.DOL_URL_ROOT.
'/salaries/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
138$morehtmlref =
'<div class="refidno">';
140$userstatic =
new User($db);
141$userstatic->fetch(
$object->fk_user);
145if ($action !=
'editlabel') {
146 $morehtmlref .= $form->editfieldkey(
"Label",
'label',
$object->label, $object, $permissiontoadd,
'string',
'', 0, 1);
147 $morehtmlref .=
$object->label;
149 $morehtmlref .= $langs->trans(
'Label').
' : ';
150 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
151 $morehtmlref .=
'<input type="hidden" name="action" value="setlabel">';
152 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
153 $morehtmlref .=
'<input type="text" name="label" value="'.$object->label.
'"/>';
154 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
155 $morehtmlref .=
'</form>';
158$morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(-1);
160$usercancreate = $permissiontoadd;
163if (isModEnabled(
'project')) {
164 $langs->load(
"projects");
165 $morehtmlref .=
'<br>';
166 if ($usercancreate) {
167 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
168 if ($action !=
'classify') {
169 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
171 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, -1,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
173 if (!empty(
$object->fk_project)) {
175 $proj->fetch(
$object->fk_project);
176 $morehtmlref .= $proj->getNomUrl(1);
178 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
184$morehtmlref .=
'</div>';
186dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
188print
'<div class="fichecenter">';
189print
'<div class="underbanner clearboth"></div>';
193print
'<table class="centpercent"><tr><td>';
195print
'</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.