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