dolibarr 21.0.0-alpha
subaccount.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
3 * Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
4 * Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30
31
32// Load translation files required by the page
33$langs->loadLangs(array("accountancy", "admin", "bills", "compta", "errors", "hrm", "salaries"));
34
35$mesg = '';
36$action = GETPOST('action', 'aZ09');
37$cancel = GETPOST('cancel', 'alpha');
38$id = GETPOSTINT('id');
39$rowid = GETPOSTINT('rowid');
40$massaction = GETPOST('massaction', 'aZ09');
41$optioncss = GETPOST('optioncss', 'alpha');
42$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
43$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
44
45$search_subaccount = GETPOST('search_subaccount', 'alpha');
46$search_label = GETPOST('search_label', 'alpha');
47$search_type = GETPOST('search_type', 'intcomma');
48
49// Security check
50if ($user->socid > 0) {
52}
53if (!$user->hasRight('accounting', 'chartofaccount')) {
55}
56
57// Load variable for pagination
58$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
59$sortfield = GETPOST('sortfield', 'aZ09comma');
60$sortorder = GETPOST('sortorder', 'aZ09comma');
61$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
62if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
63 // If $page is not defined, or '' or -1 or if we click on clear filters
64 $page = 0;
65}
66$offset = $limit * $page;
67$pageprev = $page - 1;
68$pagenext = $page + 1;
69if (!$sortfield) {
70 $sortfield = "label";
71}
72if (!$sortorder) {
73 $sortorder = "ASC";
74}
75
76$arrayfields = array(
77 'subaccount'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
78 'label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
79 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
80 'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
81);
82
83if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
84 unset($arrayfields['reconcilable']);
85}
86
87
88/*
89 * Actions
90 */
91
92if (GETPOST('cancel', 'alpha')) {
93 $action = 'list';
94 $massaction = '';
95}
96if (!GETPOST('confirmmassaction', 'alpha')) {
97 $massaction = '';
98}
99
100$parameters = array();
101$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
102if ($reshook < 0) {
103 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
104}
105
106if (empty($reshook)) {
107 if (!empty($cancel)) {
108 $action = '';
109 }
110
111 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
112
113 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
114 $search_subaccount = "";
115 $search_label = "";
116 $search_type = "";
117 $search_array_options = array();
118 }
119}
120
121
122/*
123 * View
124 */
125
126$form = new Form($db);
127
128
129// Page Header
130$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
131$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
132
133llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-admin_subaccount');
134
135
136// Customer
137$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity, sa.client as nature";
138$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
139$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
140$sql .= " AND sa.code_compta <> ''";
141//print $sql;
142if (strlen(trim($search_subaccount))) {
143 $lengthpaddingaccount = 0;
144 if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
145 $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
146 }
147 $search_subaccount_tmp = $search_subaccount;
148 $weremovedsomezero = 0;
149 if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
150 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
151 if (preg_match('/0$/', $search_subaccount_tmp)) {
152 $weremovedsomezero++;
153 $search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
154 }
155 }
156 }
157
158 //var_dump($search_subaccount); exit;
159 if ($search_subaccount_tmp) {
160 if ($weremovedsomezero) {
161 $search_subaccount_tmp_clean = $search_subaccount_tmp;
162 $search_subaccount_clean = $search_subaccount;
163 $startchar = '%';
164 if (strpos($search_subaccount_tmp, '^') === 0) {
165 $startchar = '';
166 $search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
167 $search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
168 }
169 $sql .= " AND (sa.code_compta LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
170 $sql .= " OR sa.code_compta LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
171 } else {
172 $sql .= natural_search("sa.code_compta", $search_subaccount_tmp);
173 }
174 }
175}
176if (strlen(trim($search_label))) {
177 $sql .= natural_search("sa.nom", $search_label);
178}
179if (!empty($search_type) && $search_type >= 0) {
180 $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
181}
182
183// Supplier
184$sql .= " UNION ";
185$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity, '0' as nature FROM ".MAIN_DB_PREFIX."societe sa";
186$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
187$sql .= " AND sa.code_compta_fournisseur <> ''";
188//print $sql;
189if (strlen(trim($search_subaccount))) {
190 $lengthpaddingaccount = 0;
191 if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
192 $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
193 }
194 $search_subaccount_tmp = $search_subaccount;
195 $weremovedsomezero = 0;
196 if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
197 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
198 if (preg_match('/0$/', $search_subaccount_tmp)) {
199 $weremovedsomezero++;
200 $search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
201 }
202 }
203 }
204
205 //var_dump($search_subaccount); exit;
206 if ($search_subaccount_tmp) {
207 if ($weremovedsomezero) {
208 $search_subaccount_tmp_clean = $search_subaccount_tmp;
209 $search_subaccount_clean = $search_subaccount;
210 $startchar = '%';
211 if (strpos($search_subaccount_tmp, '^') === 0) {
212 $startchar = '';
213 $search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
214 $search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
215 }
216 $sql .= " AND (sa.code_compta_fournisseur LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
217 $sql .= " OR sa.code_compta_fournisseur LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
218 } else {
219 $sql .= natural_search("sa.code_compta_fournisseur", $search_subaccount_tmp);
220 }
221 }
222}
223if (strlen(trim($search_label))) {
224 $sql .= natural_search("sa.nom", $search_label);
225}
226if (!empty($search_type) && $search_type >= 0) {
227 $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
228}
229
230// User - Employee
231$sql .= " UNION ";
232$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity, '0' as nature FROM ".MAIN_DB_PREFIX."user u";
233$sql .= " WHERE u.entity IN (".getEntity('user').")";
234$sql .= " AND u.accountancy_code <> ''";
235//print $sql;
236if (strlen(trim($search_subaccount))) {
237 $lengthpaddingaccount = 0;
238 if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
239 $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
240 }
241 $search_subaccount_tmp = $search_subaccount;
242 $weremovedsomezero = 0;
243 if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
244 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
245 if (preg_match('/0$/', $search_subaccount_tmp)) {
246 $weremovedsomezero++;
247 $search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
248 }
249 }
250 }
251
252 //var_dump($search_subaccount); exit;
253 if ($search_subaccount_tmp) {
254 if ($weremovedsomezero) {
255 $search_subaccount_tmp_clean = $search_subaccount_tmp;
256 $search_subaccount_clean = $search_subaccount;
257 $startchar = '%';
258 if (strpos($search_subaccount_tmp, '^') === 0) {
259 $startchar = '';
260 $search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
261 $search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
262 }
263 $sql .= " AND (u.accountancy_code LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
264 $sql .= " OR u.accountancy_code LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
265 } else {
266 $sql .= natural_search("u.accountancy_code", $search_subaccount_tmp);
267 }
268 }
269}
270if (strlen(trim($search_label))) {
271 $sql .= natural_search("u.lastname", $search_label);
272}
273if (!empty($search_type) && $search_type >= 0) {
274 $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
275}
276
277$sql .= $db->order($sortfield, $sortorder);
278
279// Count total nb of records
280$nbtotalofrecords = '';
281if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
282 $resql = $db->query($sql);
283 $nbtotalofrecords = $db->num_rows($resql);
284 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
285 $page = 0;
286 $offset = 0;
287 }
288}
289
290$sql .= $db->plimit($limit + 1, $offset);
291
292dol_syslog("accountancy/admin/subaccount.php:: sql=".$sql);
293$resql = $db->query($sql);
294
295if ($resql) {
296 $num = $db->num_rows($resql);
297
298 $param = '';
299 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
300 $param .= '&contextpage='.urlencode($contextpage);
301 }
302 if ($limit > 0 && $limit != $conf->liste_limit) {
303 $param .= '&limit='.((int) $limit);
304 }
305 if ($optioncss != '') {
306 $param .= '&optioncss='.urlencode($optioncss);
307 }
308 if ($search_subaccount) {
309 $param .= '&search_subaccount='.urlencode($search_subaccount);
310 }
311 if ($search_label) {
312 $param .= '&search_label='.urlencode($search_label);
313 }
314 if ($search_type) {
315 $param .= '&search_type='.urlencode($search_type);
316 }
317
318 // List of mass actions available
319 $arrayofmassactions = array();
320
321 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
322 if ($optioncss != '') {
323 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
324 }
325 print '<input type="hidden" name="token" value="'.newToken().'">';
326 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
327 print '<input type="hidden" name="action" value="list">';
328 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
329 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
330 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
331
332 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1);
333
334 print '<div class="info">'.$langs->trans("WarningCreateSubAccounts").'</div>';
335
336 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
337 $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
338 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
339 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
340
341 $moreforfilter = '';
342 $massactionbutton = '';
343
344 print '<div class="div-table-responsive">';
345 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
346
347 // Line for search fields
348 print '<tr class="liste_titre_filter">';
349 // Action column
350 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
351 print '<td class="liste_titre center maxwidthsearch">';
352 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
353 print $searchpicto;
354 print '</td>';
355 }
356 if (!empty($arrayfields['subaccount']['checked'])) {
357 print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_subaccount" value="'.$search_subaccount.'"></td>';
358 }
359 if (!empty($arrayfields['label']['checked'])) {
360 print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
361 }
362 if (!empty($arrayfields['type']['checked'])) {
363 print '<td class="liste_titre center">'.$form->selectarray('search_type', array('1'=>$langs->trans('Customer'), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).'</td>';
364 }
365 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
366 if (!empty($arrayfields['reconcilable']['checked'])) {
367 print '<td class="liste_titre">&nbsp;</td>';
368 }
369 }
370 // Action column
371 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
372 print '<td class="liste_titre maxwidthsearch">';
373 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
374 print $searchpicto;
375 print '</td>';
376 }
377 print '</tr>';
378
379 print '<tr class="liste_titre">';
380 // Action column
381 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
382 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ');
383 }
384 if (!empty($arrayfields['subaccount']['checked'])) {
385 print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder);
386 }
387 if (!empty($arrayfields['label']['checked'])) {
388 print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], "label", "", $param, '', $sortfield, $sortorder);
389 }
390 if (!empty($arrayfields['type']['checked'])) {
391 print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'center ');
392 }
393 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
394 if (!empty($arrayfields['reconcilable']['checked'])) {
395 print_liste_field_titre($arrayfields['reconcilable']['label'], $_SERVER["PHP_SELF"], 'reconcilable', '', $param, '', $sortfield, $sortorder, 'center ');
396 }
397 }
398 // Action column
399 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
400 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ');
401 }
402 print "</tr>\n";
403
404 $totalarray = array();
405 $totalarray['nbfield'] = 0;
406 $i = 0;
407 while ($i < min($num, $limit)) {
408 $obj = $db->fetch_object($resql);
409
410 print '<tr class="oddeven">';
411
412 // Action column
413 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
414 print '<td class="center">';
415 $e = '';
416
417 // Customer
418 if ($obj->type == 1) {
419 $e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
420 } elseif ($obj->type == 2) {
421 // Supplier
422 $e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
423 } elseif ($obj->type == 3) {
424 // User - Employee
425 $e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
426 }
427 print $e;
428 print '</td>'."\n";
429 if (!$i) {
430 $totalarray['nbfield']++;
431 }
432 }
433
434 // Account number
435 if (!empty($arrayfields['subaccount']['checked'])) {
436 print "<td>";
437 print length_accounta($obj->subaccount);
438 print "</td>\n";
439 if (!$i) {
440 $totalarray['nbfield']++;
441 }
442 }
443
444 // Subaccount label
445 if (!empty($arrayfields['label']['checked'])) {
446 print "<td>";
447 print dol_escape_htmltag($obj->label);
448 print "</td>\n";
449 if (!$i) {
450 $totalarray['nbfield']++;
451 }
452 }
453
454 // Type
455 if (!empty($arrayfields['type']['checked'])) {
456 print '<td class="center">';
457 $s = '';
458
459 // Customer
460 if ($obj->type == 1) {
461 $s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
462 } elseif ($obj->type == 2) {
463 // Supplier
464 $s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
465 } elseif ($obj->type == 3) {
466 // User - Employee
467 $s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->rowid.'">'.$langs->trans("Employee").'</a>';
468 }
469 print $s;
470 if ($obj->nature == 2) {
471 print ' <span class="warning bold">('.$langs->trans("Prospect").')</span>';
472 }
473 print '</td>';
474 if (!$i) {
475 $totalarray['nbfield']++;
476 }
477 }
478
479 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
480 // Activated or not reconciliation on accounting account
481 if (!empty($arrayfields['reconcilable']['checked'])) {
482 print '<td class="center">';
483 if (empty($obj->reconcilable)) {
484 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&mode=1&token='.newToken().'">';
485 print img_picto($langs->trans("Disabled"), 'switch_off');
486 print '</a>';
487 } else {
488 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&mode=1&token='.newToken().'">';
489 print img_picto($langs->trans("Activated"), 'switch_on');
490 print '</a>';
491 }
492 print '</td>';
493 if (!$i) {
494 $totalarray['nbfield']++;
495 }
496 }
497 }
498
499 // Action column
500 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
501 print '<td class="center">';
502 $e = '';
503
504 // Customer
505 if ($obj->type == 1) {
506 $e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
507 } elseif ($obj->type == 2) {
508 // Supplier
509 $e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
510 } elseif ($obj->type == 3) {
511 // User - Employee
512 $e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
513 }
514 print $e;
515 print '</td>'."\n";
516 if (!$i) {
517 $totalarray['nbfield']++;
518 }
519 }
520
521 print '</tr>'."\n";
522 $i++;
523 }
524
525 // If no record found
526 if ($num == 0) {
527 $colspan = 1;
528 foreach ($arrayfields as $key => $val) {
529 if (!empty($val['checked'])) {
530 $colspan++;
531 }
532 }
533 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
534 }
535
536 $db->free($resql);
537
538 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
539 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
540 print $hookmanager->resPrint;
541
542 print "</table>";
543 print "</div>";
544
545 print '</form>';
546} else {
547 dol_print_error($db);
548}
549
550// End of page
551llxFooter();
552$db->close();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.