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 < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
78$offset = $limit * $page;
82 $sortfield =
"aa.account_number";
89 'aa.account_number' => array(
'label' =>
"AccountNumber",
'checked' => 1),
90 'aa.label' => array(
'label' =>
"Label",
'checked' => 1),
91 'aa.labelshort' => array(
'label' =>
"LabelToShow",
'checked' => 1),
92 'aa.account_parent' => array(
'label' =>
"Accountparent",
'checked' => 1),
93 'aa.pcg_type' => array(
'label' =>
"Pcgtype",
'checked' => 1,
'help' =>
'PcgtypeDesc'),
94 'categories' => array(
'label' =>
"AccountingCategories",
'checked' => -1,
'help' =>
'AccountingCategoriesDesc'),
95 'aa.reconcilable' => array(
'label' =>
"Reconcilable",
'checked' => 1),
96 'aa.import_key' => array(
'label' =>
"ImportId",
'checked' => -1,
'help' =>
''),
97 'aa.active' => array(
'label' =>
"Activated",
'checked' => 1)
101 unset($arrayfields[
'categories']);
102 unset($arrayfields[
'aa.reconcilable']);
108$hookmanager->initHooks(array(
'accountancyadminaccount'));
115if (
GETPOST(
'cancel',
'alpha')) {
119if (!
GETPOST(
'confirmmassaction',
'alpha')) {
123$parameters = array(
'chartofaccounts' => $chartofaccounts,
'permissiontoadd' => $permissiontoadd,
'permissiontodelete' => $permissiontodelete);
124$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $accounting, $action);
129if (empty($reshook)) {
130 if (!empty($cancel)) {
134 $objectclass =
'AccountingAccount';
135 $uploaddir = $conf->accounting->multidir_output[$conf->entity];
136 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
138 if ($action ==
"delete") {
141 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
143 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
144 $search_account =
"";
146 $search_labelshort =
"";
147 $search_accountparent =
"";
148 $search_pcgtype =
"";
149 $search_import_key =
"";
150 $search_array_options = array();
156 if ($chartofaccounts > 0 && $permissiontoadd) {
159 $sql =
'SELECT code FROM '.MAIN_DB_PREFIX.
'c_country as c, '.MAIN_DB_PREFIX.
'accounting_system as a';
160 $sql .=
' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
161 $resql = $db->query($sql);
163 $obj = $db->fetch_object($resql);
165 $country_code = $obj->code;
173 $sqlfile = DOL_DOCUMENT_ROOT.
'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).
'.sql';
175 $offsetforchartofaccount = 0;
179 $tmp = file_get_contents($sqlfile);
181 if (preg_match(
'/-- ADD (\d+) to rowid/ims', $tmp, $reg)) {
182 $offsetforchartofaccount += $reg[1];
184 $offsetforchartofaccount += ($conf->entity * 100000000);
186 $result =
run_sql($sqlfile, 1, $conf->entity, 1,
'',
'default', 32768, 0, $offsetforchartofaccount);
195 if (!
dolibarr_set_const($db,
'CHARTOFACCOUNTS', $chartofaccounts,
'chaine', 0,
'', $conf->entity)) {
203 if ($action ==
'disable' && $permissiontoadd) {
204 if ($accounting->fetch(
$id)) {
206 $result = $accounting->accountDeactivate(
$id, $mode);
213 } elseif ($action ==
'enable' && $permissiontoadd) {
214 if ($accounting->fetch(
$id)) {
216 $result = $accounting->accountActivate(
$id, $mode);
229$form =
new Form($db);
232$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
234llxHeader(
'', $langs->trans(
"ListAccounts"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_account');
236if ($action ==
'delete') {
237 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$id, $langs->trans(
'DeleteAccount'), $langs->trans(
'ConfirmDeleteAccount'),
'confirm_delete',
'', 0, 1);
243$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,";
244$sql .=
" aa.reconcilable, aa.active, aa.import_key,";
245$sql .=
" a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
248$parameters = array();
249$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
250$sql .= $hookmanager->resPrint;
251$sql = preg_replace(
'/,\s*$/',
'', $sql);
253$sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_account as aa";
254$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int) $conf->entity);
255$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int) $conf->entity);
258$parameters = array();
259$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object);
260$sql .= $hookmanager->resPrint;
262$sql .=
" WHERE asy.rowid = ".((int) $pcgver);
264if (strlen(trim($search_account))) {
265 $lengthpaddingaccount = 0;
269 $search_account_tmp = $search_account;
270 $weremovedsomezero = 0;
271 if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
272 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
273 if (preg_match(
'/0$/', $search_account_tmp)) {
274 $weremovedsomezero++;
275 $search_account_tmp = preg_replace(
'/0$/',
'', $search_account_tmp);
281 if ($search_account_tmp) {
282 if ($weremovedsomezero) {
283 $search_account_tmp_clean = $search_account_tmp;
284 $search_account_clean = $search_account;
286 if (substr($search_account_tmp, 0, 1) ===
'^') {
288 $search_account_tmp_clean = preg_replace(
'/^\^/',
'', $search_account_tmp);
289 $search_account_clean = preg_replace(
'/^\^/',
'', $search_account);
291 $sql .=
" AND (aa.account_number LIKE '".$db->escape($startchar.$search_account_tmp_clean).
"'";
292 $sql .=
" OR aa.account_number LIKE '".$db->escape($startchar.$search_account_clean).
"%')";
298if (strlen(trim($search_label))) {
301if (strlen(trim($search_labelshort))) {
304if (strlen(trim($search_accountparent)) && $search_accountparent !=
'-1') {
305 $sql .=
natural_search(
"aa.account_parent", $search_accountparent, 2);
307if (strlen(trim($search_pcgtype))) {
310if (strlen(trim($search_import_key))) {
315$parameters = array();
316$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
317$sql .= $hookmanager->resPrint;
319$sql .= $db->order($sortfield, $sortorder);
323$nbtotalofrecords =
'';
325 $resql = $db->query($sql);
326 $nbtotalofrecords = $db->num_rows($resql);
327 if (($page * $limit) > $nbtotalofrecords) {
333$sql .= $db->plimit($limit + 1, $offset);
335dol_syslog(
"accountancy/admin/account.php:: sql=".$sql);
336$resql = $db->query($sql);
339 $num = $db->num_rows($resql);
341 $arrayofselected = is_array($toselect) ? $toselect : array();
344 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
345 $param .=
'&contextpage='.urlencode($contextpage);
347 if ($limit > 0 && $limit != $conf->liste_limit) {
348 $param .=
'&limit='.((int) $limit);
350 if ($search_account) {
351 $param .=
'&search_account='.urlencode($search_account);
354 $param .=
'&search_label='.urlencode($search_label);
356 if ($search_labelshort) {
357 $param .=
'&search_labelshort='.urlencode($search_labelshort);
359 if ($search_accountparent > 0 || $search_accountparent ==
'0') {
360 $param .=
'&search_accountparent='.urlencode($search_accountparent);
362 if ($search_pcgtype) {
363 $param .=
'&search_pcgtype='.urlencode($search_pcgtype);
365 if ($search_import_key) {
366 $param .=
'&search_import_key='.urlencode($search_import_key);
368 if ($optioncss !=
'') {
369 $param .=
'&optioncss='.urlencode($optioncss);
373 $parameters = array();
374 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
375 $param .= $hookmanager->resPrint;
377 if (!empty($conf->use_javascript_ajax)) {
378 print
'<!-- Add javascript to reload page when we click "Change plan" -->
379 <script type="text/javascript">
380 $(document).ready(function () {
381 $("#change_chart").on("click", function (e) {
382 console.log("chartofaccounts selected = "+$("#chartofaccounts").val());
384 window.location.href = "'.$_SERVER[
"PHP_SELF"].
'?valid_change_chart=1&chartofaccounts="+$("#chartofaccounts").val();
391 $arrayofmassactions = array();
392 if ($user->hasRight(
'accounting',
'chartofaccount')) {
393 $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
395 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
396 $arrayofmassactions = array();
399 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
402 $newcardbutton =
dolGetButtonTitle($langs->trans(
'Addanaccount'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/accountancy/admin/card.php?action=create',
'', $permissiontoadd);
405 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
406 if ($optioncss !=
'') {
407 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
409 print
'<input type="hidden" name="token" value="'.newToken().
'">';
410 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
411 print
'<input type="hidden" name="action" value="list">';
412 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
413 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
414 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
417 print_barre_liste($langs->trans(
'ListAccounts'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'accounting_account', 0, $newcardbutton,
'', $limit, 0, 0, 1);
419 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
422 print $langs->trans(
"Selectchartofaccounts").
" : ";
423 print
'<select class="flat minwidth200" name="chartofaccounts" id="chartofaccounts">';
424 $sql =
"SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
425 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_system as a";
426 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON a.fk_country = c.rowid AND c.active = 1";
427 $sql .=
" WHERE a.active = 1";
429 dol_syslog(
"accountancy/admin/account.php sql=".$sql);
431 $resqlchart = $db->query($sql);
433 $numbis = $db->num_rows($resqlchart);
435 print
'<option value="-1"> </option>';
436 while ($i < $numbis) {
437 $obj = $db->fetch_object($resqlchart);
439 print
'<option value="'.$obj->rowid.
'"';
440 print ($pcgver == $obj->rowid) ?
' selected' :
'';
441 print
'>'.$obj->pcg_version.
' - '.$obj->label.
' - ('.$obj->country_code.
')</option>';
450 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")).
'">';
454 $parameters = array();
455 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
456 print $hookmanager->resPrint;
460 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
461 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
462 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
463 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
466 if ($moreforfilter) {
467 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
468 print $moreforfilter;
474 $totalarray = array();
475 $totalarray[
'nbfield'] = 0;
477 print
'<div class="div-table-responsive">';
478 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
482 print
'<tr class="liste_titre_filter">';
486 print
'<td class="liste_titre center maxwidthsearch">';
487 $searchpicto = $form->showFilterButtons(
'left');
491 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
492 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_account" value="'.$search_account.
'"></td>';
494 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
495 print
'<td class="liste_titre"><input type="text" class="flat width150" name="search_label" value="'.$search_label.
'"></td>';
497 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
498 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_labelshort" value="'.$search_labelshort.
'"></td>';
500 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
501 print
'<td class="liste_titre">';
502 print $formaccounting->select_account($search_accountparent,
'search_accountparent', 2, array(), 0, 0,
'maxwidth150');
506 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
507 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_pcgtype" value="'.$search_pcgtype.
'"></td>';
510 if (!empty($arrayfields[
'categories'][
'checked'])) {
511 print
'<td class="liste_titre"></td>';
515 $parameters = array(
'arrayfields' => $arrayfields);
516 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
517 print $hookmanager->resPrint;
520 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
521 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_import_key" value="'.$search_import_key.
'"></td>';
524 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
525 print
'<td class="liste_titre"> </td>';
528 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
529 print
'<td class="liste_titre"> </td>';
533 print
'<td class="liste_titre center maxwidthsearch">';
534 $searchpicto = $form->showFilterButtons();
540 $totalarray = array();
541 $totalarray[
'nbfield'] = 0;
545 print
'<tr class="liste_titre">';
548 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
549 $totalarray[
'nbfield']++;
551 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
552 print_liste_field_titre($arrayfields[
'aa.account_number'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_number",
"", $param,
'', $sortfield, $sortorder);
553 $totalarray[
'nbfield']++;
555 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
556 print_liste_field_titre($arrayfields[
'aa.label'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.label",
"", $param,
'', $sortfield, $sortorder);
557 $totalarray[
'nbfield']++;
559 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
560 print_liste_field_titre($arrayfields[
'aa.labelshort'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.labelshort",
"", $param,
'', $sortfield, $sortorder);
561 $totalarray[
'nbfield']++;
563 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
564 print_liste_field_titre($arrayfields[
'aa.account_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_parent",
"", $param,
'', $sortfield, $sortorder,
'left ');
565 $totalarray[
'nbfield']++;
567 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
568 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);
569 $totalarray[
'nbfield']++;
571 if (!empty($arrayfields[
'categories'][
'checked'])) {
572 print_liste_field_titre($arrayfields[
'categories'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'categories'][
'help'], 1);
573 $totalarray[
'nbfield']++;
577 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
578 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
579 print $hookmanager->resPrint;
581 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
582 print_liste_field_titre($arrayfields[
'aa.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.import_key',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'aa.import_key'][
'help'], 1);
583 $totalarray[
'nbfield']++;
586 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
587 print_liste_field_titre($arrayfields[
'aa.reconcilable'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.reconcilable',
'', $param,
'', $sortfield, $sortorder);
588 $totalarray[
'nbfield']++;
591 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
592 print_liste_field_titre($arrayfields[
'aa.active'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.active',
'', $param,
'', $sortfield, $sortorder);
593 $totalarray[
'nbfield']++;
597 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
598 $totalarray[
'nbfield']++;
605 while ($i < min($num, $limit)) {
606 $obj = $db->fetch_object($resql);
608 $accountstatic->id = $obj->rowid;
609 $accountstatic->label = $obj->label;
610 $accountstatic->account_number = $obj->account_number;
612 print
'<tr class="oddeven">';
616 print
'<td class="center nowraponall">';
617 if ($user->hasRight(
'accounting',
'chartofaccount')) {
618 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
622 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
626 if ($massactionbutton || $massaction) {
628 if (in_array($obj->rowid, $arrayofselected)) {
631 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
636 $totalarray[
'nbfield']++;
641 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
643 print $accountstatic->getNomUrl(1, 0, 0,
'', 0, 1, 0,
'accountcard');
646 $totalarray[
'nbfield']++;
651 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
652 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">';
656 $totalarray[
'nbfield']++;
661 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
666 $totalarray[
'nbfield']++;
671 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
674 if (!empty($obj->account_parent) && !empty($obj->rowid2)) {
676 print
'<!-- obj->account_parent = '.$obj->account_parent.
' obj->rowid2 = '.$obj->rowid2.
' -->';
677 $accountparent->id = $obj->rowid2;
678 $accountparent->label = $obj->label2;
679 $accountparent->account_number = $obj->account_number2;
680 print $accountparent->getNomUrl(1);
683 $totalarray[
'nbfield']++;
687 if (!empty($obj->account_parent)) {
688 print
'<!-- Bad value for obj->account_parent = '.$obj->account_parent.
': is a rowid that does not exists -->';
692 $totalarray[
'nbfield']++;
698 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
703 $totalarray[
'nbfield']++;
707 if (!empty($arrayfields[
'categories'][
'checked'])) {
713 $totalarray[
'nbfield']++;
718 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
719 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
720 print $hookmanager->resPrint;
723 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
728 $totalarray[
'nbfield']++;
734 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
735 print
'<td class="center">';
736 if (empty($obj->reconcilable)) {
737 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&mode=1&token='.
newToken().
'">';
738 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
741 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&mode=1&token='.
newToken().
'">';
742 print
img_picto($langs->trans(
"Activated"),
'switch_on');
747 $totalarray[
'nbfield']++;
753 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
754 print
'<td class="center">';
755 if (empty($obj->active)) {
756 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&mode=0&token='.
newToken().
'">';
757 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
760 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&mode=0&token='.
newToken().
'">';
761 print
img_picto($langs->trans(
"Activated"),
'switch_on');
766 $totalarray[
'nbfield']++;
772 print
'<td class="center nowraponall">';
773 if ($user->hasRight(
'accounting',
'chartofaccount')) {
774 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
778 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
782 if ($massactionbutton || $massaction) {
784 if (in_array($obj->rowid, $arrayofselected)) {
787 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
792 $totalarray[
'nbfield']++;
802 foreach ($arrayfields as $key => $val) {
803 if (!empty($val[
'checked'])) {
807 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
812 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
813 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
814 print $hookmanager->resPrint;
816 print
'</table>'.
"\n";
819 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.
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_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.
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.