29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32if (isModEnabled(
'accounting')) {
33 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
37$langs->loadLangs(array(
"compta",
"salaries",
"bills",
"hrm"));
39$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
40$massaction =
GETPOST(
'massaction',
'alpha');
41$show_files =
GETPOST(
'show_files',
'int');
42$confirm =
GETPOST(
'confirm',
'alpha');
43$cancel =
GETPOST(
'cancel',
'alpha');
44$toselect =
GETPOST(
'toselect',
'array');
45$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
46$backtopage =
GETPOST(
'backtopage',
'alpha');
47$optioncss =
GETPOST(
'optioncss',
'aZ');
52$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
53$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
54$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
55$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
56if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
60$offset = $limit * $page;
64 $sortfield =
"s.datep,s.rowid";
67 $sortorder =
"DESC,DESC";
73$diroutputmassaction = $conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
74$hookmanager->initHooks(array(
'salarieslist'));
77$extrafields->fetch_name_optionals_label($object->table_element);
79$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
82 $sortfield =
"s.datep,s.rowid";
85 $sortorder =
"DESC,DESC";
88$search_ref =
GETPOST(
'search_ref',
'int');
89$search_user =
GETPOST(
'search_user',
'alpha');
90$search_label =
GETPOST(
'search_label',
'alpha');
91$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'));
92$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'));
93$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'));
94$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'));
95$search_amount =
GETPOST(
'search_amount',
'alpha');
96$search_account =
GETPOST(
'search_account',
'int');
97$search_status =
GETPOST(
'search_status',
'int');
98$search_type_id =
GETPOST(
'search_type_id',
'int');
100$filtre =
GETPOST(
"filtre",
'restricthtml');
102$childids = $user->getAllChildIds(1);
105$search_all =
GETPOST(
"search_all",
'alpha');
107foreach ($object->fields as $key => $val) {
108 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
109 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
111 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
112 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
113 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
118$fieldstosearchall = array();
119foreach ($object->fields as $key => $val) {
120 if (!empty($val[
'searchall'])) {
121 $fieldstosearchall[
't.'.$key] = $val[
'label'];
126$arrayfields = array();
127foreach ($object->fields as $key => $val) {
129 if (!empty($val[
'visible'])) {
130 $visible = (int)
dol_eval($val[
'visible'], 1);
131 $arrayfields[
't.'.$key] = array(
132 'label'=>$val[
'label'],
133 'checked'=>(($visible < 0) ? 0 : 1),
134 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
135 'position'=>$val[
'position'],
136 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
141include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
146$permissiontoread = $user->rights->salaries->read;
147$permissiontoadd = $user->rights->salaries->write;
148$permissiontodelete = $user->rights->salaries->delete;
151$socid =
GETPOST(
"socid",
"int");
153 $socid = $user->socid;
162if (
GETPOST(
'cancel',
'alpha')) {
166if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
170$parameters = array();
171$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
176if (empty($reshook)) {
178 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
181 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
185 $search_date_start_from =
'';
186 $search_date_start_to =
'';
187 $search_date_end_from =
'';
188 $search_date_end_to =
'';
189 $search_date_end =
'';
191 $search_account =
'';
193 $search_type_id =
"";
195 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
196 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
201 $objectclass =
'Salary';
202 $objectlabel =
'Salaries';
203 $uploaddir = $conf->salaries->dir_output;
204 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
207 if (!$error && $massaction ==
'buildsepa' && $permissiontoadd) {
208 $objecttmp =
new $objectclass($db);
218$form =
new Form($db);
219$salstatic =
new Salary($db);
220$userstatic =
new User($db);
221$accountstatic =
new Account($db);
225$title = $langs->trans(
'Salaries');
233$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,";
234$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, ";
235$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,";
236$sql .=
" pst.code as payment_code,";
237$sql .=
" SUM(ps.amount) as alreadypayed";
239if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
240 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
241 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
245$parameters = array();
246$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
247$sql .= $hookmanager->resPrint;
248$sql = preg_replace(
'/,\s*$/',
'', $sql);
253$sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
254if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
255 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
257$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (ps.fk_salary = s.rowid) ";
258$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pst ON (s.fk_typepayment = pst.id) ";
259$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account ba ON (ba.rowid = s.fk_account), ";
261$sql .=
" ".MAIN_DB_PREFIX.
"user as u";
262$sql .=
" WHERE u.rowid = s.fk_user";
263$sql .=
" AND s.entity IN (".getEntity(
'salaries').
")";
264if (!$user->hasRight(
'salaries',
'readall')) {
265 $sql .=
" AND s.fk_user IN (".$db->sanitize(join(
',', $childids)).
")";
271 $sql .=
" AND s.rowid=".((int) $search_ref);
274 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname',
'u.email'), $search_user);
279if (!empty($search_date_start_from)) {
280 $sql .=
" AND s.datesp >= '".$db->idate($search_date_start_from).
"'";
282if (!empty($search_date_end_from)) {
283 $sql .=
" AND s.dateep >= '".$db->idate($search_date_end_from).
"'";
285if (!empty($search_date_start_to)) {
286 $sql .=
" AND s.datesp <= '".$db->idate($search_date_start_to).
"'";
288if (!empty($search_date_end_to)) {
289 $sql .=
" AND s.dateep <= '".$db->idate($search_date_end_to).
"'";
295if ($search_account > 0) {
296 $sql .=
" AND s.fk_account=".((int) $search_account);
298if ($search_status !=
'' && $search_status >= 0) {
299 $sql .=
" AND s.paye = ".((int) $search_status);
301if ($search_type_id) {
302 $sql .=
" AND s.fk_typepayment=".((int) $search_type_id);
305include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
306$sql .=
" GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,";
307$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,";
308$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,";
312$nbtotalofrecords =
'';
315 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
316 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
317 $resql = $db->query($sqlforcount);
319 $objforcount = $db->fetch_object($resql);
320 $nbtotalofrecords = $objforcount->nbtotalofrecords;
325 if (($page * $limit) > $nbtotalofrecords) {
333$sql .= $db->order($sortfield, $sortorder);
335 $sql .= $db->plimit($limit + 1, $offset);
338$resql = $db->query($sql);
344$num = $db->num_rows($resql);
348if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
349 $obj = $db->fetch_object($resql);
351 header(
"Location: ".DOL_URL_ROOT.
'/salaries/card.php?id='.$id);
359llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
361$arrayofselected = is_array($toselect) ? $toselect : array();
365 $param .=
'&mode='.urlencode($mode);
367if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
368 $param .=
'&contextpage='.urlencode($contextpage);
370if ($limit > 0 && $limit != $conf->liste_limit) {
371 $param .=
'&limit='.((int) $limit);
373if ($search_type_id) {
374 $param .=
'&search_type_id='.urlencode($search_type_id);
376if ($optioncss !=
'') {
377 $param .=
'&optioncss='.urlencode($optioncss);
380 $param .=
'&search_ref='.urlencode($search_ref);
382if ($search_user > 0) {
383 $param .=
'&search_user='.urlencode($search_user);
386 $param .=
'&search_label='.urlencode($search_label);
388if ($search_account) {
389 $param .=
'&search_account='.urlencode($search_account);
391if ($search_status !=
'' && $search_status !=
'-1') {
392 $param .=
'&search_status='.urlencode($search_status);
394if (!empty($search_date_start_from)) {
395 $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'));
397if (!empty($search_date_start_to)) {
398 $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'));
400if (!empty($search_date_end_from)) {
401 $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'));
403if (!empty($search_date_end_to)) {
404 $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'));
408include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
410$parameters = array(
'param' => &$param);
411$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
412$param .= $hookmanager->resPrint;
415$arrayofmassactions = array(
419if (!empty($permissiontodelete)) {
420 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
422if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
423 $arrayofmassactions = array();
425$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
427print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
428if ($optioncss !=
'') {
429 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
431print
'<input type="hidden" name="token" value="'.newToken().
'">';
432print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
433print
'<input type="hidden" name="action" value="list">';
434print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
435print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
436print
'<input type="hidden" name="page" value="'.$page.
'">';
437print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
438print
'<input type="hidden" name="page_y" value="">';
439print
'<input type="hidden" name="mode" value="'.$mode.
'">';
442$url = DOL_URL_ROOT.
'/salaries/card.php?action=create';
444 $url .=
'&socid='.$socid;
448$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'));
449$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'));
451$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSalary'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
453print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
456$topicmail =
"SendSalaryRef";
457$modelmail =
"salary";
458$objecttmp =
new Salary($db);
459$trackid =
'sal'.$object->id;
460include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
464$parameters = array();
465$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
466if (empty($reshook)) {
467 $moreforfilter .= $hookmanager->resPrint;
469 $moreforfilter = $hookmanager->resPrint;
472if (!empty($moreforfilter)) {
473 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
474 print $moreforfilter;
475 $parameters = array();
476 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
477 print $hookmanager->resPrint;
481$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
482$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
483$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
485print
'<div class="div-table-responsive">';
486print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
490print
'<tr class="liste_titre_filter">';
493 print
'<td class="liste_titre center maxwidthsearch">';
494 $searchpicto = $form->showFilterButtons(
'left');
499print
'<td class="liste_titre left">';
500print
'<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).
'">';
503print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$db->escape($search_label).
'"></td>';
506print
'<td class="liste_titre center">';
507print
'<div class="nowrapfordate">';
508 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'));
510print
'<div class="nowrapfordate">';
511 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'));
516print
'<td class="liste_titre center">';
517print
'<div class="nowrapfordate">';
518 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'));
520print
'<div class="nowrapfordate">';
521 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'));
526print
'<td class="liste_titre">';
527print
'<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).
'">';
531print
'<td class="liste_titre left">';
532print $form->select_types_paiements($search_type_id,
'search_type_id',
'', 0, 1, 1, 16, 1,
'maxwidth125', 1);
536if (isModEnabled(
"banque")) {
537 print
'<td class="liste_titre">';
538 print $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth125', 1);
543include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
546print
'<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).
'"></td>';
549print
'<td class="liste_titre right parentonrightofpage">';
550$liststatus = array(
'0' => $langs->trans(
"Unpaid"),
'1' => $langs->trans(
"Paid"));
551print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
555$parameters = array(
'arrayfields'=>$arrayfields);
556$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
557print $hookmanager->resPrint;
560 print
'<td class="liste_titre center maxwidthsearch">';
561 $searchpicto = $form->showFilterButtons();
567$totalarray = array();
568$totalarray[
'nbfield'] = 0;
572print
'<tr class="liste_titre">';
575 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
576 $totalarray[
'nbfield']++;
579$totalarray[
'nbfield']++;
580print_liste_field_titre(
"Label", $_SERVER[
"PHP_SELF"],
"s.label",
"", $param,
'class="left"', $sortfield, $sortorder);
581$totalarray[
'nbfield']++;
582print_liste_field_titre(
"DateStart", $_SERVER[
"PHP_SELF"],
"s.datesp,s.rowid",
"", $param,
'align="center"', $sortfield, $sortorder);
583$totalarray[
'nbfield']++;
584print_liste_field_titre(
"DateEnd", $_SERVER[
"PHP_SELF"],
"s.dateep,s.rowid",
"", $param,
'align="center"', $sortfield, $sortorder);
585$totalarray[
'nbfield']++;
586print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
"", $sortfield, $sortorder);
587$totalarray[
'nbfield']++;
588print_liste_field_titre(
"DefaultPaymentMode", $_SERVER[
"PHP_SELF"],
"type",
"", $param,
'class="left"', $sortfield, $sortorder);
589$totalarray[
'nbfield']++;
590if (isModEnabled(
"banque")) {
591 print_liste_field_titre(
"DefaultBankAccount", $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
592 $totalarray[
'nbfield']++;
596include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
598print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"s.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
599$totalarray[
'nbfield']++;
600print_liste_field_titre(
'Status', $_SERVER[
"PHP_SELF"],
"s.paye",
'', $param,
'class="right"', $sortfield, $sortorder);
601$totalarray[
'nbfield']++;
604$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
605$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
606print $hookmanager->resPrint;
609 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
610 $totalarray[
'nbfield']++;
616$needToFetchEachLine = 0;
617if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
618 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
619 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
620 $needToFetchEachLine++;
628$savnbfield = $totalarray[
'nbfield'];
629$totalarray = array();
630$totalarray[
'nbfield'] = 0;
631$totalarray[
'val'] = array();
632$totalarray[
'val'][
'totalttcfield'] = 0;
633$imaxinloop = ($limit ? min($num, $limit) : $num);
634while ($i < $imaxinloop) {
635 $obj = $db->fetch_object($resql);
641 $object->setVarsFromFetchObj($obj);
643 $userstatic->id = $obj->uid;
644 $userstatic->lastname = $obj->lastname;
645 $userstatic->firstname = $obj->firstname;
646 $userstatic->admin = $obj->admin;
647 $userstatic->login = $obj->login;
648 $userstatic->email = $obj->email;
649 $userstatic->socid = $obj->fk_soc;
650 $userstatic->statut = $obj->status;
651 $userstatic->status = $obj->status;
652 $userstatic->photo = $obj->photo;
654 $salstatic->id = $obj->rowid;
655 $salstatic->ref = $obj->rowid;
656 $salstatic->label = $obj->label;
657 $salstatic->paye = $obj->paye;
658 $salstatic->status = $obj->paye;
659 $salstatic->alreadypaid = $obj->alreadypayed;
660 $salstatic->datesp = $obj->datesp;
661 $salstatic->dateep = $obj->dateep;
662 $salstatic->amount = $obj->amount;
663 $salstatic->type_payment = $obj->payment_code;
665 if ($mode ==
'kanban') {
667 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
668 print
'<div class="box-flex-container kanban">';
671 if ($massactionbutton || $massaction) {
673 if (in_array($object->id, $arrayofselected)) {
677 print $salstatic->getKanbanView(
'', array(
'user' => $userstatic,
'selected' => $selected));
678 if ($i == ($imaxinloop - 1)) {
685 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
688 print
'<td class="nowrap center">';
689 if ($massactionbutton || $massaction) {
691 if (in_array($object->id, $arrayofselected)) {
694 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
698 $totalarray[
'nbfield']++;
703 print
"<td>".$salstatic->getNomUrl(1).
"</td>\n";
705 $totalarray[
'nbfield']++;
709 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
"</td>\n";
711 $totalarray[
'nbfield']++;
715 print
'<td class="center">'.dol_print_date($db->jdate($obj->datesp),
'day').
"</td>\n";
717 $totalarray[
'nbfield']++;
721 print
'<td class="center">'.dol_print_date($db->jdate($obj->dateep),
'day').
"</td>\n";
723 $totalarray[
'nbfield']++;
727 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
"</td>\n";
729 $totalarray[
'nbfield']++;
733 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
734 if (!empty($obj->payment_code)) {
735 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
739 $totalarray[
'nbfield']++;
743 if (isModEnabled(
"banque")) {
745 if ($obj->fk_account > 0) {
747 $accountstatic->id = $obj->bid;
748 $accountstatic->ref = $obj->bref;
749 $accountstatic->label = $obj->blabel;
750 $accountstatic->number = $obj->bnumber;
751 $accountstatic->iban = $obj->iban;
752 $accountstatic->bic = $obj->bic;
753 $accountstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
754 $accountstatic->account_number = $obj->account_number;
755 $accountstatic->clos = $obj->clos;
757 if (isModEnabled(
'accounting')) {
758 $accountstatic->account_number = $obj->account_number;
761 $accountingjournal->fetch($obj->fk_accountancy_journal);
763 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
766 print $accountstatic->getNomUrl(1);
772 $totalarray[
'nbfield']++;
779 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
782 print
'<td class="nowraponall right"><span class="amount">'.price($obj->amount).
'</span></td>';
784 $totalarray[
'nbfield']++;
787 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
789 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
791 print
'<td class="nowraponall right">'.$salstatic->getLibStatut(5, $obj->alreadypayed).
'</td>';
793 $totalarray[
'nbfield']++;
797 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
798 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
799 print $hookmanager->resPrint;
802 print
'<td class="nowrap center">';
803 if ($massactionbutton || $massaction) {
805 if (in_array($object->id, $arrayofselected)) {
808 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
812 $totalarray[
'nbfield']++;
821include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
833 if (isModEnabled(
"banque")) {
836 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
842$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
843$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
844print $hookmanager->resPrint;
846print
'</table>'.
"\n";
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 journals.
Class to manage salary payments.
Class to manage Dolibarr users.
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 a 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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.