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