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