28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/salaries.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
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'));
65 if ($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);
93 if ($action ==
'classin' && $user->rights->banque->modifier) {
95 $object->setProject($projectid);
99 if ($action ==
'setlabel' && $user->rights->salaries->write) {
101 $object->label = $label;
102 $object->update($user);
113 $title = $langs->trans(
'Salary').
" - ".$langs->trans(
'Info');
120 $head = salaries_prepare_head($object);
122 print
dol_get_fiche_head($head,
'info', $langs->trans(
"SalaryPayment"), -1,
'salary');
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);
133 if ($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;
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, ($action ==
'classify' ? 1 : 0), 0, 1,
'');
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>';
174 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
176 print
'<div class="fichecenter">';
177 print
'<div class="underbanner clearboth"></div>';
181 print
'<table class="centpercent"><tr><td>';
183 print
'</td></tr></table>';
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.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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='')
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)
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.