30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/salaries.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
48$langs->loadLangs(array(
"compta",
"bills",
"users",
"salaries",
"hrm"));
52$action =
GETPOST(
'action',
'aZ09');
54$label =
GETPOST(
'label',
'alphanohtml');
60 $socid = $user->socid;
66$childids = $user->getAllChildIds(1);
69$extrafields->fetch_name_optionals_label(
$object->table_element);
72$hookmanager->initHooks(array(
'salaryinfo',
'globalcard'));
80 if ($user->hasRight(
'salaries',
'readall')) {
83 if ($user->hasRight(
'salaries',
'read') &&
$object->fk_user > 0 && in_array(
$object->fk_user, $childids)) {
93$permissiontoread = $user->hasRight(
'salaries',
'read');
94$permissiontoadd = $user->hasRight(
'salaries',
'write');
95$permissiontodelete = $user->hasRight(
'salaries',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_UNPAID);
103if ($action ==
'classin' && $permissiontoadd) {
105 $object->setProject($projectid);
109if ($action ==
'setlabel' && $permissiontoadd) {
112 $result =
$object->update($user);
124$form =
new Form($db);
129$title = $langs->trans(
'Salary').
" - ".$langs->trans(
'Info');
136$head = salaries_prepare_head($object);
140$linkback =
'<a href="'.DOL_URL_ROOT.
'/salaries/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
142$morehtmlref =
'<div class="refidno">';
144$userstatic =
new User($db);
145$userstatic->fetch(
$object->fk_user);
149if ($action !=
'editlabel') {
150 $morehtmlref .= $form->editfieldkey(
"Label",
'label',
$object->label, $object, $permissiontoadd,
'string',
'', 0, 1);
151 $morehtmlref .=
$object->label;
153 $morehtmlref .= $langs->trans(
'Label').
' : ';
154 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
155 $morehtmlref .=
'<input type="hidden" name="action" value="setlabel">';
156 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
157 $morehtmlref .=
'<input type="text" name="label" value="'.$object->label.
'"/>';
158 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
159 $morehtmlref .=
'</form>';
162$morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(-1);
164$usercancreate = $permissiontoadd;
168 $langs->load(
"projects");
169 $morehtmlref .=
'<br>';
170 if ($usercancreate) {
171 $morehtmlref .= img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
172 if ($action !=
'classify') {
173 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
175 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, -1, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
177 if (!empty(
$object->fk_project)) {
179 $proj->fetch(
$object->fk_project);
180 $morehtmlref .= $proj->getNomUrl(1);
182 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
188$morehtmlref .=
'</div>';
190$totalpaid =
$object->getSommePaiement();
192$object->totalpaid = $totalpaid;
193$object->alreadypaid = $totalpaid;
195dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
197print
'<div class="fichecenter">';
198print
'<div class="underbanner clearboth"></div>';
202print
'<table class="centpercent"><tr><td>';
204print
'</td></tr></table>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
isModEnabled($module)
Is Dolibarr module enabled.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
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.