dolibarr 25.0.0-alpha
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2011-2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
3 * Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
5 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
6 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2024 Nick Fragoulis
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30// Load Dolibarr environment
31require '../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
40require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
41if (isModEnabled('accounting')) {
42 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
43}
44
45// Load translation files required by the page
46$langs->loadLangs(array("compta", "salaries", "bills", "hrm"));
47
48$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
49$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
50$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
51$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
52$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
53$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list
54$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
55$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
56$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
57$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
58
59
60// Load variable for pagination
61$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
62$sortfield = GETPOST('sortfield', 'aZ09comma');
63$sortorder = GETPOST('sortorder', 'aZ09comma');
64$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
65if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
66 // If $page is not defined, or '' or -1 or if we click on clear filters
67 $page = 0;
68}
69$offset = $limit * $page;
70$pageprev = $page - 1;
71$pagenext = $page + 1;
72if (!$sortfield) {
73 $sortfield = "s.datep,s.rowid";
74}
75if (!$sortorder) {
76 $sortorder = "DESC,DESC";
77}
78
79// Initialize technical objects
80$object = new Salary($db);
81$extrafields = new ExtraFields($db);
82$diroutputmassaction = $conf->user->dir_output.'/temp/massgeneration/'.$user->id;
83$hookmanager->initHooks(array('salarieslist')); // Note that conf->hooks_modules contains array
84
85// Fetch optionals attributes and labels
86$extrafields->fetch_name_optionals_label($object->table_element);
87
88$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
89
90if (!$sortfield) {
91 $sortfield = "s.datep,s.rowid";
92}
93if (!$sortorder) {
94 $sortorder = "DESC,DESC";
95}
96
97$search_ref = GETPOST('search_ref', 'alpha');
98$search_user = GETPOST('search_user', 'alpha');
99$search_label = GETPOST('search_label', 'alpha');
100$search_date_start_from = dol_mktime(0, 0, 0, GETPOSTINT('search_date_start_frommonth'), GETPOSTINT('search_date_start_fromday'), GETPOSTINT('search_date_start_fromyear'));
101$search_date_start_to = dol_mktime(23, 59, 59, GETPOSTINT('search_date_start_tomonth'), GETPOSTINT('search_date_start_today'), GETPOSTINT('search_date_start_toyear'));
102$search_date_end_from = dol_mktime(0, 0, 0, GETPOSTINT('search_date_end_frommonth'), GETPOSTINT('search_date_end_fromday'), GETPOSTINT('search_date_end_fromyear'));
103$search_date_end_to = dol_mktime(23, 59, 59, GETPOSTINT('search_date_end_tomonth'), GETPOSTINT('search_date_end_today'), GETPOSTINT('search_date_end_toyear'));
104$search_amount = GETPOST('search_amount', 'alpha');
105$search_account = GETPOST('search_account', 'alpha');
106$search_status = GETPOST('search_status', 'intcomma');
107$search_type_id = GETPOST('search_type_id', 'intcomma');
108
109$childids = $user->getAllChildIds(1);
110
111// Initialize array of search criteria
112$search_all = GETPOST("search_all", 'alpha');
113$search = array();
114foreach ($object->fields as $key => $val) {
115 if (GETPOST('search_'.$key, 'alpha') !== '') {
116 $search[$key] = GETPOST('search_'.$key, 'alpha');
117 }
118 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
119 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
120 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
121 }
122}
123
124// List of fields to search into when doing a "search in all"
125$fieldstosearchall = array();
126foreach ($object->fields as $key => $val) {
127 if (!empty($val['searchall'])) {
128 $fieldstosearchall['s.'.$key] = $val['label'];
129 }
130}
131
132// Definition of array of fields for columns
133$arrayfields = array();
134foreach ($object->fields as $key => $val) {
135 // If $val['visible']==0, then we never show the field
136 if (!empty($val['visible'])) {
137 $visible = (int) dol_eval((string) $val['visible'], 1);
138 $arrayfields['s.'.$key] = array(
139 'label' => $val['label'],
140 'checked' => (($visible < 0) ? 0 : 1),
141 'enabled' => (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
142 'position' => $val['position'],
143 'help' => isset($val['help']) ? $val['help'] : ''
144 );
145 }
146}
147// Extra fields
148include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
149// Add hook to complete $arrayfield
150$parameters = array('arrayfields' => &$arrayfields);
151$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
152
153$object->fields = dol_sort_array($object->fields, 'position');
154$arrayfields = dol_sort_array($arrayfields, 'position');
155
156$permissiontoread = $user->hasRight('salaries', 'read');
157$permissiontoadd = $user->hasRight('salaries', 'write');
158$permissiontodelete = $user->hasRight('salaries', 'delete');
159
160$error = 0;
161
162// Security check
163$socid = GETPOSTINT("socid");
164if ($user->socid) {
165 $socid = $user->socid;
166}
167restrictedArea($user, 'salaries', '', 'salary', '');
168
169
170/*
171 * Actions
172 */
173
174if (GETPOST('cancel', 'alpha')) {
175 $action = 'list';
176 $massaction = '';
177}
178if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
179 $massaction = '';
180}
181
182//credit transfer request
183if ($massaction == 'withdrawrequest') {
184 $langs->load("withdrawals");
185
186 if (!$user->hasRight('paymentbybanktransfer', 'create')) {
187 $error++;
188 setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
189 } else {
190 //Checking error
191 $error = 0;
192 $listofSalries = array();
193 $arrayofselected = is_array($toselect) ? $toselect : array();
194 foreach ($arrayofselected as $toselectid) {
195 $objecttmp = new Salary($db);
196 $result = $objecttmp->fetch($toselectid);
197 if ($result > 0) {
198 $totalpaid = (float) $objecttmp->getSommePaiement();
199 $objecttmp->resteapayer = (float) price2num((float) $objecttmp->amount - $totalpaid, 'MT');
200
201 // hook to finalize the remaining amount, considering e.g. cash discount agreements
202 $parameters = array('remaintopay' => $objecttmp->resteapayer);
203 $reshook = $hookmanager->executeHooks('finalizeAmountOfInvoice', $parameters, $objecttmp, $action); // Note that $action and $object may have been modified by some hooks
204 if ($reshook > 0) {
205 if (!empty($remaintopay = $hookmanager->resArray['remaintopay'])) {
206 $objecttmp->resteapayer = $remaintopay;
207 }
208 } elseif ($reshook < 0) {
209 $error++;
210 setEventMessages($objecttmp->ref.' '.$langs->trans("ProcessingError"), $hookmanager->errors, 'errors');
211 }
212
213 if ($objecttmp->status == Salary::STATUS_PAID || $objecttmp->resteapayer == 0) {
214 $error++;
215 setEventMessages($langs->trans("Salary").' '.$objecttmp->ref.' : '.$langs->trans("AlreadyPaid"), $objecttmp->errors, 'errors');
216 } elseif ($objecttmp->resteapayer < 0) {
217 $error++;
218 setEventMessages($langs->trans("Salary").' '.$objecttmp->ref.' : '.$langs->trans("AmountMustBePositive"), $objecttmp->errors, 'errors');
219 }
220
221 $rsql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
222 $rsql .= " , pfd.date_traite as date_traite";
223 $rsql .= " , pfd.amount";
224 $rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
225 $rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
226 $rsql .= " , ".MAIN_DB_PREFIX."user as u";
227 $rsql .= " WHERE fk_salary = ".((int) $objecttmp->id);
228 $rsql .= " AND pfd.fk_user_demande = u.rowid";
229 $rsql .= " AND pfd.traite = 0";
230 $rsql .= " ORDER BY pfd.date_demande DESC";
231
232 $numprlv = 0;
233 $result_sql = $db->query($rsql);
234 if ($result_sql) {
235 $numprlv = $db->num_rows($result_sql);
236 }
237
238 if ($numprlv > 0) {
239 //$error++; // Not an error, a simple warning we can ignore
240 setEventMessages($langs->trans("Salary").' '.$objecttmp->ref.' : '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings');
241 } elseif (!empty($objecttmp->type_payment_code) && $objecttmp->type_payment_code != 'VIR') {
242 $langs->load("errors");
243 $error++;
244 setEventMessages($langs->trans("Salary").' '.$objecttmp->ref.' : '.$langs->trans("ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors, 'errors');
245 } else {
246 $listofSalries[] = $objecttmp;
247 }
248 }
249 }
250
251 // Now process all record not in error
252 if (!$error && !empty($listofSalries)) {
253 $nbwithdrawrequestok = 0;
254 foreach ($listofSalries as $salary) {
255 $db->begin();
256 $result = $salary->demande_prelevement($user, (float) $salary->resteapayer, 'salaire');
257 if ($result > 0) {
258 $db->commit();
259 $nbwithdrawrequestok++;
260 } else {
261 $db->rollback();
262 setEventMessages($salary->error, $salary->errors, 'errors');
263 }
264 }
265 if ($nbwithdrawrequestok > 0) {
266 setEventMessages($langs->trans("WithdrawRequestsDone", $nbwithdrawrequestok), null, 'mesgs');
267 }
268 }
269 }
270}
271
272$parameters = array();
273$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
274if ($reshook < 0) {
275 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
276}
277
278if (empty($reshook)) {
279 // Selection of new fields
280 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
281
282 // Purge search criteria
283 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
284 $search_ref = "";
285 $search_user = "";
286 $search_label = "";
287 $search_date_start_from = '';
288 $search_date_start_to = '';
289 $search_date_end_from = '';
290 $search_date_end_to = '';
291 $search_date_end = '';
292 $search_amount = "";
293 $search_account = '';
294 $search_status = '';
295 $search_type_id = "";
296 }
297 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
298 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
299 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
300 }
301
302 // Mass actions
303 $objectclass = 'Salary';
304 $objectlabel = 'Salaries';
305 $uploaddir = $conf->salaries->dir_output;
306 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
307
308 // Validate records
309 if (!$error && $massaction == 'buildsepa' && $permissiontoadd) {
310 $objecttmp = new $objectclass($db);
311
312 // TODO
313 }
314}
315
316/*
317 * View
318 */
319
320$form = new Form($db);
321$salstatic = new Salary($db);
322$userstatic = new User($db);
323$accountstatic = new Account($db);
324
325$now = dol_now();
326
327$title = $langs->trans('Salaries');
328//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials";
329$help_url = '';
330$morejs = array();
331$morecss = array();
332
333// Build and execute select
334// --------------------------------------------------------------------
335$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,";
336$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, ";
337$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,";
338$sql .= " pst.code as payment_code,";
339$sql .= " SUM(ps.amount) as alreadypayed";
340// Add fields from extrafields
341if (!empty($extrafields->attributes[$object->table_element]['label'])) {
342 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
343 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
344 }
345}
346// Add fields from hooks
347$parameters = array();
348$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
349$sql .= $hookmanager->resPrint;
350$sql = preg_replace('/,\s*$/', '', $sql);
351//$sql .= ", COUNT(rc.rowid) as anotherfield";
352
353$sqlfields = $sql; // $sql fields to remove for count total
354
355$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
356if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
357 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)";
358}
359$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (ps.fk_salary = s.rowid) ";
360$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON (s.fk_typepayment = pst.id) ";
361$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account ba ON (ba.rowid = s.fk_account), ";
362//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON ps.fk_salary = s.rowid, ";
363$sql .= " ".MAIN_DB_PREFIX."user as u";
364$sql .= " WHERE u.rowid = s.fk_user";
365$sql .= " AND s.entity IN (".getEntity('salaries').")";
366if (!$user->hasRight('salaries', 'readchild')) {
367 $sql .= " AND s.fk_user = ".(int) $user->id;
368}
369if (!$user->hasRight('salaries', 'readall')) {
370 $sql .= " AND s.fk_user IN (".$db->sanitize(implode(',', $childids)).")";
371}
372
373//print $sql;
374
375// Search criteria
376if ($search_ref) {
377 $sql .= " AND s.rowid=".((int) $search_ref);
378}
379if ($search_user) {
380 $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
381}
382if ($search_label) {
383 $sql .= natural_search(array('s.label'), $search_label);
384}
385if (!empty($search_date_start_from)) {
386 $sql .= " AND s.datesp >= '".$db->idate($search_date_start_from)."'";
387}
388if (!empty($search_date_end_from)) {
389 $sql .= " AND s.dateep >= '".$db->idate($search_date_end_from)."'";
390}
391if (!empty($search_date_start_to)) {
392 $sql .= " AND s.datesp <= '".$db->idate($search_date_start_to)."'";
393}
394if (!empty($search_date_end_to)) {
395 $sql .= " AND s.dateep <= '".$db->idate($search_date_end_to)."'";
396}
397
398if ($search_amount) {
399 $sql .= natural_search("s.amount", $search_amount, 1);
400}
401if ($search_account > 0) {
402 $sql .= " AND s.fk_account=".((int) $search_account);
403}
404if ($search_status != '' && $search_status >= 0) {
405 $sql .= " AND s.paye = ".((int) $search_status);
406}
407if ($search_type_id) {
408 $sql .= " AND s.fk_typepayment=".((int) $search_type_id);
409}
410// Add where from extra fields
411include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
412$sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,";
413$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,";
414$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,";
415$sql .= " pst.code";
416// Add fields from extrafields
417if (!empty($extrafields->attributes[$object->table_element]['label'])) {
418 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
419 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
420 }
421}
422
423// Count total nb of records
424$nbtotalofrecords = '';
425if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
426 /* The fast and low memory method to get and count full list converts the sql into a sql count */
427 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
428 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
429 $resql = $db->query($sqlforcount);
430 if ($resql) {
431 $objforcount = $db->fetch_object($resql);
432 $nbtotalofrecords = $objforcount->nbtotalofrecords;
433 } else {
435 }
436
437 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
438 $page = 0;
439 $offset = 0;
440 }
441 $db->free($resql);
442}
443
444// Complete request and execute it with limit
445$sql .= $db->order($sortfield, $sortorder);
446if ($limit) {
447 $sql .= $db->plimit($limit + 1, $offset);
448}
449
450$resql = $db->query($sql);
451if (!$resql) {
453 exit;
454}
455
456$num = $db->num_rows($resql);
457
458
459// Direct jump if only one record found
460if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
461 $obj = $db->fetch_object($resql);
462 $id = $obj->rowid;
463 header("Location: ".DOL_URL_ROOT.'/salaries/card.php?id='.$id);
464 exit;
465}
466
467
468// Output page
469// --------------------------------------------------------------------
470
471llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
472
473$arrayofselected = is_array($toselect) ? $toselect : array();
474
475$param = '';
476if (!empty($mode)) {
477 $param .= '&mode='.urlencode($mode);
478}
479if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
480 $param .= '&contextpage='.urlencode($contextpage);
481}
482if ($limit > 0 && $limit != $conf->liste_limit) {
483 $param .= '&limit='.((int) $limit);
484}
485if ($search_type_id) {
486 $param .= '&search_type_id='.urlencode($search_type_id);
487}
488if ($optioncss != '') {
489 $param .= '&optioncss='.urlencode($optioncss);
490}
491if ($search_ref != '') {
492 $param .= '&search_ref='.urlencode($search_ref);
493}
494if ($search_user != '') {
495 $param .= '&search_user='.urlencode($search_user);
496}
497if ($search_label) {
498 $param .= '&search_label='.urlencode($search_label);
499}
500if ($search_account) {
501 $param .= '&search_account='.urlencode((string) ($search_account));
502}
503if ($search_status != '' && $search_status != '-1') {
504 $param .= '&search_status='.urlencode($search_status);
505}
506if (!empty($search_date_start_from)) {
507 $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'));
508}
509if (!empty($search_date_start_to)) {
510 $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'));
511}
512if (!empty($search_date_end_from)) {
513 $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'));
514}
515if (!empty($search_date_end_to)) {
516 $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'));
517}
518
519// Add $param from extra fields
520include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
521// Add $param from hooks
522$parameters = array('param' => &$param);
523$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
524$param .= $hookmanager->resPrint;
525
526// List of mass actions available
527$arrayofmassactions = array(
528 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
529 //'buildsepa'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("BuildSepa"), // TODO
530);
531if (!empty($permissiontodelete)) {
532 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
533}
534if (isModEnabled('paymentbybanktransfer') && $user->hasRight('paymentbybanktransfer', 'create')) {
535 $langs->load("withdrawals");
536 $arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeBankTransferOrder");
537}
538if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
539 $arrayofmassactions = array();
540}
541$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
542
543print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
544if ($optioncss != '') {
545 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
546}
547print '<input type="hidden" name="token" value="'.newToken().'">';
548print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
549print '<input type="hidden" name="action" value="list">';
550print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
551print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
552print '<input type="hidden" name="page" value="'.$page.'">';
553print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
554print '<input type="hidden" name="page_y" value="">';
555print '<input type="hidden" name="mode" value="'.$mode.'">';
556
557
558$url = DOL_URL_ROOT.'/salaries/card.php?action=create';
559if (!empty($socid)) {
560 $url .= '&socid='.$socid;
561}
562
563$newcardbutton = '';
564$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'));
565$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'));
566$newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/salaries/stats/index.php?'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ($mode == 'statistics' ? 2 : 1), array('morecss' => 'reposition'));
567$newcardbutton .= dolGetButtonTitleSeparator();
568$newcardbutton .= dolGetButtonTitle($langs->trans('NewSalary'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
569
570print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
571
572// Add code for pre mass action (confirmation or email presend form)
573$topicmail = "SendSalaryRef";
574$modelmail = "salary";
575$objecttmp = new Salary($db);
576$trackid = 'sal'.$object->id;
577include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
578
579$moreforfilter = '';
580
581$parameters = array();
582$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
583if (empty($reshook)) {
584 $moreforfilter .= $hookmanager->resPrint;
585} else {
586 $moreforfilter = $hookmanager->resPrint;
587}
588
589if (!empty($moreforfilter)) {
590 print '<div class="liste_titre liste_titre_bydiv centpercent">';
591 print $moreforfilter;
592 print '</div>';
593}
594
595$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
596$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
597$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
598$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
599
600print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
601print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
602
603// Fields title search
604// --------------------------------------------------------------------
605print '<tr class="liste_titre_filter">';
606// Action column
607if ($conf->main_checkbox_left_column) {
608 print '<td class="liste_titre center maxwidthsearch">';
609 $searchpicto = $form->showFilterButtons('left');
610 print $searchpicto;
611 print '</td>';
612}
613// Ref
614if (!empty($arrayfields['s.ref']['checked'])) {
615 print '<td class="liste_titre left">';
616 print '<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).'">';
617 print '</td>';
618}
619
620// Label
621if (!empty($arrayfields['s.label']['checked'])) {
622 print '<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$db->escape($search_label).'"></td>';
623}
624
625// Date start
626if (!empty($arrayfields['s.datesp']['checked'])) {
627 print '<td class="liste_titre center">';
628 print '<div class="nowrapfordate">';
629 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'));
630 print '</div>';
631 print '<div class="nowrapfordate">';
632 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'));
633 print '</div>';
634 print '</td>';
635}
636
637// Date End
638if (!empty($arrayfields['s.dateep']['checked'])) {
639 print '<td class="liste_titre center">';
640 print '<div class="nowrapfordate">';
641 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'));
642 print '</div>';
643 print '<div class="nowrapfordate">';
644 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'));
645 print '</div>';
646 print '</td>';
647}
648
649// Employee
650if (!empty($arrayfields['s.fk_user']['checked'])) {
651 print '<td class="liste_titre">';
652 print '<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).'">';
653 print '</td>';
654}
655
656// Type
657if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
658 print '<td class="liste_titre left">';
659 print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth125', 1);
660 print '</td>';
661}
662
663// Bank account
664if (isModEnabled("bank")) {
665 if (!empty($arrayfields['s.fk_account']['checked'])) {
666 print '<td class="liste_titre">';
667 print $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth125', 1);
668 print '</td>';
669 }
670}
671
672// Extra fields
673include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
674
675// Amount
676if (!empty($arrayfields['s.amount']['checked'])) {
677 print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).'"></td>';
678}
679
680// Status
681if (!empty($arrayfields['s.paye']['checked'])) {
682 print '<td class="liste_titre center parentonrightofpage">';
683 $liststatus = array('0' => $langs->trans("Unpaid"), '1' => $langs->trans("Paid"));
684 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
685 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
686 print '</td>';
687}
688
689// Fields from hook
690$parameters = array('arrayfields' => $arrayfields);
691$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
692print $hookmanager->resPrint;
693// Action column
694if (!$conf->main_checkbox_left_column) {
695 print '<td class="liste_titre center maxwidthsearch">';
696 $searchpicto = $form->showFilterButtons();
697 print $searchpicto;
698 print '</td>';
699}
700print '</tr>'."\n";
701
702$totalarray = array();
703$totalarray['nbfield'] = 0;
704
705// Fields title label
706// --------------------------------------------------------------------
707print '<tr class="liste_titre">';
708// Action column
709if ($conf->main_checkbox_left_column) {
710 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
711 $totalarray['nbfield']++;
712}
713
714if (!empty($arrayfields['s.ref']['checked'])) {
715 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
716 $totalarray['nbfield']++;
717}
718
719if (!empty($arrayfields['s.label']['checked'])) {
720 print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, '', $sortfield, $sortorder);
721 $totalarray['nbfield']++;
722}
723
724if (!empty($arrayfields['s.datesp']['checked'])) {
725 print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
726 $totalarray['nbfield']++;
727}
728
729if (!empty($arrayfields['s.dateep']['checked'])) {
730 print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "s.dateep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
731 $totalarray['nbfield']++;
732}
733
734if (!empty($arrayfields['s.fk_user']['checked'])) {
735 print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, "", $sortfield, $sortorder);
736 $totalarray['nbfield']++;
737}
738
739if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
740 print_liste_field_titre("DefaultPaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder);
741 $totalarray['nbfield']++;
742}
743
744if (isModEnabled("bank")) {
745 if (!empty($arrayfields['s.fk_account']['checked'])) {
746 print_liste_field_titre("DefaultBankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
747 $totalarray['nbfield']++;
748 }
749}
750
751// Extra fields
752include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
753
754if (!empty($arrayfields['s.amount']['checked'])) {
755 print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "s.amount", "", $param, '', $sortfield, $sortorder, 'right ');
756 $totalarray['nbfield']++;
757}
758
759if (!empty($arrayfields['s.paye']['checked'])) {
760 print_liste_field_titre('Status', $_SERVER["PHP_SELF"], "s.paye", '', $param, '', $sortfield, $sortorder, 'center ');
761 $totalarray['nbfield']++;
762}
763
764// Hook fields
765$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
766$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
767print $hookmanager->resPrint;
768// Action column
769if (!$conf->main_checkbox_left_column) {
770 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
771 $totalarray['nbfield']++;
772}
773print '</tr>'."\n";
774
775
776// Detect if we need a fetch on each output line
777$needToFetchEachLine = 0;
778if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
779 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
780 if (!is_null($val) && preg_match('/\$object/', $val)) {
781 $needToFetchEachLine++; // There is at least one compute field that use $object
782 }
783 }
784}
785
786// Loop on record
787// --------------------------------------------------------------------
788$i = 0;
789$savnbfield = $totalarray['nbfield'];
790$totalarray = array();
791$totalarray['nbfield'] = 0;
792$totalarray['val'] = array();
793$totalarray['val']['totalttcfield'] = 0;
794$imaxinloop = ($limit ? min($num, $limit) : $num);
795while ($i < $imaxinloop) {
796 $obj = $db->fetch_object($resql);
797 if (empty($obj)) {
798 break; // Should not happen
799 }
800
801 // Store properties in $object
802 $object->setVarsFromFetchObj($obj);
803
804 $userstatic->id = $obj->uid;
805 $userstatic->lastname = $obj->lastname;
806 $userstatic->firstname = $obj->firstname;
807 $userstatic->admin = $obj->admin;
808 $userstatic->login = $obj->login;
809 $userstatic->email = $obj->email;
810 $userstatic->socid = $obj->fk_soc;
811 $userstatic->statut = (int) $obj->status; // deprecated
812 $userstatic->status = (int) $obj->status;
813 $userstatic->photo = $obj->photo;
814
815 $salstatic->id = $obj->rowid;
816 $salstatic->ref = (string) $obj->rowid;
817 $salstatic->label = $obj->label;
818 $salstatic->paye = $obj->paye;
819 $salstatic->status = $obj->paye;
820 $salstatic->alreadypaid = $obj->alreadypayed;
821 $salstatic->totalpaid = $obj->alreadypayed;
822 $salstatic->datesp = $obj->datesp;
823 $salstatic->dateep = $obj->dateep;
824 $salstatic->amount = $obj->amount;
825 $salstatic->type_payment = $obj->payment_code;
826
827 if ($mode == 'kanban') {
828 if ($i == 0) {
829 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
830 print '<div class="box-flex-container kanban">';
831 }
832 // Output Kanban
833 $selected = 0;
834 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
835 $selected = 0;
836 if (in_array($object->id, $arrayofselected)) {
837 $selected = 1;
838 }
839 }
840 print $salstatic->getKanbanView('', array('user' => $userstatic, 'selected' => $selected));
841 if ($i == ($imaxinloop - 1)) {
842 print '</div>';
843 print '</td></tr>';
844 }
845 } else {
846 // Show here line of result
847 $j = 0;
848 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
849 // Action column
850 if ($conf->main_checkbox_left_column) {
851 print '<td class="nowrap center">';
852 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
853 $selected = 0;
854 if (in_array($object->id, $arrayofselected)) {
855 $selected = 1;
856 }
857 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
858 }
859 print '</td>';
860 if (!$i) {
861 $totalarray['nbfield']++;
862 }
863 }
864
865 // Ref
866 if (!empty($arrayfields['s.ref']['checked'])) {
867 print "<td>".$salstatic->getNomUrl(1)."</td>\n";
868 if (!$i) {
869 $totalarray['nbfield']++;
870 }
871 }
872
873 // Label payment
874 if (!empty($arrayfields['s.label']['checked'])) {
875 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).'">'.dol_escape_htmltag($obj->label)."</td>\n";
876 if (!$i) {
877 $totalarray['nbfield']++;
878 }
879 }
880
881 // Date Start
882 if (!empty($arrayfields['s.datesp']['checked'])) {
883 print '<td class="center">'.dol_print_date($db->jdate($obj->datesp), 'day')."</td>\n";
884 if (!$i) {
885 $totalarray['nbfield']++;
886 }
887 }
888
889 // Date End
890 if (!empty($arrayfields['s.dateep']['checked'])) {
891 print '<td class="center">'.dol_print_date($db->jdate($obj->dateep), 'day')."</td>\n";
892 if (!$i) {
893 $totalarray['nbfield']++;
894 }
895 }
896
897 // Employee
898 if (!empty($arrayfields['s.fk_user']['checked'])) {
899 print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1)."</td>\n";
900 if (!$i) {
901 $totalarray['nbfield']++;
902 }
903 }
904
905 // Payment mode
906 if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
907 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("PaymentTypeShort".$obj->payment_code)).'">';
908 if (!empty($obj->payment_code)) {
909 print $langs->trans("PaymentTypeShort".$obj->payment_code);
910 }
911 print '</td>';
912 if (!$i) {
913 $totalarray['nbfield']++;
914 }
915 }
916
917 // Account
918 if (isModEnabled("bank")) {
919 if (!empty($arrayfields['s.fk_account']['checked'])) {
920 print '<td>';
921 if ($obj->fk_account > 0) {
922 //$accountstatic->fetch($obj->fk_bank);
923 $accountstatic->id = $obj->bid;
924 $accountstatic->ref = $obj->bref;
925 $accountstatic->label = $obj->blabel;
926 $accountstatic->number = $obj->bnumber;
927 $accountstatic->iban = $obj->iban;
928 $accountstatic->bic = $obj->bic;
929 $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
930 $accountstatic->account_number = $obj->account_number;
931 $accountstatic->clos = $obj->clos;
932 $accountstatic->status = $obj->clos;
933
934 if (isModEnabled('accounting')) {
935 $accountstatic->account_number = $obj->account_number;
936
937 $accountingjournal = new AccountingJournal($db);
938 $accountingjournal->fetch($obj->fk_accountancy_journal);
939
940 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
941 }
942 //$accountstatic->label = $obj->blabel;
943 print $accountstatic->getNomUrl(1);
944 } else {
945 print '&nbsp;';
946 }
947 print '</td>';
948 if (!$i) {
949 $totalarray['nbfield']++;
950 }
951 }
952 }
953
954 // Extra fields
955 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
956
957 // Amount
958 if (!empty($arrayfields['s.amount']['checked'])) {
959 print '<td class="nowraponall right"><span class="amount">'.price($obj->amount).'</span></td>';
960 if (!$i) {
961 $totalarray['nbfield']++;
962 }
963 if (!$i) {
964 $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
965 }
966 $totalarray['val']['totalttcfield'] += $obj->amount;
967 }
968
969 // Status
970 if (!empty($arrayfields['s.paye']['checked'])) {
971 print '<td class="nowraponall center">'.$salstatic->getLibStatut(5, $obj->alreadypayed).'</td>';
972 if (!$i) {
973 $totalarray['nbfield']++;
974 }
975 }
976
977 // Fields from hook
978 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
979 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
980 print $hookmanager->resPrint;
981
982 // Action column
983 if (!$conf->main_checkbox_left_column) {
984 print '<td class="nowrap center">';
985 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
986 $selected = 0;
987 if (in_array($object->id, $arrayofselected)) {
988 $selected = 1;
989 }
990 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
991 }
992 print '</td>';
993 if (!$i) {
994 $totalarray['nbfield']++;
995 }
996 }
997
998 print '</tr>'."\n";
999 }
1000 $i++;
1001}
1002
1003// Show total line
1004include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1005
1006
1007// If no record found
1008if ($num == 0) {
1009 /*$colspan = 1;
1010 foreach ($arrayfields as $key => $val) {
1011 if (!empty($val['checked'])) {
1012 $colspan++;
1013 }
1014 }*/
1015 $colspan = 9;
1016 if (isModEnabled("bank")) {
1017 $colspan++;
1018 }
1019 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1020}
1021
1022
1023$db->free($resql);
1024
1025$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1026$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1027print $hookmanager->resPrint;
1028
1029print '</table>'."\n";
1030print '</div>'."\n";
1031
1032print '</form>'."\n";
1033
1034
1035// End of page
1036llxFooter();
1037$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:501
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
Class to manage bank accounts.
Class to manage accounting journals.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class to manage salary payments.
Class to manage Dolibarr users.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
Definition html.lib.php:172
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
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.