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('salary').")";
366if (!$user->hasRight('salaries', 'readall')) {
367 if (!$user->hasRight('salaries', 'readchild')) {
368 $sql .= " AND s.fk_user = ".(int) $user->id;
369 } else {
370 $sql .= " AND s.fk_user IN (".$db->sanitize(implode(',', $childids)).")";
371 }
372}
373
374//print $sql;
375
376// Search criteria
377if ($search_ref) {
378 $sql .= " AND s.rowid=".((int) $search_ref);
379}
380if ($search_user) {
381 $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
382}
383if ($search_label) {
384 $sql .= natural_search(array('s.label'), $search_label);
385}
386if (!empty($search_date_start_from)) {
387 $sql .= " AND s.datesp >= '".$db->idate($search_date_start_from)."'";
388}
389if (!empty($search_date_end_from)) {
390 $sql .= " AND s.dateep >= '".$db->idate($search_date_end_from)."'";
391}
392if (!empty($search_date_start_to)) {
393 $sql .= " AND s.datesp <= '".$db->idate($search_date_start_to)."'";
394}
395if (!empty($search_date_end_to)) {
396 $sql .= " AND s.dateep <= '".$db->idate($search_date_end_to)."'";
397}
398
399if ($search_amount) {
400 $sql .= natural_search("s.amount", $search_amount, 1);
401}
402if ($search_account > 0) {
403 $sql .= " AND s.fk_account=".((int) $search_account);
404}
405if ($search_status != '' && $search_status >= 0) {
406 $sql .= " AND s.paye = ".((int) $search_status);
407}
408if ($search_type_id) {
409 $sql .= " AND s.fk_typepayment=".((int) $search_type_id);
410}
411// Add where from extra fields
412include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
413$sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,";
414$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,";
415$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,";
416$sql .= " pst.code";
417// Add fields from extrafields
418if (!empty($extrafields->attributes[$object->table_element]['label'])) {
419 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
420 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
421 }
422}
423
424// Count total nb of records
425$nbtotalofrecords = '';
426if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
427 /* The fast and low memory method to get and count full list converts the sql into a sql count */
428 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
429 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
430 $resql = $db->query($sqlforcount);
431 if ($resql) {
432 $objforcount = $db->fetch_object($resql);
433 $nbtotalofrecords = $objforcount->nbtotalofrecords;
434 } else {
435 dol_print_error($db);
436 }
437
438 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
439 $page = 0;
440 $offset = 0;
441 }
442 $db->free($resql);
443}
444
445// Complete request and execute it with limit
446$sql .= $db->order($sortfield, $sortorder);
447if ($limit) {
448 $sql .= $db->plimit($limit + 1, $offset);
449}
450
451$resql = $db->query($sql);
452if (!$resql) {
453 dol_print_error($db);
454 exit;
455}
456
457$num = $db->num_rows($resql);
458
459
460// Direct jump if only one record found
461if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
462 $obj = $db->fetch_object($resql);
463 $id = $obj->rowid;
464 header("Location: ".DOL_URL_ROOT.'/salaries/card.php?id='.$id);
465 exit;
466}
467
468
469// Output page
470// --------------------------------------------------------------------
471
472llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
473
474$arrayofselected = is_array($toselect) ? $toselect : array();
475
476$param = '';
477if (!empty($mode)) {
478 $param .= '&mode='.urlencode($mode);
479}
480if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
481 $param .= '&contextpage='.urlencode($contextpage);
482}
483if ($limit > 0 && $limit != $conf->liste_limit) {
484 $param .= '&limit='.((int) $limit);
485}
486if ($search_type_id) {
487 $param .= '&search_type_id='.urlencode($search_type_id);
488}
489if ($optioncss != '') {
490 $param .= '&optioncss='.urlencode($optioncss);
491}
492if ($search_ref != '') {
493 $param .= '&search_ref='.urlencode($search_ref);
494}
495if ($search_user != '') {
496 $param .= '&search_user='.urlencode($search_user);
497}
498if ($search_label) {
499 $param .= '&search_label='.urlencode($search_label);
500}
501if ($search_account) {
502 $param .= '&search_account='.urlencode((string) ($search_account));
503}
504if ($search_status != '' && $search_status != '-1') {
505 $param .= '&search_status='.urlencode($search_status);
506}
507if (!empty($search_date_start_from)) {
508 $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'));
509}
510if (!empty($search_date_start_to)) {
511 $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'));
512}
513if (!empty($search_date_end_from)) {
514 $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'));
515}
516if (!empty($search_date_end_to)) {
517 $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'));
518}
519
520// Add $param from extra fields
521include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
522// Add $param from hooks
523$parameters = array('param' => &$param);
524$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
525$param .= $hookmanager->resPrint;
526
527// List of mass actions available
528$arrayofmassactions = array(
529 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
530 //'buildsepa'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("BuildSepa"), // TODO
531);
532if (!empty($permissiontodelete)) {
533 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
534}
535if (isModEnabled('paymentbybanktransfer') && $user->hasRight('paymentbybanktransfer', 'create')) {
536 $langs->load("withdrawals");
537 $arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeBankTransferOrder");
538}
539if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
540 $arrayofmassactions = array();
541}
542$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
543
544print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
545if ($optioncss != '') {
546 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
547}
548print '<input type="hidden" name="token" value="'.newToken().'">';
549print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
550print '<input type="hidden" name="action" value="list">';
551print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
552print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
553print '<input type="hidden" name="page" value="'.$page.'">';
554print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
555print '<input type="hidden" name="page_y" value="">';
556print '<input type="hidden" name="mode" value="'.$mode.'">';
557
558
559$url = DOL_URL_ROOT.'/salaries/card.php?action=create';
560if (!empty($socid)) {
561 $url .= '&socid='.$socid;
562}
563
564$newcardbutton = '';
565$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'));
566$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'));
567$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'));
568$newcardbutton .= dolGetButtonTitleSeparator();
569$newcardbutton .= dolGetButtonTitle($langs->trans('NewSalary'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
570
571print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
572
573// Add code for pre mass action (confirmation or email presend form)
574$topicmail = "SendSalaryRef";
575$modelmail = "salary";
576$objecttmp = new Salary($db);
577$trackid = 'sal'.$object->id;
578include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
579
580$moreforfilter = '';
581
582$parameters = array();
583$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
584if (empty($reshook)) {
585 $moreforfilter .= $hookmanager->resPrint;
586} else {
587 $moreforfilter = $hookmanager->resPrint;
588}
589
590if (!empty($moreforfilter)) {
591 print '<div class="liste_titre liste_titre_bydiv centpercent">';
592 print $moreforfilter;
593 print '</div>';
594}
595
596$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
597$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
598$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
599$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
600
601print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
602print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
603
604// Fields title search
605// --------------------------------------------------------------------
606print '<tr class="liste_titre_filter">';
607// Action column
608if ($conf->main_checkbox_left_column) {
609 print '<td class="liste_titre center maxwidthsearch">';
610 $searchpicto = $form->showFilterButtons('left');
611 print $searchpicto;
612 print '</td>';
613}
614// Ref
615if (!empty($arrayfields['s.ref']['checked'])) {
616 print '<td class="liste_titre left">';
617 print '<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).'">';
618 print '</td>';
619}
620
621// Label
622if (!empty($arrayfields['s.label']['checked'])) {
623 print '<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$db->escape($search_label).'"></td>';
624}
625
626// Date start
627if (!empty($arrayfields['s.datesp']['checked'])) {
628 print '<td class="liste_titre center">';
629 print '<div class="nowrapfordate">';
630 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'));
631 print '</div>';
632 print '<div class="nowrapfordate">';
633 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'));
634 print '</div>';
635 print '</td>';
636}
637
638// Date End
639if (!empty($arrayfields['s.dateep']['checked'])) {
640 print '<td class="liste_titre center">';
641 print '<div class="nowrapfordate">';
642 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'));
643 print '</div>';
644 print '<div class="nowrapfordate">';
645 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'));
646 print '</div>';
647 print '</td>';
648}
649
650// Employee
651if (!empty($arrayfields['s.fk_user']['checked'])) {
652 print '<td class="liste_titre">';
653 print '<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).'">';
654 print '</td>';
655}
656
657// Type
658if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
659 print '<td class="liste_titre left">';
660 print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth125', 1);
661 print '</td>';
662}
663
664// Bank account
665if (isModEnabled("bank")) {
666 if (!empty($arrayfields['s.fk_account']['checked'])) {
667 print '<td class="liste_titre">';
668 print $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth125', 1);
669 print '</td>';
670 }
671}
672
673// Extra fields
674include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
675
676// Amount
677if (!empty($arrayfields['s.amount']['checked'])) {
678 print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).'"></td>';
679}
680
681// Status
682if (!empty($arrayfields['s.paye']['checked'])) {
683 print '<td class="liste_titre center parentonrightofpage">';
684 $liststatus = array('0' => $langs->trans("Unpaid"), '1' => $langs->trans("Paid"));
685 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
686 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
687 print '</td>';
688}
689
690// Fields from hook
691$parameters = array('arrayfields' => $arrayfields);
692$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
693print $hookmanager->resPrint;
694// Action column
695if (!$conf->main_checkbox_left_column) {
696 print '<td class="liste_titre center maxwidthsearch">';
697 $searchpicto = $form->showFilterButtons();
698 print $searchpicto;
699 print '</td>';
700}
701print '</tr>'."\n";
702
703$totalarray = array();
704$totalarray['nbfield'] = 0;
705
706// Fields title label
707// --------------------------------------------------------------------
708print '<tr class="liste_titre">';
709// Action column
710if ($conf->main_checkbox_left_column) {
711 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
712 $totalarray['nbfield']++;
713}
714
715if (!empty($arrayfields['s.ref']['checked'])) {
716 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
717 $totalarray['nbfield']++;
718}
719
720if (!empty($arrayfields['s.label']['checked'])) {
721 print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, '', $sortfield, $sortorder);
722 $totalarray['nbfield']++;
723}
724
725if (!empty($arrayfields['s.datesp']['checked'])) {
726 print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
727 $totalarray['nbfield']++;
728}
729
730if (!empty($arrayfields['s.dateep']['checked'])) {
731 print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "s.dateep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
732 $totalarray['nbfield']++;
733}
734
735if (!empty($arrayfields['s.fk_user']['checked'])) {
736 print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, "", $sortfield, $sortorder);
737 $totalarray['nbfield']++;
738}
739
740if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
741 print_liste_field_titre("DefaultPaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder);
742 $totalarray['nbfield']++;
743}
744
745if (isModEnabled("bank")) {
746 if (!empty($arrayfields['s.fk_account']['checked'])) {
747 print_liste_field_titre("DefaultBankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
748 $totalarray['nbfield']++;
749 }
750}
751
752// Extra fields
753include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
754
755if (!empty($arrayfields['s.amount']['checked'])) {
756 print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "s.amount", "", $param, '', $sortfield, $sortorder, 'right ');
757 $totalarray['nbfield']++;
758}
759
760if (!empty($arrayfields['s.paye']['checked'])) {
761 print_liste_field_titre('Status', $_SERVER["PHP_SELF"], "s.paye", '', $param, '', $sortfield, $sortorder, 'center ');
762 $totalarray['nbfield']++;
763}
764
765// Hook fields
766$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
767$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
768print $hookmanager->resPrint;
769// Action column
770if (!$conf->main_checkbox_left_column) {
771 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
772 $totalarray['nbfield']++;
773}
774print '</tr>'."\n";
775
776
777// Detect if we need a fetch on each output line
778$needToFetchEachLine = 0;
779if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
780 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
781 if (!is_null($val) && preg_match('/\$object/', $val)) {
782 $needToFetchEachLine++; // There is at least one compute field that use $object
783 }
784 }
785}
786
787// Loop on record
788// --------------------------------------------------------------------
789$i = 0;
790$savnbfield = $totalarray['nbfield'];
791$totalarray = array();
792$totalarray['nbfield'] = 0;
793$totalarray['val'] = array();
794$totalarray['val']['totalttcfield'] = 0;
795$imaxinloop = ($limit ? min($num, $limit) : $num);
796while ($i < $imaxinloop) {
797 $obj = $db->fetch_object($resql);
798 if (empty($obj)) {
799 break; // Should not happen
800 }
801
802 // Store properties in $object
803 $object->setVarsFromFetchObj($obj);
804
805 $userstatic->id = $obj->uid;
806 $userstatic->lastname = $obj->lastname;
807 $userstatic->firstname = $obj->firstname;
808 $userstatic->admin = $obj->admin;
809 $userstatic->login = $obj->login;
810 $userstatic->email = $obj->email;
811 $userstatic->socid = $obj->fk_soc;
812 $userstatic->statut = (int) $obj->status; // deprecated
813 $userstatic->status = (int) $obj->status;
814 $userstatic->photo = $obj->photo;
815
816 $salstatic->id = $obj->rowid;
817 $salstatic->ref = (string) $obj->rowid;
818 $salstatic->label = $obj->label;
819 $salstatic->paye = $obj->paye;
820 $salstatic->status = $obj->paye;
821 $salstatic->alreadypaid = $obj->alreadypayed;
822 $salstatic->totalpaid = $obj->alreadypayed;
823 $salstatic->datesp = $obj->datesp;
824 $salstatic->dateep = $obj->dateep;
825 $salstatic->amount = $obj->amount;
826 $salstatic->type_payment = $obj->payment_code;
827
828 if ($mode == 'kanban') {
829 if ($i == 0) {
830 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
831 print '<div class="box-flex-container kanban">';
832 }
833 // Output Kanban
834 $selected = 0;
835 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
836 $selected = 0;
837 if (in_array($object->id, $arrayofselected)) {
838 $selected = 1;
839 }
840 }
841 print $salstatic->getKanbanView('', array('user' => $userstatic, 'selected' => $selected));
842 if ($i == ($imaxinloop - 1)) {
843 print '</div>';
844 print '</td></tr>';
845 }
846 } else {
847 // Show here line of result
848 $j = 0;
849 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
850 // Action column
851 if ($conf->main_checkbox_left_column) {
852 print '<td class="nowrap center">';
853 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
854 $selected = 0;
855 if (in_array($object->id, $arrayofselected)) {
856 $selected = 1;
857 }
858 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
859 }
860 print '</td>';
861 if (!$i) {
862 $totalarray['nbfield']++;
863 }
864 }
865
866 // Ref
867 if (!empty($arrayfields['s.ref']['checked'])) {
868 print "<td>".$salstatic->getNomUrl(1)."</td>\n";
869 if (!$i) {
870 $totalarray['nbfield']++;
871 }
872 }
873
874 // Label payment
875 if (!empty($arrayfields['s.label']['checked'])) {
876 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).'"><span class="spantitle">'.dol_escape_htmltag($obj->label)."</span></td>\n";
877 if (!$i) {
878 $totalarray['nbfield']++;
879 }
880 }
881
882 // Date Start
883 if (!empty($arrayfields['s.datesp']['checked'])) {
884 print '<td class="center">'.dol_print_date($db->jdate($obj->datesp), 'day')."</td>\n";
885 if (!$i) {
886 $totalarray['nbfield']++;
887 }
888 }
889
890 // Date End
891 if (!empty($arrayfields['s.dateep']['checked'])) {
892 print '<td class="center">'.dol_print_date($db->jdate($obj->dateep), 'day')."</td>\n";
893 if (!$i) {
894 $totalarray['nbfield']++;
895 }
896 }
897
898 // Employee
899 if (!empty($arrayfields['s.fk_user']['checked'])) {
900 print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1)."</td>\n";
901 if (!$i) {
902 $totalarray['nbfield']++;
903 }
904 }
905
906 // Payment mode
907 if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
908 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("PaymentTypeShort".$obj->payment_code)).'">';
909 if (!empty($obj->payment_code)) {
910 print $langs->trans("PaymentTypeShort".$obj->payment_code);
911 }
912 print '</td>';
913 if (!$i) {
914 $totalarray['nbfield']++;
915 }
916 }
917
918 // Account
919 if (isModEnabled("bank")) {
920 if (!empty($arrayfields['s.fk_account']['checked'])) {
921 print '<td>';
922 if ($obj->fk_account > 0) {
923 //$accountstatic->fetch($obj->fk_bank);
924 $accountstatic->id = $obj->bid;
925 $accountstatic->ref = $obj->bref;
926 $accountstatic->label = $obj->blabel;
927 $accountstatic->number = $obj->bnumber;
928 $accountstatic->iban = $obj->iban;
929 $accountstatic->bic = $obj->bic;
930 $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
931 $accountstatic->account_number = $obj->account_number;
932 $accountstatic->clos = $obj->clos;
933 $accountstatic->status = $obj->clos;
934
935 if (isModEnabled('accounting')) {
936 $accountstatic->account_number = $obj->account_number;
937
938 $accountingjournal = new AccountingJournal($db);
939 $accountingjournal->fetch($obj->fk_accountancy_journal);
940
941 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
942 }
943 //$accountstatic->label = $obj->blabel;
944 print $accountstatic->getNomUrl(1);
945 } else {
946 print '&nbsp;';
947 }
948 print '</td>';
949 if (!$i) {
950 $totalarray['nbfield']++;
951 }
952 }
953 }
954
955 // Extra fields
956 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
957
958 // Amount
959 if (!empty($arrayfields['s.amount']['checked'])) {
960 print '<td class="nowraponall right"><span class="amount">'.price($obj->amount).'</span></td>';
961 if (!$i) {
962 $totalarray['nbfield']++;
963 }
964 if (!$i) {
965 $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
966 }
967 $totalarray['val']['totalttcfield'] += $obj->amount;
968 }
969
970 // Status
971 if (!empty($arrayfields['s.paye']['checked'])) {
972 print '<td class="nowraponall center">'.$salstatic->getLibStatut(5, $obj->alreadypayed).'</td>';
973 if (!$i) {
974 $totalarray['nbfield']++;
975 }
976 }
977
978 // Fields from hook
979 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
980 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
981 print $hookmanager->resPrint;
982
983 // Action column
984 if (!$conf->main_checkbox_left_column) {
985 print '<td class="nowrap center">';
986 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
987 $selected = 0;
988 if (in_array($object->id, $arrayofselected)) {
989 $selected = 1;
990 }
991 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
992 }
993 print '</td>';
994 if (!$i) {
995 $totalarray['nbfield']++;
996 }
997 }
998
999 print '</tr>'."\n";
1000 }
1001 $i++;
1002}
1003
1004// Show total line
1005include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1006
1007
1008// If no record found
1009if ($num == 0) {
1010 /*$colspan = 1;
1011 foreach ($arrayfields as $key => $val) {
1012 if (!empty($val['checked'])) {
1013 $colspan++;
1014 }
1015 }*/
1016 $colspan = 9;
1017 if (isModEnabled("bank")) {
1018 $colspan++;
1019 }
1020 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1021}
1022
1023
1024$db->free($resql);
1025
1026$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1027$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1028print $hookmanager->resPrint;
1029
1030print '</table>'."\n";
1031print '</div>'."\n";
1032
1033print '</form>'."\n";
1034
1035
1036// End of page
1037llxFooter();
1038$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
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
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
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, $currencycode='')
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.
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Definition html.lib.php:183
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.