29require
'../../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
43$langs->loadLangs(array(
'accountancy',
'admin',
'bills',
'compta',
'salaries'));
45$action =
GETPOST(
'action',
'aZ09');
46$cancel =
GETPOST(
'cancel',
'alpha');
49$massaction =
GETPOST(
'massaction',
'aZ09');
50$optioncss =
GETPOST(
'optioncss',
'alpha');
51$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'accountingaccountlist';
54$search_account =
GETPOST(
'search_account',
'alpha');
55$search_label =
GETPOST(
'search_label',
'alpha');
56$search_labelshort =
GETPOST(
'search_labelshort',
'alpha');
57$search_accountparent =
GETPOST(
'search_accountparent',
'alpha');
58$search_pcgtype =
GETPOST(
'search_pcgtype',
'alpha');
59$search_import_key =
GETPOST(
'search_import_key',
'alpha');
60$search_reconcilable =
GETPOST(
"search_reconcilable",
'int');
61$search_centralized =
GETPOST(
"search_centralized",
'int');
62$search_active =
GETPOST(
"search_active",
'int');
63$toselect =
GETPOST(
'toselect',
'array:int');
65$confirm =
GETPOST(
'confirm',
'alpha');
67$chartofaccounts =
GETPOSTINT(
'chartofaccounts');
69$permissiontoadd = $user->hasRight(
'accounting',
'chartofaccount');
70$permissiontodelete = $user->hasRight(
'accounting',
'chartofaccount');
73if ($user->socid > 0) {
76if (!$permissiontoadd) {
83$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
84$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
86if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
90$offset = $limit * $page;
94 $sortfield =
"aa.account_number";
103 'aa.account_number' => array(
'label' =>
"AccountNumber",
'checked' =>
'1',
'csslist' =>
'maxwidth50'),
104 'aa.label' => array(
'label' =>
"Label",
'checked' =>
'1'),
105 'aa.labelshort' => array(
'label' =>
"ShortLabel",
'checked' =>
'1'),
106 'aa.account_parent' => array(
'label' =>
"Accountparent",
'checked' =>
'1'),
107 'aa.pcg_type' => array(
'label' =>
"Pcgtype",
'checked' =>
'1',
'help' =>
'PcgtypeDesc'),
108 'categories' => array(
'label' =>
"AccountingCategories",
'checked' =>
'-1',
'help' =>
'AccountingCategoriesDesc'),
109 'aa.reconcilable' => array(
'label' =>
"Reconcilable",
'checked' =>
'1'),
110 'aa.centralized' => array(
'label' =>
"Centralized",
'checked' =>
'1',
'help' =>
'CentralizedAccountHelp'),
111 'aa.import_key' => array(
'label' =>
"ImportId",
'checked' =>
'-1',
'help' =>
''),
112 'aa.active' => array(
'label' =>
"Activated",
'checked' =>
'1')
116 unset($arrayfields[
'categories']);
117 unset($arrayfields[
'aa.reconcilable']);
123$hookmanager->initHooks(array(
'accountancyadminaccount'));
130if (
GETPOST(
'cancel',
'alpha')) {
134if (!
GETPOST(
'confirmmassaction',
'alpha')) {
138$parameters = array(
'chartofaccounts' => $chartofaccounts,
'permissiontoadd' => $permissiontoadd,
'permissiontodelete' => $permissiontodelete);
139$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $accounting, $action);
144if (empty($reshook)) {
145 if (!empty($cancel)) {
149 $objectclass =
'AccountingAccount';
150 $uploaddir =
$conf->accounting->multidir_output[
$conf->entity];
151 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
153 if ($action ==
"delete") {
156 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
158 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
159 $search_account =
"";
161 $search_labelshort =
"";
162 $search_accountparent =
"";
163 $search_pcgtype =
"";
164 $search_import_key =
"";
165 $search_reconcilable =
"";
166 $search_centralized =
"";
168 $search_array_options = array();
174 if ($chartofaccounts > 0 ) {
177 $sql =
'SELECT code FROM '.MAIN_DB_PREFIX.
'c_country as c, '.MAIN_DB_PREFIX.
'accounting_system as a';
178 $sql .=
' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
179 $resql =
$db->query($sql);
181 $obj =
$db->fetch_object($resql);
183 $country_code = $obj->code;
191 $sqlfile = DOL_DOCUMENT_ROOT.
'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).
'.sql';
193 $offsetforchartofaccount = 0;
197 $tmp = file_get_contents($sqlfile);
199 if (preg_match(
'/-- ADD (\d+) to rowid/ims', $tmp, $reg)) {
200 $offsetforchartofaccount += $reg[1];
202 $offsetforchartofaccount += (
$conf->entity * 100000000);
204 $result =
run_sql($sqlfile, 1,
$conf->entity, 1,
'',
'default', 32768, 0, $offsetforchartofaccount);
221 if ($action ==
'disable' ) {
222 if ($accounting->fetch(
$id)) {
224 $result = $accounting->accountDeactivate(
$id, $mode);
231 } elseif ($action ==
'enable' ) {
232 if ($accounting->fetch(
$id)) {
235 if ($mode == 1 && !empty($accounting->centralized)) {
236 setEventMessages($langs->trans(
'CentralizedAccountCannotBeMatchable'),
null,
'errors');
238 $result = $accounting->accountActivate(
$id, $mode);
243 if ($mode == 2 && $result >= 0) {
244 $result = $accounting->accountDeactivate(
$id, 1);
262$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
264llxHeader(
'', $langs->trans(
"ListAccounts"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_account');
266if ($action ==
'delete') {
267 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$id, $langs->trans(
'DeleteAccount'), $langs->trans(
'ConfirmDeleteAccount'),
'confirm_delete',
'', 0, 1);
273$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,";
275 $sql .=
" (SELECT COUNT(*) FROM ".MAIN_DB_PREFIX.
"accounting_category_account aca WHERE aca.fk_accounting_account = aa.rowid) as nb_categories,";
277$sql .=
" aa.reconcilable, aa.centralized, aa.active, aa.import_key,";
278$sql .=
" a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
281$parameters = array();
282$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
283$sql .= $hookmanager->resPrint;
284$sql = preg_replace(
'/,\s*$/',
'', $sql);
286$sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_account as aa";
287$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int)
$conf->entity);
288$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int)
$conf->entity);
291$parameters = array();
292$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object);
293$sql .= $hookmanager->resPrint;
295$sql .=
" WHERE asy.rowid = ".((int) $pcgver);
297if (strlen(trim($search_account))) {
298 $lengthpaddingaccount = 0;
302 $search_account_tmp = $search_account;
303 $weremovedsomezero = 0;
304 if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
305 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
306 if (preg_match(
'/0$/', $search_account_tmp)) {
307 $weremovedsomezero++;
308 $search_account_tmp = preg_replace(
'/0$/',
'', $search_account_tmp);
314 if ($search_account_tmp) {
315 if ($weremovedsomezero) {
316 $search_account_tmp_clean = $search_account_tmp;
317 $search_account_clean = $search_account;
319 if (substr($search_account_tmp, 0, 1) ===
'^') {
321 $search_account_tmp_clean = preg_replace(
'/^\^/',
'', $search_account_tmp);
322 $search_account_clean = preg_replace(
'/^\^/',
'', $search_account);
324 $sql .=
" AND (aa.account_number LIKE '".$db->escape($startchar.$search_account_tmp_clean).
"'";
325 $sql .=
" OR aa.account_number LIKE '".$db->escape($startchar.$search_account_clean).
"%')";
331if (strlen(trim($search_label))) {
334if (strlen(trim($search_labelshort))) {
337if (strlen(trim($search_accountparent)) && $search_accountparent !=
'-1') {
338 $sql .=
natural_search(
"aa.account_parent", $search_accountparent, 2);
340if (strlen(trim($search_pcgtype))) {
343if ($search_reconcilable !=
'' && $search_reconcilable !=
'-1') {
344 $sql .=
" AND aa.reconcilable = ".((int) $search_reconcilable);
346if ($search_centralized !=
'' && $search_centralized !=
'-1') {
347 $sql .=
" AND aa.centralized = ".((int) $search_centralized);
349if ($search_active !=
'' && $search_active !=
'-1') {
350 $sql .=
" AND aa.active = ".((int) $search_active);
352if (strlen(trim($search_import_key))) {
357$parameters = array();
358$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
359$sql .= $hookmanager->resPrint;
361$sql .=
$db->order($sortfield, $sortorder);
365$nbtotalofrecords =
'';
367 $resql =
$db->query($sql);
368 $nbtotalofrecords =
$db->num_rows($resql);
369 if (($page * $limit) > (
int) $nbtotalofrecords) {
375$sql .=
$db->plimit($limit + 1, $offset);
377dol_syslog(
"accountancy/admin/account.php:: sql=".$sql);
378$resql =
$db->query($sql);
381 $num =
$db->num_rows($resql);
383 $arrayofselected = is_array($toselect) ? $toselect : array();
387 if ($contextpage != $_SERVER[
"PHP_SELF"]) {
388 $param .=
'&contextpage='.urlencode($contextpage);
390 if ($limit > 0 && $limit !=
$conf->liste_limit) {
391 $param .=
'&limit='.((int) $limit);
393 if ($search_account) {
394 $param .=
'&search_account='.urlencode($search_account);
397 $param .=
'&search_label='.urlencode($search_label);
399 if ($search_labelshort) {
400 $param .=
'&search_labelshort='.urlencode($search_labelshort);
402 if ($search_accountparent > 0 || $search_accountparent ==
'0') {
403 $param .=
'&search_accountparent='.urlencode($search_accountparent);
405 if ($search_pcgtype) {
406 $param .=
'&search_pcgtype='.urlencode($search_pcgtype);
408 if ($search_import_key) {
409 $param .=
'&search_import_key='.urlencode($search_import_key);
411 if ($optioncss !=
'') {
412 $param .=
'&optioncss='.urlencode($optioncss);
416 $parameters = array();
417 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
418 $param .= $hookmanager->resPrint;
420 if (!empty(
$conf->use_javascript_ajax)) {
421 print
'<!-- Add javascript to reload page when we click "Change plan" -->
422 <script type="text/javascript">
423 $(document).ready(function () {
424 $("#change_chart").on("click", function (e) {
425 console.log("chartofaccounts selected = "+$("#chartofaccounts").val());
427 window.location.href = "'.$_SERVER[
"PHP_SELF"].
'?valid_change_chart=1&chartofaccounts="+$("#chartofaccounts").val();
434 $arrayofmassactions = array();
436 $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
438 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
439 $arrayofmassactions = array();
442 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
445 $newcardbutton = dolGetButtonTitle($langs->trans(
'Addanaccount'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/accountancy/admin/card.php?action=create',
'', $permissiontoadd);
448 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
449 if ($optioncss !=
'') {
450 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
452 print
'<input type="hidden" name="token" value="'.newToken().
'">';
453 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
454 print
'<input type="hidden" name="action" value="list">';
455 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
456 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
457 print
'<input type="hidden" name="page" value="'.$page.
'">';
458 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
459 print
'<input type="hidden" name="page_y" value="">';
462 print_barre_liste($langs->trans(
'ListAccounts'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'accounting_account', 0, $newcardbutton,
'', $limit, 0, 0, 1);
464 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
466 print
'<div class="neutral">';
469 print $langs->trans(
"Selectchartofaccounts").
" : ";
470 print
'<select class="flat minwidth200" name="chartofaccounts" id="chartofaccounts">';
471 $sql =
"SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
472 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_system as a";
473 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON a.fk_country = c.rowid AND c.active = 1";
474 $sql .=
" WHERE a.active = 1";
475 $sql .=
" ORDER BY c.code, a.pcg_version";
477 dol_syslog(
"accountancy/admin/account.php sql=".$sql);
479 $resqlchart =
$db->query($sql);
481 $numbis =
$db->num_rows($resqlchart);
483 print
'<option value="-1"> </option>';
484 while ($i < $numbis) {
485 $obj =
$db->fetch_object($resqlchart);
487 $labeltoshow = $obj->country_code.
' - '.$obj->pcg_version.
' - '.$obj->label;
488 $htmltoshow =
picto_from_langcode($obj->country_code).
' '.$obj->country_code.
' - '.$obj->pcg_version.
' <span class="opacitymedium">- '.$obj->label.
'</span>';
490 print ($pcgver == $obj->rowid) ?
' selected' :
'';
491 print
'>'.$labeltoshow.
'</option>';
500 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")).
'">';
504 $parameters = array(
'chartofaccounts' => $chartofaccounts,
'permissiontoadd' => $permissiontoadd,
'permissiontodelete' => $permissiontodelete);
505 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $accounting, $action);
506 print $hookmanager->resPrint;
508 $parameters = array();
509 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
510 print $hookmanager->resPrint;
514 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
515 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
516 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
517 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
531 print
'<div class="div-table-responsive">';
533 print
'<table class="tagtable liste">'.
"\n";
537 print
'<tr class="liste_titre_filter">';
540 if (
$conf->main_checkbox_left_column) {
541 print
'<td class="liste_titre center maxwidthsearch">';
542 $searchpicto = $form->showFilterButtons(
'left');
546 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
547 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_account" value="'.$search_account.
'"></td>';
549 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
550 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$search_label.
'"></td>';
552 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
553 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_labelshort" value="'.$search_labelshort.
'"></td>';
555 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
556 print
'<td class="liste_titre">';
557 print $formaccounting->select_account($search_accountparent,
'search_accountparent', 2, array(), 0, 0,
'maxwidth150');
561 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
562 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_pcgtype" value="'.$search_pcgtype.
'"></td>';
565 if (!empty($arrayfields[
'categories'][
'checked'])) {
566 print
'<td class="liste_titre"></td>';
570 $parameters = array(
'arrayfields' => $arrayfields);
571 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
572 print $hookmanager->resPrint;
575 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
576 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_import_key" value="'.$search_import_key.
'"></td>';
580 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
581 print
'<td class="liste_titre center">';
582 print $form->selectyesno(
'search_reconcilable', $search_reconcilable, 1,
false, 1, 1,
'search_status onrightofpage width75');
587 if (!empty($arrayfields[
'aa.centralized'][
'checked'])) {
588 print
'<td class="liste_titre center">';
589 print $form->selectyesno(
'search_centralized', $search_centralized, 1,
false, 1, 1,
'search_status onrightofpage width75');
594 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
595 print
'<td class="liste_titre center parentonrightofpage">';
596 print $form->selectyesno(
'search_active', $search_active, 1,
false, 1, 1,
'search_status onrightofpage width75');
601 if (!
$conf->main_checkbox_left_column) {
602 print
'<td class="liste_titre center maxwidthsearch">';
603 $searchpicto = $form->showFilterButtons();
614 print
'<tr class="liste_titre">';
616 if (
$conf->main_checkbox_left_column) {
617 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
620 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
621 print_liste_field_titre($arrayfields[
'aa.account_number'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_number",
"", $param,
'', $sortfield, $sortorder);
624 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
625 print_liste_field_titre($arrayfields[
'aa.label'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.label",
"", $param,
'', $sortfield, $sortorder);
628 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
629 print_liste_field_titre($arrayfields[
'aa.labelshort'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.labelshort",
"", $param,
'', $sortfield, $sortorder);
632 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
633 print_liste_field_titre($arrayfields[
'aa.account_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_parent",
"", $param,
'', $sortfield, $sortorder,
'left ');
637 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
638 print_liste_field_titre($arrayfields[
'aa.pcg_type'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.pcg_type,aa.account_number',
'', $param,
'', $sortfield, $sortorder,
'right ', $arrayfields[
'aa.pcg_type'][
'help'].
'::-1', 1);
642 if (!empty($arrayfields[
'categories'][
'checked'])) {
643 print_liste_field_titre($arrayfields[
'categories'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'categories'][
'help'].
'::-1', 1);
648 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
649 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
650 print $hookmanager->resPrint;
652 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
653 print_liste_field_titre($arrayfields[
'aa.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.import_key',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'aa.import_key'][
'help'].
'::-1', 1);
656 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
657 print_liste_field_titre($arrayfields[
'aa.reconcilable'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.reconcilable',
'', $param,
'', $sortfield, $sortorder,
'center ');
660 if (!empty($arrayfields[
'aa.centralized'][
'checked'])) {
661 print_liste_field_titre($arrayfields[
'aa.centralized'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.centralized',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'aa.centralized'][
'help'].
'::-1', 1);
664 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
665 print_liste_field_titre($arrayfields[
'aa.active'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.active',
'', $param,
'', $sortfield, $sortorder,
'center ');
669 if (!
$conf->main_checkbox_left_column) {
670 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
678 while ($i < min($num, $limit)) {
679 $obj =
$db->fetch_object($resql);
681 $accountstatic->id = $obj->rowid;
682 $accountstatic->label = $obj->label;
683 $accountstatic->account_number = $obj->account_number;
685 print
'<tr class="oddeven">';
688 if (
$conf->main_checkbox_left_column) {
689 print
'<td class="center nowraponall">';
691 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
695 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
699 if ($massactionbutton || $massaction) {
701 if (in_array($obj->rowid, $arrayofselected)) {
704 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
714 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
716 print $accountstatic->getNomUrl(1, 0, 0,
'', 0, 1, 0,
'accountcard');
724 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
725 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">';
734 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
744 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
747 if (!empty($obj->account_parent) && !empty($obj->rowid2)) {
749 print
'<!-- obj->account_parent = '.$obj->account_parent.
' obj->rowid2 = '.$obj->rowid2.
' -->';
750 $accountparent->id = $obj->rowid2;
751 $accountparent->label = $obj->label2;
752 $accountparent->account_number = $obj->account_number2;
753 print $accountparent->getNomUrl(1);
760 if (!empty($obj->account_parent)) {
761 print
'<!-- Bad value for obj->account_parent = '.$obj->account_parent.
': is a rowid that does not exists -->';
771 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
780 if (!empty($arrayfields[
'categories'][
'checked'])) {
785 if (!empty($obj->nb_categories)) {
787 $categories = $accountingcategory_temp->getCategoriesForAccount($obj->rowid);
789 $categoriesLabels = array();
790 foreach ($categories as $cat) {
791 $categoriesLabels[] =
'<span class="badge badge-status4" title="'.dol_escape_htmltag($cat[
'label']).
'">'.
dol_escape_htmltag($cat[
'code']).
'</span>';
793 print implode(
' ', $categoriesLabels);
795 print
'<span class="opacitymedium">-</span>';
799 if (!empty($obj->fk_accounting_category)) {
802 print
'<span class="opacitymedium">-</span>';
813 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
814 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
815 print $hookmanager->resPrint;
818 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
828 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
829 print
'<td class="center">';
830 if (!empty($obj->centralized)) {
832 print
'<a style="cursor:not-allowed;" title="' .
dol_escape_htmltag($langs->trans(
'CentralizedAccountCannotBeMatchable')) .
'">';
833 print
img_picto(
'', !empty($obj->reconcilable) ?
'switch_on' :
'switch_off',
'', 0, 0, 1,
'',
'opacitymedium');
836 if (empty($obj->reconcilable)) {
837 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?id=' . $obj->rowid .
'&action=enable&page=' . $page .
'&mode=1&token=' . newToken() .
'">';
838 print
img_picto($langs->trans(
'Disabled'),
'switch_off');
841 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?id=' . $obj->rowid .
'&action=disable&page=' . $page .
'&mode=1&token=' . newToken() .
'">';
842 print
img_picto($langs->trans(
'Activated'),
'switch_on');
853 if (!empty($arrayfields[
'aa.centralized'][
'checked'])) {
854 print
'<td class="center">';
855 if (empty($obj->centralized)) {
856 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&page='.$page.
'&mode=2&token='.newToken().
'">';
857 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
860 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&page='.$page.
'&mode=2&token='.newToken().
'">';
861 print
img_picto($langs->trans(
"Activated"),
'switch_on');
871 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
872 print
'<td class="center">';
873 if (empty($obj->active)) {
874 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&page='.$page.
'&mode=0&token='.newToken().
'">';
875 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
878 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&page='.$page.
'&mode=0&token='.newToken().
'">';
879 print
img_picto($langs->trans(
"Activated"),
'switch_on');
889 if (!
$conf->main_checkbox_left_column) {
890 print
'<td class="center nowraponall">';
892 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param.
'&page='.$page).
'">';
896 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param.
'&page='.$page).
'">';
900 if ($massactionbutton || $massaction) {
902 if (in_array($obj->rowid, $arrayofselected)) {
905 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
920 foreach ($arrayfields as $key => $val) {
921 if (!empty($val[
'checked'])) {
925 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
930 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
931 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
932 print $hookmanager->resPrint;
934 print
'</table>'.
"\n";
937 print
'</form>'.
"\n";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 categories of an accounting account.
Class to manage accounting accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $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, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
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.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
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...
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.