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