dolibarr 24.0.0-beta
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
150$object->fields = dol_sort_array($object->fields, 'position');
151$arrayfields = dol_sort_array($arrayfields, 'position');
152
153$permissiontoread = $user->hasRight('salaries', 'read');
154$permissiontoadd = $user->hasRight('salaries', 'write');
155$permissiontodelete = $user->hasRight('salaries', 'delete');
156
157$error = 0;
158
159// Security check
160$socid = GETPOSTINT("socid");
161if ($user->socid) {
162 $socid = $user->socid;
163}
164restrictedArea($user, 'salaries', '', 'salary', '');
165
166
167/*
168 * Actions
169 */
170
171if (GETPOST('cancel', 'alpha')) {
172 $action = 'list';
173 $massaction = '';
174}
175if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
176 $massaction = '';
177}
178
179//credit transfer request
180if ($massaction == 'withdrawrequest') {
181 $langs->load("withdrawals");
182
183 if (!$user->hasRight('paymentbybanktransfer', 'create')) {
184 $error++;
185 setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
186 } else {
187 //Checking error
188 $error = 0;
189 $listofSalries = array();
190 $arrayofselected = is_array($toselect) ? $toselect : array();
191 foreach ($arrayofselected as $toselectid) {
192 $objecttmp = new Salary($db);
193 $result = $objecttmp->fetch($toselectid);
194 if ($result > 0) {
195 $totalpaid = (float) $objecttmp->getSommePaiement();
196 $objecttmp->resteapayer = (float) price2num((float) $objecttmp->amount - $totalpaid, 'MT');
197
198 // hook to finalize the remaining amount, considering e.g. cash discount agreements
199 $parameters = array('remaintopay' => $objecttmp->resteapayer);
200 $reshook = $hookmanager->executeHooks('finalizeAmountOfInvoice', $parameters, $objecttmp, $action); // Note that $action and $object may have been modified by some hooks
201 if ($reshook > 0) {
202 if (!empty($remaintopay = $hookmanager->resArray['remaintopay'])) {
203 $objecttmp->resteapayer = $remaintopay;
204 }
205 } elseif ($reshook < 0) {
206 $error++;
207 setEventMessages($objecttmp->ref.' '.$langs->trans("ProcessingError"), $hookmanager->errors, 'errors');
208 }
209
210 if ($objecttmp->status == Salary::STATUS_PAID || $objecttmp->resteapayer == 0) {
211 $error++;
212 setEventMessages($langs->trans("Salary").' '.$objecttmp->ref.' : '.$langs->trans("AlreadyPaid"), $objecttmp->errors, 'errors');
213 } elseif ($objecttmp->resteapayer < 0) {
214 $error++;
215 setEventMessages($langs->trans("Salary").' '.$objecttmp->ref.' : '.$langs->trans("AmountMustBePositive"), $objecttmp->errors, 'errors');
216 }
217
218 $rsql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
219 $rsql .= " , pfd.date_traite as date_traite";
220 $rsql .= " , pfd.amount";
221 $rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
222 $rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
223 $rsql .= " , ".MAIN_DB_PREFIX."user as u";
224 $rsql .= " WHERE fk_salary = ".((int) $objecttmp->id);
225 $rsql .= " AND pfd.fk_user_demande = u.rowid";
226 $rsql .= " AND pfd.traite = 0";
227 $rsql .= " ORDER BY pfd.date_demande DESC";
228
229 $numprlv = 0;
230 $result_sql = $db->query($rsql);
231 if ($result_sql) {
232 $numprlv = $db->num_rows($result_sql);
233 }
234
235 if ($numprlv > 0) {
236 //$error++; // Not an error, a simple warning we can ignore
237 setEventMessages($langs->trans("Salary").' '.$objecttmp->ref.' : '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings');
238 } elseif (!empty($objecttmp->type_payment_code) && $objecttmp->type_payment_code != 'VIR') {
239 $langs->load("errors");
240 $error++;
241 setEventMessages($langs->trans("Salary").' '.$objecttmp->ref.' : '.$langs->trans("ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors, 'errors');
242 } else {
243 $listofSalries[] = $objecttmp;
244 }
245 }
246 }
247
248 // Now process all record not in error
249 if (!$error && !empty($listofSalries)) {
250 $nbwithdrawrequestok = 0;
251 foreach ($listofSalries as $salary) {
252 $db->begin();
253 $result = $salary->demande_prelevement($user, (float) $salary->resteapayer, 'salaire');
254 if ($result > 0) {
255 $db->commit();
256 $nbwithdrawrequestok++;
257 } else {
258 $db->rollback();
259 setEventMessages($salary->error, $salary->errors, 'errors');
260 }
261 }
262 if ($nbwithdrawrequestok > 0) {
263 setEventMessages($langs->trans("WithdrawRequestsDone", $nbwithdrawrequestok), null, 'mesgs');
264 }
265 }
266 }
267}
268
269$parameters = array();
270$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
271if ($reshook < 0) {
272 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
273}
274
275if (empty($reshook)) {
276 // Selection of new fields
277 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
278
279 // Purge search criteria
280 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
281 $search_ref = "";
282 $search_user = "";
283 $search_label = "";
284 $search_date_start_from = '';
285 $search_date_start_to = '';
286 $search_date_end_from = '';
287 $search_date_end_to = '';
288 $search_date_end = '';
289 $search_amount = "";
290 $search_account = '';
291 $search_status = '';
292 $search_type_id = "";
293 }
294 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
295 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
296 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
297 }
298
299 // Mass actions
300 $objectclass = 'Salary';
301 $objectlabel = 'Salaries';
302 $uploaddir = $conf->salaries->dir_output;
303 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
304
305 // Validate records
306 if (!$error && $massaction == 'buildsepa' && $permissiontoadd) {
307 $objecttmp = new $objectclass($db);
308
309 // TODO
310 }
311}
312
313/*
314 * View
315 */
316
317$form = new Form($db);
318$salstatic = new Salary($db);
319$userstatic = new User($db);
320$accountstatic = new Account($db);
321
322$now = dol_now();
323
324$title = $langs->trans('Salaries');
325//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials";
326$help_url = '';
327$morejs = array();
328$morecss = array();
329
330// Build and execute select
331// --------------------------------------------------------------------
332$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,";
333$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, ";
334$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,";
335$sql .= " pst.code as payment_code,";
336$sql .= " SUM(ps.amount) as alreadypayed";
337// Add fields from extrafields
338if (!empty($extrafields->attributes[$object->table_element]['label'])) {
339 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
340 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
341 }
342}
343// Add fields from hooks
344$parameters = array();
345$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
346$sql .= $hookmanager->resPrint;
347$sql = preg_replace('/,\s*$/', '', $sql);
348//$sql .= ", COUNT(rc.rowid) as anotherfield";
349
350$sqlfields = $sql; // $sql fields to remove for count total
351
352$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
353if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
354 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)";
355}
356$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (ps.fk_salary = s.rowid) ";
357$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON (s.fk_typepayment = pst.id) ";
358$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account ba ON (ba.rowid = s.fk_account), ";
359//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON ps.fk_salary = s.rowid, ";
360$sql .= " ".MAIN_DB_PREFIX."user as u";
361$sql .= " WHERE u.rowid = s.fk_user";
362$sql .= " AND s.entity IN (".getEntity('salaries').")";
363if (!$user->hasRight('salaries', 'readchild')) {
364 $sql .= " AND s.fk_user = ".(int) $user->id;
365}
366if (!$user->hasRight('salaries', 'readall')) {
367 $sql .= " AND s.fk_user IN (".$db->sanitize(implode(',', $childids)).")";
368}
369
370//print $sql;
371
372// Search criteria
373if ($search_ref) {
374 $sql .= " AND s.rowid=".((int) $search_ref);
375}
376if ($search_user) {
377 $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
378}
379if ($search_label) {
380 $sql .= natural_search(array('s.label'), $search_label);
381}
382if (!empty($search_date_start_from)) {
383 $sql .= " AND s.datesp >= '".$db->idate($search_date_start_from)."'";
384}
385if (!empty($search_date_end_from)) {
386 $sql .= " AND s.dateep >= '".$db->idate($search_date_end_from)."'";
387}
388if (!empty($search_date_start_to)) {
389 $sql .= " AND s.datesp <= '".$db->idate($search_date_start_to)."'";
390}
391if (!empty($search_date_end_to)) {
392 $sql .= " AND s.dateep <= '".$db->idate($search_date_end_to)."'";
393}
394
395if ($search_amount) {
396 $sql .= natural_search("s.amount", $search_amount, 1);
397}
398if ($search_account > 0) {
399 $sql .= " AND s.fk_account=".((int) $search_account);
400}
401if ($search_status != '' && $search_status >= 0) {
402 $sql .= " AND s.paye = ".((int) $search_status);
403}
404if ($search_type_id) {
405 $sql .= " AND s.fk_typepayment=".((int) $search_type_id);
406}
407// Add where from extra fields
408include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
409$sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,";
410$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,";
411$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,";
412$sql .= " pst.code";
413// Add fields from extrafields
414if (!empty($extrafields->attributes[$object->table_element]['label'])) {
415 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
416 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
417 }
418}
419
420// Count total nb of records
421$nbtotalofrecords = '';
422if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
423 /* The fast and low memory method to get and count full list converts the sql into a sql count */
424 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
425 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
426 $resql = $db->query($sqlforcount);
427 if ($resql) {
428 $objforcount = $db->fetch_object($resql);
429 $nbtotalofrecords = $objforcount->nbtotalofrecords;
430 } else {
432 }
433
434 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
435 $page = 0;
436 $offset = 0;
437 }
438 $db->free($resql);
439}
440
441// Complete request and execute it with limit
442$sql .= $db->order($sortfield, $sortorder);
443if ($limit) {
444 $sql .= $db->plimit($limit + 1, $offset);
445}
446
447$resql = $db->query($sql);
448if (!$resql) {
450 exit;
451}
452
453$num = $db->num_rows($resql);
454
455
456// Direct jump if only one record found
457if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
458 $obj = $db->fetch_object($resql);
459 $id = $obj->rowid;
460 header("Location: ".DOL_URL_ROOT.'/salaries/card.php?id='.$id);
461 exit;
462}
463
464
465// Output page
466// --------------------------------------------------------------------
467
468llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
469
470$arrayofselected = is_array($toselect) ? $toselect : array();
471
472$param = '';
473if (!empty($mode)) {
474 $param .= '&mode='.urlencode($mode);
475}
476if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
477 $param .= '&contextpage='.urlencode($contextpage);
478}
479if ($limit > 0 && $limit != $conf->liste_limit) {
480 $param .= '&limit='.((int) $limit);
481}
482if ($search_type_id) {
483 $param .= '&search_type_id='.urlencode($search_type_id);
484}
485if ($optioncss != '') {
486 $param .= '&optioncss='.urlencode($optioncss);
487}
488if ($search_ref != '') {
489 $param .= '&search_ref='.urlencode($search_ref);
490}
491if ($search_user != '') {
492 $param .= '&search_user='.urlencode($search_user);
493}
494if ($search_label) {
495 $param .= '&search_label='.urlencode($search_label);
496}
497if ($search_account) {
498 $param .= '&search_account='.urlencode((string) ($search_account));
499}
500if ($search_status != '' && $search_status != '-1') {
501 $param .= '&search_status='.urlencode($search_status);
502}
503if (!empty($search_date_start_from)) {
504 $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'));
505}
506if (!empty($search_date_start_to)) {
507 $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'));
508}
509if (!empty($search_date_end_from)) {
510 $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'));
511}
512if (!empty($search_date_end_to)) {
513 $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'));
514}
515
516// Add $param from extra fields
517include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
518// Add $param from hooks
519$parameters = array('param' => &$param);
520$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
521$param .= $hookmanager->resPrint;
522
523// List of mass actions available
524$arrayofmassactions = array(
525 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
526 //'buildsepa'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("BuildSepa"), // TODO
527);
528if (!empty($permissiontodelete)) {
529 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
530}
531if (isModEnabled('paymentbybanktransfer') && $user->hasRight('paymentbybanktransfer', 'create')) {
532 $langs->load("withdrawals");
533 $arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeBankTransferOrder");
534}
535if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
536 $arrayofmassactions = array();
537}
538$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
539
540print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
541if ($optioncss != '') {
542 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
543}
544print '<input type="hidden" name="token" value="'.newToken().'">';
545print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
546print '<input type="hidden" name="action" value="list">';
547print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
548print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
549print '<input type="hidden" name="page" value="'.$page.'">';
550print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
551print '<input type="hidden" name="page_y" value="">';
552print '<input type="hidden" name="mode" value="'.$mode.'">';
553
554
555$url = DOL_URL_ROOT.'/salaries/card.php?action=create';
556if (!empty($socid)) {
557 $url .= '&socid='.$socid;
558}
559
560$newcardbutton = '';
561$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'));
562$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'));
563$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'));
564$newcardbutton .= dolGetButtonTitleSeparator();
565$newcardbutton .= dolGetButtonTitle($langs->trans('NewSalary'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
566
567print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
568
569// Add code for pre mass action (confirmation or email presend form)
570$topicmail = "SendSalaryRef";
571$modelmail = "salary";
572$objecttmp = new Salary($db);
573$trackid = 'sal'.$object->id;
574include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
575
576$moreforfilter = '';
577
578$parameters = array();
579$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
580if (empty($reshook)) {
581 $moreforfilter .= $hookmanager->resPrint;
582} else {
583 $moreforfilter = $hookmanager->resPrint;
584}
585
586if (!empty($moreforfilter)) {
587 print '<div class="liste_titre liste_titre_bydiv centpercent">';
588 print $moreforfilter;
589 print '</div>';
590}
591
592$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
593$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
594$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
595$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
596
597print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
598print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
599
600// Fields title search
601// --------------------------------------------------------------------
602print '<tr class="liste_titre_filter">';
603// Action column
604if ($conf->main_checkbox_left_column) {
605 print '<td class="liste_titre center maxwidthsearch">';
606 $searchpicto = $form->showFilterButtons('left');
607 print $searchpicto;
608 print '</td>';
609}
610// Ref
611if (!empty($arrayfields['s.ref']['checked'])) {
612 print '<td class="liste_titre left">';
613 print '<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).'">';
614 print '</td>';
615}
616
617// Label
618if (!empty($arrayfields['s.label']['checked'])) {
619 print '<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$db->escape($search_label).'"></td>';
620}
621
622// Date start
623if (!empty($arrayfields['s.datesp']['checked'])) {
624 print '<td class="liste_titre center">';
625 print '<div class="nowrapfordate">';
626 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'));
627 print '</div>';
628 print '<div class="nowrapfordate">';
629 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'));
630 print '</div>';
631 print '</td>';
632}
633
634// Date End
635if (!empty($arrayfields['s.dateep']['checked'])) {
636 print '<td class="liste_titre center">';
637 print '<div class="nowrapfordate">';
638 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'));
639 print '</div>';
640 print '<div class="nowrapfordate">';
641 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'));
642 print '</div>';
643 print '</td>';
644}
645
646// Employee
647if (!empty($arrayfields['s.fk_user']['checked'])) {
648 print '<td class="liste_titre">';
649 print '<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).'">';
650 print '</td>';
651}
652
653// Type
654if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
655 print '<td class="liste_titre left">';
656 print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth125', 1);
657 print '</td>';
658}
659
660// Bank account
661if (isModEnabled("bank")) {
662 if (!empty($arrayfields['s.fk_account']['checked'])) {
663 print '<td class="liste_titre">';
664 print $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth125', 1);
665 print '</td>';
666 }
667}
668
669// Extra fields
670include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
671
672// Amount
673if (!empty($arrayfields['s.amount']['checked'])) {
674 print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).'"></td>';
675}
676
677// Status
678if (!empty($arrayfields['s.paye']['checked'])) {
679 print '<td class="liste_titre center parentonrightofpage">';
680 $liststatus = array('0' => $langs->trans("Unpaid"), '1' => $langs->trans("Paid"));
681 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
682 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
683 print '</td>';
684}
685
686// Fields from hook
687$parameters = array('arrayfields' => $arrayfields);
688$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
689print $hookmanager->resPrint;
690// Action column
691if (!$conf->main_checkbox_left_column) {
692 print '<td class="liste_titre center maxwidthsearch">';
693 $searchpicto = $form->showFilterButtons();
694 print $searchpicto;
695 print '</td>';
696}
697print '</tr>'."\n";
698
699$totalarray = array();
700$totalarray['nbfield'] = 0;
701
702// Fields title label
703// --------------------------------------------------------------------
704print '<tr class="liste_titre">';
705// Action column
706if ($conf->main_checkbox_left_column) {
707 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
708 $totalarray['nbfield']++;
709}
710
711if (!empty($arrayfields['s.ref']['checked'])) {
712 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
713 $totalarray['nbfield']++;
714}
715
716if (!empty($arrayfields['s.label']['checked'])) {
717 print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, '', $sortfield, $sortorder);
718 $totalarray['nbfield']++;
719}
720
721if (!empty($arrayfields['s.datesp']['checked'])) {
722 print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
723 $totalarray['nbfield']++;
724}
725
726if (!empty($arrayfields['s.dateep']['checked'])) {
727 print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "s.dateep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
728 $totalarray['nbfield']++;
729}
730
731if (!empty($arrayfields['s.fk_user']['checked'])) {
732 print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, "", $sortfield, $sortorder);
733 $totalarray['nbfield']++;
734}
735
736if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
737 print_liste_field_titre("DefaultPaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder);
738 $totalarray['nbfield']++;
739}
740
741if (isModEnabled("bank")) {
742 if (!empty($arrayfields['s.fk_account']['checked'])) {
743 print_liste_field_titre("DefaultBankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
744 $totalarray['nbfield']++;
745 }
746}
747
748// Extra fields
749include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
750
751if (!empty($arrayfields['s.amount']['checked'])) {
752 print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "s.amount", "", $param, '', $sortfield, $sortorder, 'right ');
753 $totalarray['nbfield']++;
754}
755
756if (!empty($arrayfields['s.paye']['checked'])) {
757 print_liste_field_titre('Status', $_SERVER["PHP_SELF"], "s.paye", '', $param, '', $sortfield, $sortorder, 'center ');
758 $totalarray['nbfield']++;
759}
760
761// Hook fields
762$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
763$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
764print $hookmanager->resPrint;
765// Action column
766if (!$conf->main_checkbox_left_column) {
767 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
768 $totalarray['nbfield']++;
769}
770print '</tr>'."\n";
771
772
773// Detect if we need a fetch on each output line
774$needToFetchEachLine = 0;
775if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
776 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
777 if (!is_null($val) && preg_match('/\$object/', $val)) {
778 $needToFetchEachLine++; // There is at least one compute field that use $object
779 }
780 }
781}
782
783// Loop on record
784// --------------------------------------------------------------------
785$i = 0;
786$savnbfield = $totalarray['nbfield'];
787$totalarray = array();
788$totalarray['nbfield'] = 0;
789$totalarray['val'] = array();
790$totalarray['val']['totalttcfield'] = 0;
791$imaxinloop = ($limit ? min($num, $limit) : $num);
792while ($i < $imaxinloop) {
793 $obj = $db->fetch_object($resql);
794 if (empty($obj)) {
795 break; // Should not happen
796 }
797
798 // Store properties in $object
799 $object->setVarsFromFetchObj($obj);
800
801 $userstatic->id = $obj->uid;
802 $userstatic->lastname = $obj->lastname;
803 $userstatic->firstname = $obj->firstname;
804 $userstatic->admin = $obj->admin;
805 $userstatic->login = $obj->login;
806 $userstatic->email = $obj->email;
807 $userstatic->socid = $obj->fk_soc;
808 $userstatic->statut = (int) $obj->status; // deprecated
809 $userstatic->status = (int) $obj->status;
810 $userstatic->photo = $obj->photo;
811
812 $salstatic->id = $obj->rowid;
813 $salstatic->ref = (string) $obj->rowid;
814 $salstatic->label = $obj->label;
815 $salstatic->paye = $obj->paye;
816 $salstatic->status = $obj->paye;
817 $salstatic->alreadypaid = $obj->alreadypayed;
818 $salstatic->totalpaid = $obj->alreadypayed;
819 $salstatic->datesp = $obj->datesp;
820 $salstatic->dateep = $obj->dateep;
821 $salstatic->amount = $obj->amount;
822 $salstatic->type_payment = $obj->payment_code;
823
824 if ($mode == 'kanban') {
825 if ($i == 0) {
826 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
827 print '<div class="box-flex-container kanban">';
828 }
829 // Output Kanban
830 $selected = 0;
831 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
832 $selected = 0;
833 if (in_array($object->id, $arrayofselected)) {
834 $selected = 1;
835 }
836 }
837 print $salstatic->getKanbanView('', array('user' => $userstatic, 'selected' => $selected));
838 if ($i == ($imaxinloop - 1)) {
839 print '</div>';
840 print '</td></tr>';
841 }
842 } else {
843 // Show here line of result
844 $j = 0;
845 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
846 // Action column
847 if ($conf->main_checkbox_left_column) {
848 print '<td class="nowrap center">';
849 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
850 $selected = 0;
851 if (in_array($object->id, $arrayofselected)) {
852 $selected = 1;
853 }
854 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
855 }
856 print '</td>';
857 if (!$i) {
858 $totalarray['nbfield']++;
859 }
860 }
861
862 // Ref
863 if (!empty($arrayfields['s.ref']['checked'])) {
864 print "<td>".$salstatic->getNomUrl(1)."</td>\n";
865 if (!$i) {
866 $totalarray['nbfield']++;
867 }
868 }
869
870 // Label payment
871 if (!empty($arrayfields['s.label']['checked'])) {
872 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).'">'.dol_escape_htmltag($obj->label)."</td>\n";
873 if (!$i) {
874 $totalarray['nbfield']++;
875 }
876 }
877
878 // Date Start
879 if (!empty($arrayfields['s.datesp']['checked'])) {
880 print '<td class="center">'.dol_print_date($db->jdate($obj->datesp), 'day')."</td>\n";
881 if (!$i) {
882 $totalarray['nbfield']++;
883 }
884 }
885
886 // Date End
887 if (!empty($arrayfields['s.dateep']['checked'])) {
888 print '<td class="center">'.dol_print_date($db->jdate($obj->dateep), 'day')."</td>\n";
889 if (!$i) {
890 $totalarray['nbfield']++;
891 }
892 }
893
894 // Employee
895 if (!empty($arrayfields['s.fk_user']['checked'])) {
896 print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1)."</td>\n";
897 if (!$i) {
898 $totalarray['nbfield']++;
899 }
900 }
901
902 // Payment mode
903 if (!empty($arrayfields['s.fk_typepayment']['checked'])) {
904 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("PaymentTypeShort".$obj->payment_code)).'">';
905 if (!empty($obj->payment_code)) {
906 print $langs->trans("PaymentTypeShort".$obj->payment_code);
907 }
908 print '</td>';
909 if (!$i) {
910 $totalarray['nbfield']++;
911 }
912 }
913
914 // Account
915 if (isModEnabled("bank")) {
916 if (!empty($arrayfields['s.fk_account']['checked'])) {
917 print '<td>';
918 if ($obj->fk_account > 0) {
919 //$accountstatic->fetch($obj->fk_bank);
920 $accountstatic->id = $obj->bid;
921 $accountstatic->ref = $obj->bref;
922 $accountstatic->label = $obj->blabel;
923 $accountstatic->number = $obj->bnumber;
924 $accountstatic->iban = $obj->iban;
925 $accountstatic->bic = $obj->bic;
926 $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
927 $accountstatic->account_number = $obj->account_number;
928 $accountstatic->clos = $obj->clos;
929 $accountstatic->status = $obj->clos;
930
931 if (isModEnabled('accounting')) {
932 $accountstatic->account_number = $obj->account_number;
933
934 $accountingjournal = new AccountingJournal($db);
935 $accountingjournal->fetch($obj->fk_accountancy_journal);
936
937 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
938 }
939 //$accountstatic->label = $obj->blabel;
940 print $accountstatic->getNomUrl(1);
941 } else {
942 print '&nbsp;';
943 }
944 print '</td>';
945 if (!$i) {
946 $totalarray['nbfield']++;
947 }
948 }
949 }
950
951 // Extra fields
952 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
953
954 // Amount
955 if (!empty($arrayfields['s.amount']['checked'])) {
956 print '<td class="nowraponall right"><span class="amount">'.price($obj->amount).'</span></td>';
957 if (!$i) {
958 $totalarray['nbfield']++;
959 }
960 if (!$i) {
961 $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
962 }
963 $totalarray['val']['totalttcfield'] += $obj->amount;
964 }
965
966 // Status
967 if (!empty($arrayfields['s.paye']['checked'])) {
968 print '<td class="nowraponall center">'.$salstatic->getLibStatut(5, $obj->alreadypayed).'</td>';
969 if (!$i) {
970 $totalarray['nbfield']++;
971 }
972 }
973
974 // Fields from hook
975 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
976 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
977 print $hookmanager->resPrint;
978
979 // Action column
980 if (!$conf->main_checkbox_left_column) {
981 print '<td class="nowrap center">';
982 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
983 $selected = 0;
984 if (in_array($object->id, $arrayofselected)) {
985 $selected = 1;
986 }
987 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
988 }
989 print '</td>';
990 if (!$i) {
991 $totalarray['nbfield']++;
992 }
993 }
994
995 print '</tr>'."\n";
996 }
997 $i++;
998}
999
1000// Show total line
1001include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1002
1003
1004// If no record found
1005if ($num == 0) {
1006 /*$colspan = 1;
1007 foreach ($arrayfields as $key => $val) {
1008 if (!empty($val['checked'])) {
1009 $colspan++;
1010 }
1011 }*/
1012 $colspan = 9;
1013 if (isModEnabled("bank")) {
1014 $colspan++;
1015 }
1016 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1017}
1018
1019
1020$db->free($resql);
1021
1022$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1023$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1024print $hookmanager->resPrint;
1025
1026print '</table>'."\n";
1027print '</div>'."\n";
1028
1029print '</form>'."\n";
1030
1031
1032// End of page
1033llxFooter();
1034$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:497
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...
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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
buildzip.php
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.