28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
35$langs->loadLangs(array(
'accountancy',
'admin',
'bills',
'compta',
'salaries'));
37$action =
GETPOST(
'action',
'aZ09');
38$cancel =
GETPOST(
'cancel',
'alpha');
41$massaction =
GETPOST(
'massaction',
'aZ09');
42$optioncss =
GETPOST(
'optioncss',
'alpha');
43$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'accountingaccountlist';
46$search_account =
GETPOST(
'search_account',
'alpha');
47$search_label =
GETPOST(
'search_label',
'alpha');
48$search_labelshort =
GETPOST(
'search_labelshort',
'alpha');
49$search_accountparent =
GETPOST(
'search_accountparent',
'alpha');
50$search_pcgtype =
GETPOST(
'search_pcgtype',
'alpha');
51$search_import_key =
GETPOST(
'search_import_key',
'alpha');
52$toselect =
GETPOST(
'toselect',
'array');
54$confirm =
GETPOST(
'confirm',
'alpha');
56$chartofaccounts =
GETPOSTINT(
'chartofaccounts');
58$permissiontoadd = $user->hasRight(
'accounting',
'chartofaccount');
59$permissiontodelete = $user->hasRight(
'accounting',
'chartofaccount');
62if ($user->socid > 0) {
65if (!$user->hasRight(
'accounting',
'chartofaccount')) {
71$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
72$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
74if (empty($page) || $page == -1) {
77$offset = $limit * $page;
81 $sortfield =
"aa.account_number";
88 'aa.account_number' => array(
'label' =>
"AccountNumber",
'checked' => 1),
89 'aa.label' => array(
'label' =>
"Label",
'checked' => 1),
90 'aa.labelshort' => array(
'label' =>
"LabelToShow",
'checked' => 1),
91 'aa.account_parent' => array(
'label' =>
"Accountparent",
'checked' => 1),
92 'aa.pcg_type' => array(
'label' =>
"Pcgtype",
'checked' => 1,
'help' =>
'PcgtypeDesc'),
93 'categories' => array(
'label' =>
"AccountingCategories",
'checked' => -1,
'help' =>
'AccountingCategoriesDesc'),
94 'aa.reconcilable' => array(
'label' =>
"Reconcilable",
'checked' => 1),
95 'aa.import_key' => array(
'label' =>
"ImportId",
'checked' => -1,
'help' =>
''),
96 'aa.active' => array(
'label' =>
"Activated",
'checked' => 1)
100 unset($arrayfields[
'categories']);
101 unset($arrayfields[
'aa.reconcilable']);
107$hookmanager->initHooks(array(
'accountancyadminaccount'));
114if (
GETPOST(
'cancel',
'alpha')) {
118if (!
GETPOST(
'confirmmassaction',
'alpha')) {
122$parameters = array(
'chartofaccounts' => $chartofaccounts,
'permissiontoadd' => $permissiontoadd,
'permissiontodelete' => $permissiontodelete);
123$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $accounting, $action);
128if (empty($reshook)) {
129 if (!empty($cancel)) {
133 $objectclass =
'AccountingAccount';
134 $uploaddir = $conf->accounting->multidir_output[$conf->entity];
135 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
137 if ($action ==
"delete") {
140 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
142 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
143 $search_account =
"";
145 $search_labelshort =
"";
146 $search_accountparent =
"";
147 $search_pcgtype =
"";
148 $search_import_key =
"";
149 $search_array_options = array();
155 if ($chartofaccounts > 0 && $permissiontoadd) {
158 $sql =
'SELECT code FROM '.MAIN_DB_PREFIX.
'c_country as c, '.MAIN_DB_PREFIX.
'accounting_system as a';
159 $sql .=
' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
160 $resql = $db->query($sql);
162 $obj = $db->fetch_object($resql);
164 $country_code = $obj->code;
172 $sqlfile = DOL_DOCUMENT_ROOT.
'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).
'.sql';
174 $offsetforchartofaccount = 0;
178 $tmp = file_get_contents($sqlfile);
180 if (preg_match(
'/-- ADD (\d+) to rowid/ims', $tmp, $reg)) {
181 $offsetforchartofaccount += $reg[1];
183 $offsetforchartofaccount += ($conf->entity * 100000000);
185 $result =
run_sql($sqlfile, 1, $conf->entity, 1,
'',
'default', 32768, 0, $offsetforchartofaccount);
194 if (!
dolibarr_set_const($db,
'CHARTOFACCOUNTS', $chartofaccounts,
'chaine', 0,
'', $conf->entity)) {
202 if ($action ==
'disable' && $permissiontoadd) {
203 if ($accounting->fetch(
$id)) {
205 $result = $accounting->accountDeactivate(
$id, $mode);
212 } elseif ($action ==
'enable' && $permissiontoadd) {
213 if ($accounting->fetch(
$id)) {
215 $result = $accounting->accountActivate(
$id, $mode);
228$form =
new Form($db);
231$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
233llxHeader(
'', $langs->trans(
"ListAccounts"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_account');
235if ($action ==
'delete') {
236 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$id, $langs->trans(
'DeleteAccount'), $langs->trans(
'ConfirmDeleteAccount'),
'confirm_delete',
'', 0, 1);
242$sql =
"SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent, aa.label, aa.labelshort, aa.fk_accounting_category,";
243$sql .=
" aa.reconcilable, aa.active, aa.import_key,";
244$sql .=
" a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
247$parameters = array();
248$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
249$sql .= $hookmanager->resPrint;
250$sql = preg_replace(
'/,\s*$/',
'', $sql);
252$sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_account as aa";
253$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int) $conf->entity);
254$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int) $conf->entity);
257$parameters = array();
258$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object);
259$sql .= $hookmanager->resPrint;
261$sql .=
" WHERE asy.rowid = ".((int) $pcgver);
263if (strlen(trim($search_account))) {
264 $lengthpaddingaccount = 0;
268 $search_account_tmp = $search_account;
269 $weremovedsomezero = 0;
270 if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
271 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
272 if (preg_match(
'/0$/', $search_account_tmp)) {
273 $weremovedsomezero++;
274 $search_account_tmp = preg_replace(
'/0$/',
'', $search_account_tmp);
280 if ($search_account_tmp) {
281 if ($weremovedsomezero) {
282 $search_account_tmp_clean = $search_account_tmp;
283 $search_account_clean = $search_account;
285 if (substr($search_account_tmp, 0, 1) ===
'^') {
287 $search_account_tmp_clean = preg_replace(
'/^\^/',
'', $search_account_tmp);
288 $search_account_clean = preg_replace(
'/^\^/',
'', $search_account);
290 $sql .=
" AND (aa.account_number LIKE '".$db->escape($startchar.$search_account_tmp_clean).
"'";
291 $sql .=
" OR aa.account_number LIKE '".$db->escape($startchar.$search_account_clean).
"%')";
297if (strlen(trim($search_label))) {
300if (strlen(trim($search_labelshort))) {
303if (strlen(trim($search_accountparent)) && $search_accountparent !=
'-1') {
304 $sql .=
natural_search(
"aa.account_parent", $search_accountparent, 2);
306if (strlen(trim($search_pcgtype))) {
309if (strlen(trim($search_import_key))) {
314$parameters = array();
315$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
316$sql .= $hookmanager->resPrint;
318$sql .= $db->order($sortfield, $sortorder);
322$nbtotalofrecords =
'';
324 $resql = $db->query($sql);
325 $nbtotalofrecords = $db->num_rows($resql);
326 if (($page * $limit) > $nbtotalofrecords) {
332$sql .= $db->plimit($limit + 1, $offset);
334dol_syslog(
"accountancy/admin/account.php:: sql=".$sql);
335$resql = $db->query($sql);
338 $num = $db->num_rows($resql);
340 $arrayofselected = is_array($toselect) ? $toselect : array();
343 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
344 $param .=
'&contextpage='.urlencode($contextpage);
346 if ($limit > 0 && $limit != $conf->liste_limit) {
347 $param .=
'&limit='.((int) $limit);
349 if ($search_account) {
350 $param .=
'&search_account='.urlencode($search_account);
353 $param .=
'&search_label='.urlencode($search_label);
355 if ($search_labelshort) {
356 $param .=
'&search_labelshort='.urlencode($search_labelshort);
358 if ($search_accountparent > 0 || $search_accountparent ==
'0') {
359 $param .=
'&search_accountparent='.urlencode($search_accountparent);
361 if ($search_pcgtype) {
362 $param .=
'&search_pcgtype='.urlencode($search_pcgtype);
364 if ($search_import_key) {
365 $param .=
'&search_import_key='.urlencode($search_import_key);
367 if ($optioncss !=
'') {
368 $param .=
'&optioncss='.urlencode($optioncss);
372 $parameters = array();
373 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
374 $param .= $hookmanager->resPrint;
376 if (!empty($conf->use_javascript_ajax)) {
377 print
'<!-- Add javascript to reload page when we click "Change plan" -->
378 <script type="text/javascript">
379 $(document).ready(function () {
380 $("#change_chart").on("click", function (e) {
381 console.log("chartofaccounts selected = "+$("#chartofaccounts").val());
383 window.location.href = "'.$_SERVER[
"PHP_SELF"].
'?valid_change_chart=1&chartofaccounts="+$("#chartofaccounts").val();
390 $arrayofmassactions = array();
391 if ($user->hasRight(
'accounting',
'chartofaccount')) {
392 $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
394 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
395 $arrayofmassactions = array();
398 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
401 $newcardbutton =
dolGetButtonTitle($langs->trans(
'Addanaccount'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/accountancy/admin/card.php?action=create',
'', $permissiontoadd);
404 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
405 if ($optioncss !=
'') {
406 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
408 print
'<input type="hidden" name="token" value="'.newToken().
'">';
409 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
410 print
'<input type="hidden" name="action" value="list">';
411 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
412 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
413 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
416 print_barre_liste($langs->trans(
'ListAccounts'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'accounting_account', 0, $newcardbutton,
'', $limit, 0, 0, 1);
418 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
421 print $langs->trans(
"Selectchartofaccounts").
" : ";
422 print
'<select class="flat minwidth200" name="chartofaccounts" id="chartofaccounts">';
423 $sql =
"SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
424 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_system as a";
425 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON a.fk_country = c.rowid AND c.active = 1";
426 $sql .=
" WHERE a.active = 1";
428 dol_syslog(
"accountancy/admin/account.php sql=".$sql);
430 $resqlchart = $db->query($sql);
432 $numbis = $db->num_rows($resqlchart);
434 print
'<option value="-1"> </option>';
435 while ($i < $numbis) {
436 $obj = $db->fetch_object($resqlchart);
438 print
'<option value="'.$obj->rowid.
'"';
439 print ($pcgver == $obj->rowid) ?
' selected' :
'';
440 print
'>'.$obj->pcg_version.
' - '.$obj->label.
' - ('.$obj->country_code.
')</option>';
449 print
'<input type="'.(empty($conf->use_javascript_ajax) ?
'submit' :
'button').
'" class="button button-edit small" name="change_chart" id="change_chart" value="'.
dol_escape_htmltag($langs->trans(
"ChangeAndLoad")).
'">';
453 $parameters = array();
454 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
455 print $hookmanager->resPrint;
459 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
460 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
461 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
462 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
465 if ($moreforfilter) {
466 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
467 print $moreforfilter;
473 $totalarray = array();
474 $totalarray[
'nbfield'] = 0;
476 print
'<div class="div-table-responsive">';
477 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
481 print
'<tr class="liste_titre_filter">';
485 print
'<td class="liste_titre center maxwidthsearch">';
486 $searchpicto = $form->showFilterButtons(
'left');
490 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
491 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_account" value="'.$search_account.
'"></td>';
493 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
494 print
'<td class="liste_titre"><input type="text" class="flat width150" name="search_label" value="'.$search_label.
'"></td>';
496 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
497 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_labelshort" value="'.$search_labelshort.
'"></td>';
499 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
500 print
'<td class="liste_titre">';
501 print $formaccounting->select_account($search_accountparent,
'search_accountparent', 2, array(), 0, 0,
'maxwidth150');
505 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
506 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_pcgtype" value="'.$search_pcgtype.
'"></td>';
509 if (!empty($arrayfields[
'categories'][
'checked'])) {
510 print
'<td class="liste_titre"></td>';
514 $parameters = array(
'arrayfields' => $arrayfields);
515 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
516 print $hookmanager->resPrint;
519 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
520 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_import_key" value="'.$search_import_key.
'"></td>';
523 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
524 print
'<td class="liste_titre"> </td>';
527 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
528 print
'<td class="liste_titre"> </td>';
532 print
'<td class="liste_titre center maxwidthsearch">';
533 $searchpicto = $form->showFilterButtons();
539 $totalarray = array();
540 $totalarray[
'nbfield'] = 0;
544 print
'<tr class="liste_titre">';
547 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
548 $totalarray[
'nbfield']++;
550 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
551 print_liste_field_titre($arrayfields[
'aa.account_number'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_number",
"", $param,
'', $sortfield, $sortorder);
552 $totalarray[
'nbfield']++;
554 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
555 print_liste_field_titre($arrayfields[
'aa.label'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.label",
"", $param,
'', $sortfield, $sortorder);
556 $totalarray[
'nbfield']++;
558 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
559 print_liste_field_titre($arrayfields[
'aa.labelshort'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.labelshort",
"", $param,
'', $sortfield, $sortorder);
560 $totalarray[
'nbfield']++;
562 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
563 print_liste_field_titre($arrayfields[
'aa.account_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_parent",
"", $param,
'', $sortfield, $sortorder,
'left ');
564 $totalarray[
'nbfield']++;
566 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
567 print_liste_field_titre($arrayfields[
'aa.pcg_type'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.pcg_type,aa.account_number',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'aa.pcg_type'][
'help'], 1);
568 $totalarray[
'nbfield']++;
570 if (!empty($arrayfields[
'categories'][
'checked'])) {
571 print_liste_field_titre($arrayfields[
'categories'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'categories'][
'help'], 1);
572 $totalarray[
'nbfield']++;
576 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
577 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
578 print $hookmanager->resPrint;
580 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
581 print_liste_field_titre($arrayfields[
'aa.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.import_key',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'aa.import_key'][
'help'], 1);
582 $totalarray[
'nbfield']++;
585 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
586 print_liste_field_titre($arrayfields[
'aa.reconcilable'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.reconcilable',
'', $param,
'', $sortfield, $sortorder);
587 $totalarray[
'nbfield']++;
590 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
591 print_liste_field_titre($arrayfields[
'aa.active'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.active',
'', $param,
'', $sortfield, $sortorder);
592 $totalarray[
'nbfield']++;
596 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
597 $totalarray[
'nbfield']++;
604 while ($i < min($num, $limit)) {
605 $obj = $db->fetch_object($resql);
607 $accountstatic->id = $obj->rowid;
608 $accountstatic->label = $obj->label;
609 $accountstatic->account_number = $obj->account_number;
611 print
'<tr class="oddeven">';
615 print
'<td class="center nowraponall">';
616 if ($user->hasRight(
'accounting',
'chartofaccount')) {
617 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
621 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
625 if ($massactionbutton || $massaction) {
627 if (in_array($obj->rowid, $arrayofselected)) {
630 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
635 $totalarray[
'nbfield']++;
640 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
642 print $accountstatic->getNomUrl(1, 0, 0,
'', 0, 1, 0,
'accountcard');
645 $totalarray[
'nbfield']++;
650 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
651 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">';
655 $totalarray[
'nbfield']++;
660 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
665 $totalarray[
'nbfield']++;
670 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
673 if (!empty($obj->account_parent) && !empty($obj->rowid2)) {
675 print
'<!-- obj->account_parent = '.$obj->account_parent.
' obj->rowid2 = '.$obj->rowid2.
' -->';
676 $accountparent->id = $obj->rowid2;
677 $accountparent->label = $obj->label2;
678 $accountparent->account_number = $obj->account_number2;
679 print $accountparent->getNomUrl(1);
682 $totalarray[
'nbfield']++;
686 if (!empty($obj->account_parent)) {
687 print
'<!-- Bad value for obj->account_parent = '.$obj->account_parent.
': is a rowid that does not exists -->';
691 $totalarray[
'nbfield']++;
697 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
702 $totalarray[
'nbfield']++;
706 if (!empty($arrayfields[
'categories'][
'checked'])) {
712 $totalarray[
'nbfield']++;
717 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
718 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
719 print $hookmanager->resPrint;
722 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
727 $totalarray[
'nbfield']++;
733 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
734 print
'<td class="center">';
735 if (empty($obj->reconcilable)) {
736 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&mode=1&token='.
newToken().
'">';
737 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
740 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&mode=1&token='.
newToken().
'">';
741 print
img_picto($langs->trans(
"Activated"),
'switch_on');
746 $totalarray[
'nbfield']++;
752 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
753 print
'<td class="center">';
754 if (empty($obj->active)) {
755 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&mode=0&token='.
newToken().
'">';
756 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
759 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&mode=0&token='.
newToken().
'">';
760 print
img_picto($langs->trans(
"Activated"),
'switch_on');
765 $totalarray[
'nbfield']++;
771 print
'<td class="center nowraponall">';
772 if ($user->hasRight(
'accounting',
'chartofaccount')) {
773 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
777 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
781 if ($massactionbutton || $massaction) {
783 if (in_array($obj->rowid, $arrayofselected)) {
786 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
791 $totalarray[
'nbfield']++;
801 foreach ($arrayfields as $key => $val) {
802 if (!empty($val[
'checked'])) {
806 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
811 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
812 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
813 print $hookmanager->resPrint;
815 print
'</table>'.
"\n";
818 print
'</form>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
run_sql($sqlfile, $silent=1, $entity=0, $usesavepoint=1, $handler='', $okerror='default', $linelengthlimit=32768, $nocommentremoval=0, $offsetforchartofaccount=0, $colspan=0, $onlysqltoimportwebsite=0, $database='')
Launch a sql file.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
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.
Class to manage accounting accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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.
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.
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.
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.