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