dolibarr 20.0.0
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 == -1) {
63 $page = 0;
64} // If $page is not defined, or '' or -1
65$offset = $limit * $page;
66$pageprev = $page - 1;
67$pagenext = $page + 1;
68if (!$sortfield) {
69 $sortfield = "label";
70}
71if (!$sortorder) {
72 $sortorder = "ASC";
73}
74
75$arrayfields = array(
76 'subaccount'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
77 'label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
78 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
79 'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
80);
81
82if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
83 unset($arrayfields['reconcilable']);
84}
85
86
87/*
88 * Actions
89 */
90
91if (GETPOST('cancel', 'alpha')) {
92 $action = 'list';
93 $massaction = '';
94}
95if (!GETPOST('confirmmassaction', 'alpha')) {
96 $massaction = '';
97}
98
99$parameters = array();
100$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
101if ($reshook < 0) {
102 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
103}
104
105if (empty($reshook)) {
106 if (!empty($cancel)) {
107 $action = '';
108 }
109
110 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
111
112 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
113 $search_subaccount = "";
114 $search_label = "";
115 $search_type = "";
116 $search_array_options = array();
117 }
118}
119
120
121/*
122 * View
123 */
124
125$form = new Form($db);
126
127
128// Page Header
129$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
130$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
131
132llxHeader('', $title, $help_url);
133
134
135// Customer
136$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity, sa.client as nature";
137$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
138$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
139$sql .= " AND sa.code_compta <> ''";
140//print $sql;
141if (strlen(trim($search_subaccount))) {
142 $lengthpaddingaccount = 0;
143 if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
144 $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
145 }
146 $search_subaccount_tmp = $search_subaccount;
147 $weremovedsomezero = 0;
148 if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
149 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
150 if (preg_match('/0$/', $search_subaccount_tmp)) {
151 $weremovedsomezero++;
152 $search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
153 }
154 }
155 }
156
157 //var_dump($search_subaccount); exit;
158 if ($search_subaccount_tmp) {
159 if ($weremovedsomezero) {
160 $search_subaccount_tmp_clean = $search_subaccount_tmp;
161 $search_subaccount_clean = $search_subaccount;
162 $startchar = '%';
163 if (strpos($search_subaccount_tmp, '^') === 0) {
164 $startchar = '';
165 $search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
166 $search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
167 }
168 $sql .= " AND (sa.code_compta LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
169 $sql .= " OR sa.code_compta LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
170 } else {
171 $sql .= natural_search("sa.code_compta", $search_subaccount_tmp);
172 }
173 }
174}
175if (strlen(trim($search_label))) {
176 $sql .= natural_search("sa.nom", $search_label);
177}
178if (!empty($search_type) && $search_type >= 0) {
179 $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
180}
181
182// Supplier
183$sql .= " UNION ";
184$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";
185$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
186$sql .= " AND sa.code_compta_fournisseur <> ''";
187//print $sql;
188if (strlen(trim($search_subaccount))) {
189 $lengthpaddingaccount = 0;
190 if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
191 $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
192 }
193 $search_subaccount_tmp = $search_subaccount;
194 $weremovedsomezero = 0;
195 if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
196 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
197 if (preg_match('/0$/', $search_subaccount_tmp)) {
198 $weremovedsomezero++;
199 $search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
200 }
201 }
202 }
203
204 //var_dump($search_subaccount); exit;
205 if ($search_subaccount_tmp) {
206 if ($weremovedsomezero) {
207 $search_subaccount_tmp_clean = $search_subaccount_tmp;
208 $search_subaccount_clean = $search_subaccount;
209 $startchar = '%';
210 if (strpos($search_subaccount_tmp, '^') === 0) {
211 $startchar = '';
212 $search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
213 $search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
214 }
215 $sql .= " AND (sa.code_compta_fournisseur LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
216 $sql .= " OR sa.code_compta_fournisseur LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
217 } else {
218 $sql .= natural_search("sa.code_compta_fournisseur", $search_subaccount_tmp);
219 }
220 }
221}
222if (strlen(trim($search_label))) {
223 $sql .= natural_search("sa.nom", $search_label);
224}
225if (!empty($search_type) && $search_type >= 0) {
226 $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
227}
228
229// User - Employee
230$sql .= " UNION ";
231$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";
232$sql .= " WHERE u.entity IN (".getEntity('user').")";
233$sql .= " AND u.accountancy_code <> ''";
234//print $sql;
235if (strlen(trim($search_subaccount))) {
236 $lengthpaddingaccount = 0;
237 if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
238 $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
239 }
240 $search_subaccount_tmp = $search_subaccount;
241 $weremovedsomezero = 0;
242 if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
243 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
244 if (preg_match('/0$/', $search_subaccount_tmp)) {
245 $weremovedsomezero++;
246 $search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
247 }
248 }
249 }
250
251 //var_dump($search_subaccount); exit;
252 if ($search_subaccount_tmp) {
253 if ($weremovedsomezero) {
254 $search_subaccount_tmp_clean = $search_subaccount_tmp;
255 $search_subaccount_clean = $search_subaccount;
256 $startchar = '%';
257 if (strpos($search_subaccount_tmp, '^') === 0) {
258 $startchar = '';
259 $search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
260 $search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
261 }
262 $sql .= " AND (u.accountancy_code LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
263 $sql .= " OR u.accountancy_code LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
264 } else {
265 $sql .= natural_search("u.accountancy_code", $search_subaccount_tmp);
266 }
267 }
268}
269if (strlen(trim($search_label))) {
270 $sql .= natural_search("u.lastname", $search_label);
271}
272if (!empty($search_type) && $search_type >= 0) {
273 $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
274}
275
276$sql .= $db->order($sortfield, $sortorder);
277
278// Count total nb of records
279$nbtotalofrecords = '';
280if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
281 $resql = $db->query($sql);
282 $nbtotalofrecords = $db->num_rows($resql);
283 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
284 $page = 0;
285 $offset = 0;
286 }
287}
288
289$sql .= $db->plimit($limit + 1, $offset);
290
291dol_syslog("accountancy/admin/subaccount.php:: sql=".$sql);
292$resql = $db->query($sql);
293
294if ($resql) {
295 $num = $db->num_rows($resql);
296
297 $param = '';
298 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
299 $param .= '&contextpage='.urlencode($contextpage);
300 }
301 if ($limit > 0 && $limit != $conf->liste_limit) {
302 $param .= '&limit='.((int) $limit);
303 }
304 if ($optioncss != '') {
305 $param .= '&optioncss='.urlencode($optioncss);
306 }
307 if ($search_subaccount) {
308 $param .= '&search_subaccount='.urlencode($search_subaccount);
309 }
310 if ($search_label) {
311 $param .= '&search_label='.urlencode($search_label);
312 }
313 if ($search_type) {
314 $param .= '&search_type='.urlencode($search_type);
315 }
316
317 // List of mass actions available
318 $arrayofmassactions = array();
319
320 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
321 if ($optioncss != '') {
322 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
323 }
324 print '<input type="hidden" name="token" value="'.newToken().'">';
325 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
326 print '<input type="hidden" name="action" value="list">';
327 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
328 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
329 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
330
331 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1);
332
333 print '<div class="info">'.$langs->trans("WarningCreateSubAccounts").'</div>';
334
335 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
336 $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
337 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
338 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
339
340 $moreforfilter = '';
341 $massactionbutton = '';
342
343 print '<div class="div-table-responsive">';
344 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
345
346 // Line for search fields
347 print '<tr class="liste_titre_filter">';
348 // Action column
349 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
350 print '<td class="liste_titre center maxwidthsearch">';
351 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
352 print $searchpicto;
353 print '</td>';
354 }
355 if (!empty($arrayfields['subaccount']['checked'])) {
356 print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_subaccount" value="'.$search_subaccount.'"></td>';
357 }
358 if (!empty($arrayfields['label']['checked'])) {
359 print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
360 }
361 if (!empty($arrayfields['type']['checked'])) {
362 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>';
363 }
364 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
365 if (!empty($arrayfields['reconcilable']['checked'])) {
366 print '<td class="liste_titre">&nbsp;</td>';
367 }
368 }
369 // Action column
370 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
371 print '<td class="liste_titre maxwidthsearch">';
372 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
373 print $searchpicto;
374 print '</td>';
375 }
376 print '</tr>';
377
378 print '<tr class="liste_titre">';
379 // Action column
380 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
381 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ');
382 }
383 if (!empty($arrayfields['subaccount']['checked'])) {
384 print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder);
385 }
386 if (!empty($arrayfields['label']['checked'])) {
387 print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], "label", "", $param, '', $sortfield, $sortorder);
388 }
389 if (!empty($arrayfields['type']['checked'])) {
390 print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'center ');
391 }
392 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
393 if (!empty($arrayfields['reconcilable']['checked'])) {
394 print_liste_field_titre($arrayfields['reconcilable']['label'], $_SERVER["PHP_SELF"], 'reconcilable', '', $param, '', $sortfield, $sortorder, 'center ');
395 }
396 }
397 // Action column
398 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
399 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ');
400 }
401 print "</tr>\n";
402
403 $totalarray = array();
404 $totalarray['nbfield'] = 0;
405 $i = 0;
406 while ($i < min($num, $limit)) {
407 $obj = $db->fetch_object($resql);
408
409 print '<tr class="oddeven">';
410
411 // Action column
412 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
413 print '<td class="center">';
414 $e = '';
415
416 // Customer
417 if ($obj->type == 1) {
418 $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>';
419 } elseif ($obj->type == 2) {
420 // Supplier
421 $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>';
422 } elseif ($obj->type == 3) {
423 // User - Employee
424 $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>';
425 }
426 print $e;
427 print '</td>'."\n";
428 if (!$i) {
429 $totalarray['nbfield']++;
430 }
431 }
432
433 // Account number
434 if (!empty($arrayfields['subaccount']['checked'])) {
435 print "<td>";
436 print length_accounta($obj->subaccount);
437 print "</td>\n";
438 if (!$i) {
439 $totalarray['nbfield']++;
440 }
441 }
442
443 // Subaccount label
444 if (!empty($arrayfields['label']['checked'])) {
445 print "<td>";
446 print dol_escape_htmltag($obj->label);
447 print "</td>\n";
448 if (!$i) {
449 $totalarray['nbfield']++;
450 }
451 }
452
453 // Type
454 if (!empty($arrayfields['type']['checked'])) {
455 print '<td class="center">';
456 $s = '';
457
458 // Customer
459 if ($obj->type == 1) {
460 $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>';
461 } elseif ($obj->type == 2) {
462 // Supplier
463 $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>';
464 } elseif ($obj->type == 3) {
465 // User - Employee
466 $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>';
467 }
468 print $s;
469 if ($obj->nature == 2) {
470 print ' <span class="warning bold">('.$langs->trans("Prospect").')</span>';
471 }
472 print '</td>';
473 if (!$i) {
474 $totalarray['nbfield']++;
475 }
476 }
477
478 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
479 // Activated or not reconciliation on accounting account
480 if (!empty($arrayfields['reconcilable']['checked'])) {
481 print '<td class="center">';
482 if (empty($obj->reconcilable)) {
483 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&mode=1&token='.newToken().'">';
484 print img_picto($langs->trans("Disabled"), 'switch_off');
485 print '</a>';
486 } else {
487 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&mode=1&token='.newToken().'">';
488 print img_picto($langs->trans("Activated"), 'switch_on');
489 print '</a>';
490 }
491 print '</td>';
492 if (!$i) {
493 $totalarray['nbfield']++;
494 }
495 }
496 }
497
498 // Action column
499 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
500 print '<td class="center">';
501 $e = '';
502
503 // Customer
504 if ($obj->type == 1) {
505 $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>';
506 } elseif ($obj->type == 2) {
507 // Supplier
508 $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>';
509 } elseif ($obj->type == 3) {
510 // User - Employee
511 $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>';
512 }
513 print $e;
514 print '</td>'."\n";
515 if (!$i) {
516 $totalarray['nbfield']++;
517 }
518 }
519
520 print '</tr>'."\n";
521 $i++;
522 }
523
524 // If no record found
525 if ($num == 0) {
526 $colspan = 1;
527 foreach ($arrayfields as $key => $val) {
528 if (!empty($val['checked'])) {
529 $colspan++;
530 }
531 }
532 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
533 }
534
535 $db->free($resql);
536
537 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
538 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
539 print $hookmanager->resPrint;
540
541 print "</table>";
542 print "</div>";
543
544 print '</form>';
545} else {
546 dol_print_error($db);
547}
548
549// End of page
550llxFooter();
551$db->close();
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()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage generation of HTML components Only common components must be here.
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.
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.
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.