28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
36 $langs->loadLangs(array(
"compta",
"salaries",
"bills",
"hrm"));
38 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
39 $massaction =
GETPOST(
'massaction',
'alpha');
40 $show_files =
GETPOST(
'show_files',
'int');
41 $confirm =
GETPOST(
'confirm',
'alpha');
42 $cancel =
GETPOST(
'cancel',
'alpha');
43 $toselect =
GETPOST(
'toselect',
'array');
44 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
45 $backtopage =
GETPOST(
'backtopage',
'alpha');
46 $optioncss =
GETPOST(
'optioncss',
'aZ');
51 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
52 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
53 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
55 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
59 $offset = $limit * $page;
60 $pageprev = $page - 1;
61 $pagenext = $page + 1;
63 $sortfield =
"s.datep,s.rowid";
66 $sortorder =
"DESC,DESC";
72 $diroutputmassaction = $conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
73 $hookmanager->initHooks(array(
'salarieslist'));
76 $extrafields->fetch_name_optionals_label($object->table_element);
78 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
81 $sortfield =
"s.datep,s.rowid";
84 $sortorder =
"DESC,DESC";
87 $search_ref =
GETPOST(
'search_ref',
'int');
88 $search_user =
GETPOST(
'search_user',
'alpha');
89 $search_label =
GETPOST(
'search_label',
'alpha');
90 $search_date_start_from =
dol_mktime(0, 0, 0,
GETPOST(
'search_date_start_frommonth',
'int'),
GETPOST(
'search_date_start_fromday',
'int'),
GETPOST(
'search_date_start_fromyear',
'int'));
91 $search_date_start_to =
dol_mktime(23, 59, 59,
GETPOST(
'search_date_start_tomonth',
'int'),
GETPOST(
'search_date_start_today',
'int'),
GETPOST(
'search_date_start_toyear',
'int'));
92 $search_date_end_from =
dol_mktime(0, 0, 0,
GETPOST(
'search_date_end_frommonth',
'int'),
GETPOST(
'search_date_end_fromday',
'int'),
GETPOST(
'search_date_end_fromyear',
'int'));
93 $search_date_end_to =
dol_mktime(23, 59, 59,
GETPOST(
'search_date_end_tomonth',
'int'),
GETPOST(
'search_date_end_today',
'int'),
GETPOST(
'search_date_end_toyear',
'int'));
94 $search_amount =
GETPOST(
'search_amount',
'alpha');
95 $search_account =
GETPOST(
'search_account',
'int');
96 $search_status =
GETPOST(
'search_status',
'int');
97 $search_type_id =
GETPOST(
'search_type_id',
'int');
99 $filtre =
GETPOST(
"filtre",
'restricthtml');
101 $childids = $user->getAllChildIds(1);
104 $search_all =
GETPOST(
"search_all",
'alpha');
106 foreach ($object->fields as $key => $val) {
107 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
108 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
110 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
111 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
112 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
117 $fieldstosearchall = array();
118 foreach ($object->fields as $key => $val) {
119 if (!empty($val[
'searchall'])) {
120 $fieldstosearchall[
't.'.$key] = $val[
'label'];
125 $arrayfields = array();
126 foreach ($object->fields as $key => $val) {
128 if (!empty($val[
'visible'])) {
129 $visible = (int)
dol_eval($val[
'visible'], 1);
130 $arrayfields[
't.'.$key] = array(
131 'label'=>$val[
'label'],
132 'checked'=>(($visible < 0) ? 0 : 1),
133 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
134 'position'=>$val[
'position'],
135 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
140 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
145 $permissiontoread = $user->rights->salaries->read;
146 $permissiontoadd = $user->rights->salaries->write;
147 $permissiontodelete = $user->rights->salaries->delete;
150 $socid =
GETPOST(
"socid",
"int");
152 $socid = $user->socid;
161 if (
GETPOST(
'cancel',
'alpha')) {
165 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
169 $parameters = array();
170 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
175 if (empty($reshook)) {
177 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
180 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
184 $search_date_start_from =
'';
185 $search_date_start_to =
'';
186 $search_date_end_from =
'';
187 $search_date_end_to =
'';
188 $search_date_end =
'';
190 $search_account =
'';
192 $search_type_id =
"";
194 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
195 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
200 $objectclass =
'Salary';
201 $objectlabel =
'Salaries';
202 $uploaddir = $conf->salaries->dir_output;
203 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
206 if (!$error && $massaction ==
'buildsepa' && $permissiontoadd) {
207 $objecttmp =
new $objectclass($db);
218 $salstatic =
new Salary($db);
219 $userstatic =
new User($db);
220 $accountstatic =
new Account($db);
224 $title = $langs->trans(
'Salaries');
232 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
233 $sql .=
" s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment as paymenttype, ";
234 $sql .=
" ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
235 $sql .=
" pst.code as payment_code,";
236 $sql .=
" SUM(ps.amount) as alreadypayed";
238 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
239 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
240 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
244 $parameters = array();
245 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
246 $sql .= $hookmanager->resPrint;
247 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
252 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
253 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (ps.fk_salary = s.rowid) ";
254 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pst ON (s.fk_typepayment = pst.id) ";
255 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account ba ON (ba.rowid = s.fk_account), ";
257 $sql .=
" ".MAIN_DB_PREFIX.
"user as u";
258 $sql .=
" WHERE u.rowid = s.fk_user";
259 $sql .=
" AND s.entity IN (".getEntity(
'payment_salaries').
")";
260 if (empty($user->rights->salaries->readall)) {
261 $sql .=
" AND s.fk_user IN (".$db->sanitize(join(
',', $childids)).
")";
266 $sql .=
" AND s.rowid=".((int) $search_ref);
269 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname',
'u.email'), $search_user);
274 if (!empty($search_date_start_from)) {
275 $sql .=
" AND s.datesp >= '".$db->idate($search_date_start_from).
"'";
277 if (!empty($search_date_end_from)) {
278 $sql .=
" AND s.dateep >= '".$db->idate($search_date_end_from).
"'";
280 if (!empty($search_date_start_to)) {
281 $sql .=
" AND s.datesp <= '".$db->idate($search_date_start_to).
"'";
283 if (!empty($search_date_end_to)) {
284 $sql .=
" AND s.dateep <= '".$db->idate($search_date_end_to).
"'";
287 if ($search_amount) {
290 if ($search_account > 0) {
291 $sql .=
" AND s.fk_account=".((int) $search_account);
293 if ($search_status !=
'' && $search_status >= 0) {
294 $sql .=
" AND s.paye = ".((int) $search_status);
296 if ($search_type_id) {
297 $sql .=
" AND s.fk_typepayment=".((int) $search_type_id);
299 $sql .=
" GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,";
300 $sql .=
" s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment, s.fk_bank,";
301 $sql .=
" ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos,";
305 $nbtotalofrecords =
'';
308 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
309 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
310 $resql = $db->query($sqlforcount);
312 $objforcount = $db->fetch_object($resql);
313 $nbtotalofrecords = $objforcount->nbtotalofrecords;
318 if (($page * $limit) > $nbtotalofrecords) {
326 $sql .= $db->order($sortfield, $sortorder);
328 $sql .= $db->plimit($limit + 1, $offset);
331 $resql = $db->query(
$sql);
337 $num = $db->num_rows($resql);
341 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
342 $obj = $db->fetch_object($resql);
344 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.$id);
354 $arrayofselected = is_array($toselect) ? $toselect : array();
358 $param .=
'&mode='.urlencode($mode);
360 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
361 $param .=
'&contextpage='.urlencode($contextpage);
363 if ($limit > 0 && $limit != $conf->liste_limit) {
364 $param .=
'&limit='.((int) $limit);
366 if ($search_type_id) {
367 $param .=
'&search_type_id='.urlencode($search_type_id);
369 if ($optioncss !=
'') {
370 $param .=
'&optioncss='.urlencode($optioncss);
373 $param .=
'&search_ref='.urlencode($search_ref);
375 if ($search_user > 0) {
376 $param .=
'&search_user='.urlencode($search_user);
379 $param .=
'&search_label='.urlencode($search_label);
381 if ($search_account) {
382 $param .=
'&search_account='.urlencode($search_account);
384 if ($search_status !=
'' && $search_status !=
'-1') {
385 $param .=
'&search_status='.urlencode($search_status);
387 if (!empty($search_date_start_from)) {
388 $param .=
'&search_date_start_fromday='.urlencode(
GETPOST(
'search_date_start_fromday')).
'&search_date_start_frommonth='.urlencode(
GETPOST(
'search_date_start_frommonth')).
'&search_date_start_fromyear='.urlencode(
GETPOST(
'search_date_start_fromyear'));
390 if (!empty($search_date_start_to)) {
391 $param .=
"&search_date_start_today=".urlencode(
GETPOST(
'search_date_start_today')).
"&search_date_start_tomonth=".urlencode(
GETPOST(
'search_date_start_tomonth')).
"&search_date_start_toyear=".urlencode(
GETPOST(
'search_date_start_toyear'));
393 if (!empty($search_date_end_from)) {
394 $param .=
'&search_date_end_fromday='.urlencode(
GETPOST(
'search_date_end_fromday')).
'&search_date_end_frommonth='.urlencode(
GETPOST(
'search_date_end_frommonth')).
'&search_date_end_fromyear='.urlencode(
GETPOST(
'search_date_end_fromyear'));
396 if (!empty($search_date_end_to)) {
397 $param .=
"&search_date_end_today=".urlencode(
GETPOST(
'search_date_end_today')).
"&search_date_end_tomonth=".urlencode(
GETPOST(
'search_date_end_tomonth')).
"&search_date_end_toyear=".urlencode(
GETPOST(
'search_date_end_toyear'));
401 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
403 $parameters = array();
404 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
405 $param .= $hookmanager->resPrint;
408 $arrayofmassactions = array(
412 if (!empty($permissiontodelete)) {
413 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
415 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
416 $arrayofmassactions = array();
418 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
420 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
421 if ($optioncss !=
'') {
422 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
424 print
'<input type="hidden" name="token" value="'.newToken().
'">';
425 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
426 print
'<input type="hidden" name="action" value="list">';
427 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
428 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
429 print
'<input type="hidden" name="page" value="'.$page.
'">';
430 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
431 print
'<input type="hidden" name="page_y" value="">';
432 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
435 $url = DOL_URL_ROOT.
'/salaries/card.php?action=create';
436 if (!empty($socid)) {
437 $url .=
'&socid='.$socid;
441 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
442 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
444 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSalary'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
446 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
449 $topicmail =
"SendSalaryRef";
450 $modelmail =
"salary";
451 $objecttmp =
new Salary($db);
452 $trackid =
'sal'.$object->id;
453 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
457 $parameters = array();
458 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
459 if (empty($reshook)) {
460 $moreforfilter .= $hookmanager->resPrint;
462 $moreforfilter = $hookmanager->resPrint;
465 if (!empty($moreforfilter)) {
466 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
467 print $moreforfilter;
468 $parameters = array();
469 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
470 print $hookmanager->resPrint;
474 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
475 $selectedfields = ($mode !=
'kanban' ?
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
476 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
478 print
'<div class="div-table-responsive">';
479 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
483 print
'<tr class="liste_titre_filter">';
486 print
'<td class="liste_titre center maxwidthsearch">';
487 $searchpicto =
$form->showFilterButtons(
'left');
492 print
'<td class="liste_titre left">';
493 print
'<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).
'">';
496 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$db->escape($search_label).
'"></td>';
499 print
'<td class="liste_titre center">';
500 print
'<div class="nowrap">';
501 print
$form->selectDate($search_date_start_from ? $search_date_start_from : -1,
'search_date_start_from', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
503 print
'<div class="nowrap">';
504 print
$form->selectDate($search_date_start_to ? $search_date_start_to : -1,
'search_date_start_to', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
509 print
'<td class="liste_titre center">';
510 print
'<div class="nowrap">';
511 print
$form->selectDate($search_date_end_from ? $search_date_end_from : -1,
'search_date_end_from', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
513 print
'<div class="nowrap">';
514 print
$form->selectDate($search_date_end_to ? $search_date_end_to : -1,
'search_date_end_to', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
519 print
'<td class="liste_titre">';
520 print
'<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).
'">';
524 print
'<td class="liste_titre left">';
525 print
$form->select_types_paiements($search_type_id,
'search_type_id',
'', 0, 1, 1, 16, 1,
'maxwidth125', 1);
530 print
'<td class="liste_titre">';
531 print
$form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth125', 1);
536 print
'<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).
'"></td>';
539 print
'<td class="liste_titre right parentonrightofpage">';
540 $liststatus = array(
'0' => $langs->trans(
"Unpaid"),
'1' => $langs->trans(
"Paid"));
541 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
545 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
548 $parameters = array(
'arrayfields'=>$arrayfields);
549 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
550 print $hookmanager->resPrint;
553 print
'<td class="liste_titre center maxwidthsearch">';
554 $searchpicto =
$form->showFilterButtons();
560 $totalarray = array();
561 $totalarray[
'nbfield'] = 0;
565 print
'<tr class="liste_titre">';
568 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
569 $totalarray[
'nbfield']++;
572 $totalarray[
'nbfield']++;
573 print_liste_field_titre(
"Label", $_SERVER[
"PHP_SELF"],
"s.label",
"", $param,
'class="left"', $sortfield, $sortorder);
574 $totalarray[
'nbfield']++;
575 print_liste_field_titre(
"DateStart", $_SERVER[
"PHP_SELF"],
"s.datesp,s.rowid",
"", $param,
'align="center"', $sortfield, $sortorder);
576 $totalarray[
'nbfield']++;
577 print_liste_field_titre(
"DateEnd", $_SERVER[
"PHP_SELF"],
"s.dateep,s.rowid",
"", $param,
'align="center"', $sortfield, $sortorder);
578 $totalarray[
'nbfield']++;
579 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
"", $sortfield, $sortorder);
580 $totalarray[
'nbfield']++;
581 print_liste_field_titre(
"DefaultPaymentMode", $_SERVER[
"PHP_SELF"],
"type",
"", $param,
'class="left"', $sortfield, $sortorder);
582 $totalarray[
'nbfield']++;
584 print_liste_field_titre(
"DefaultBankAccount", $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
585 $totalarray[
'nbfield']++;
587 print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"s.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
588 $totalarray[
'nbfield']++;
589 print_liste_field_titre(
'Status', $_SERVER[
"PHP_SELF"],
"s.paye",
'', $param,
'class="right"', $sortfield, $sortorder);
590 $totalarray[
'nbfield']++;
592 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
594 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
595 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
596 print $hookmanager->resPrint;
599 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
600 $totalarray[
'nbfield']++;
606 $needToFetchEachLine = 0;
607 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
608 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
609 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
610 $needToFetchEachLine++;
618 $savnbfield = $totalarray[
'nbfield'];
619 $totalarray = array();
620 $totalarray[
'nbfield'] = 0;
621 $totalarray[
'val'] = array();
622 $totalarray[
'val'][
'totalttcfield'] = 0;
623 $imaxinloop = ($limit ? min($num, $limit) : $num);
624 while ($i < $imaxinloop) {
625 $obj = $db->fetch_object($resql);
631 $object->setVarsFromFetchObj($obj);
633 $userstatic->id = $obj->uid;
634 $userstatic->lastname = $obj->lastname;
635 $userstatic->firstname = $obj->firstname;
636 $userstatic->admin = $obj->admin;
637 $userstatic->login = $obj->login;
638 $userstatic->email = $obj->email;
639 $userstatic->socid = $obj->fk_soc;
640 $userstatic->statut = $obj->status;
641 $userstatic->status = $obj->status;
642 $userstatic->photo = $obj->photo;
644 $salstatic->id = $obj->rowid;
645 $salstatic->ref = $obj->rowid;
646 $salstatic->label = $obj->label;
647 $salstatic->paye = $obj->paye;
648 $salstatic->datesp = $obj->datesp;
649 $salstatic->dateep = $obj->dateep;
650 $salstatic->amount = $obj->amount;
651 $salstatic->type_payment = $obj->payment_code;
653 if ($mode ==
'kanban') {
655 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
656 print
'<div class="box-flex-container kanban">';
659 if ($massactionbutton || $massaction) {
661 if (in_array($object->id, $arrayofselected)) {
665 print $salstatic->getKanbanView(
'', array(
'user' => $userstatic,
'selected' => $selected));
666 if ($i == ($imaxinloop - 1)) {
673 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
676 print
'<td class="nowrap center">';
677 if ($massactionbutton || $massaction) {
679 if (in_array($object->id, $arrayofselected)) {
682 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
686 $totalarray[
'nbfield']++;
691 print
"<td>".$salstatic->getNomUrl(1).
"</td>\n";
693 $totalarray[
'nbfield']++;
697 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
"</td>\n";
699 $totalarray[
'nbfield']++;
703 print
'<td class="center">'.dol_print_date($db->jdate($obj->datesp),
'day').
"</td>\n";
705 $totalarray[
'nbfield']++;
709 print
'<td class="center">'.dol_print_date($db->jdate($obj->dateep),
'day').
"</td>\n";
711 $totalarray[
'nbfield']++;
715 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
"</td>\n";
717 $totalarray[
'nbfield']++;
721 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
722 if (!empty($obj->payment_code)) print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
725 $totalarray[
'nbfield']++;
731 if ($obj->fk_account > 0) {
733 $accountstatic->id = $obj->bid;
734 $accountstatic->ref = $obj->bref;
735 $accountstatic->label = $obj->blabel;
736 $accountstatic->number = $obj->bnumber;
737 $accountstatic->iban = $obj->iban;
738 $accountstatic->bic = $obj->bic;
739 $accountstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
740 $accountstatic->account_number = $obj->account_number;
741 $accountstatic->clos = $obj->clos;
744 $accountstatic->account_number = $obj->account_number;
747 $accountingjournal->fetch($obj->fk_accountancy_journal);
749 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
752 print $accountstatic->getNomUrl(1);
758 $totalarray[
'nbfield']++;
765 print
'<td class="nowraponall right"><span class="amount">'.price($obj->amount).
'</span></td>';
767 $totalarray[
'nbfield']++;
770 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
772 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
774 print
'<td class="nowraponall right">'.$salstatic->LibStatut($obj->paye, 5, $obj->alreadypayed).
'</td>';
776 $totalarray[
'nbfield']++;
780 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
782 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
783 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
784 print $hookmanager->resPrint;
787 print
'<td class="nowrap center">';
788 if ($massactionbutton || $massaction) {
790 if (in_array($object->id, $arrayofselected)) {
793 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
797 $totalarray[
'nbfield']++;
806 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
819 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
825 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
826 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
827 print $hookmanager->resPrint;
829 print
'</table>'.
"\n";
832 print
'</form>'.
"\n";
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 bank accounts.
Class to manage accounting accounts.
Class to manage payments of salaries.
Class to manage salary payments.
Class to manage Dolibarr users.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.