29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
44$langs->loadLangs(array(
'accountancy',
'admin',
'bills',
'compta',
'salaries'));
46$action =
GETPOST(
'action',
'aZ09');
47$cancel =
GETPOST(
'cancel',
'alpha');
50$massaction =
GETPOST(
'massaction',
'aZ09');
51$optioncss =
GETPOST(
'optioncss',
'alpha');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'accountingaccountlist';
55$search_account =
GETPOST(
'search_account',
'alpha');
56$search_label =
GETPOST(
'search_label',
'alpha');
57$search_labelshort =
GETPOST(
'search_labelshort',
'alpha');
58$search_accountparent =
GETPOST(
'search_accountparent',
'alpha');
59$search_pcgtype =
GETPOST(
'search_pcgtype',
'alpha');
60$search_import_key =
GETPOST(
'search_import_key',
'alpha');
61$toselect =
GETPOST(
'toselect',
'array');
63$confirm =
GETPOST(
'confirm',
'alpha');
65$chartofaccounts =
GETPOSTINT(
'chartofaccounts');
67$permissiontoadd = $user->hasRight(
'accounting',
'chartofaccount');
68$permissiontodelete = $user->hasRight(
'accounting',
'chartofaccount');
71if ($user->socid > 0) {
74if (!$permissiontoadd) {
81$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
82$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
84if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
88$offset = $limit * $page;
92 $sortfield =
"aa.account_number";
99 'aa.account_number' => array(
'label' =>
"AccountNumber",
'checked' => 1),
100 'aa.label' => array(
'label' =>
"Label",
'checked' => 1),
101 'aa.labelshort' => array(
'label' =>
"LabelToShow",
'checked' => 1),
102 'aa.account_parent' => array(
'label' =>
"Accountparent",
'checked' => 1),
103 'aa.pcg_type' => array(
'label' =>
"Pcgtype",
'checked' => 1,
'help' =>
'PcgtypeDesc'),
104 'categories' => array(
'label' =>
"AccountingCategories",
'checked' => -1,
'help' =>
'AccountingCategoriesDesc'),
105 'aa.reconcilable' => array(
'label' =>
"Reconcilable",
'checked' => 1),
106 'aa.import_key' => array(
'label' =>
"ImportId",
'checked' => -1,
'help' =>
''),
107 'aa.active' => array(
'label' =>
"Activated",
'checked' => 1)
111 unset($arrayfields[
'categories']);
112 unset($arrayfields[
'aa.reconcilable']);
118$hookmanager->initHooks(array(
'accountancyadminaccount'));
125if (
GETPOST(
'cancel',
'alpha')) {
129if (!
GETPOST(
'confirmmassaction',
'alpha')) {
133$parameters = array(
'chartofaccounts' => $chartofaccounts,
'permissiontoadd' => $permissiontoadd,
'permissiontodelete' => $permissiontodelete);
134$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $accounting, $action);
139if (empty($reshook)) {
140 if (!empty($cancel)) {
144 $objectclass =
'AccountingAccount';
145 $uploaddir =
$conf->accounting->multidir_output[
$conf->entity];
146 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
148 if ($action ==
"delete") {
151 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
153 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
154 $search_account =
"";
156 $search_labelshort =
"";
157 $search_accountparent =
"";
158 $search_pcgtype =
"";
159 $search_import_key =
"";
160 $search_array_options = array();
166 if ($chartofaccounts > 0 ) {
169 $sql =
'SELECT code FROM '.MAIN_DB_PREFIX.
'c_country as c, '.MAIN_DB_PREFIX.
'accounting_system as a';
170 $sql .=
' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
171 $resql = $db->query($sql);
173 $obj = $db->fetch_object($resql);
175 $country_code = $obj->code;
183 $sqlfile = DOL_DOCUMENT_ROOT.
'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).
'.sql';
185 $offsetforchartofaccount = 0;
189 $tmp = file_get_contents($sqlfile);
191 if (preg_match(
'/-- ADD (\d+) to rowid/ims', $tmp, $reg)) {
192 $offsetforchartofaccount += $reg[1];
194 $offsetforchartofaccount += (
$conf->entity * 100000000);
196 $result =
run_sql($sqlfile, 1,
$conf->entity, 1,
'',
'default', 32768, 0, $offsetforchartofaccount);
213 if ($action ==
'disable' ) {
214 if ($accounting->fetch(
$id)) {
216 $result = $accounting->accountDeactivate(
$id, $mode);
223 } elseif ($action ==
'enable' ) {
224 if ($accounting->fetch(
$id)) {
226 $result = $accounting->accountActivate(
$id, $mode);
239$form =
new Form($db);
242$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
244llxHeader(
'', $langs->trans(
"ListAccounts"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_account');
246if ($action ==
'delete') {
247 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$id, $langs->trans(
'DeleteAccount'), $langs->trans(
'ConfirmDeleteAccount'),
'confirm_delete',
'', 0, 1);
253$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,";
254$sql .=
" aa.reconcilable, aa.active, aa.import_key,";
255$sql .=
" a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
258$parameters = array();
259$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
260$sql .= $hookmanager->resPrint;
261$sql = preg_replace(
'/,\s*$/',
'', $sql);
263$sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_account as aa";
264$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int)
$conf->entity);
265$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int)
$conf->entity);
268$parameters = array();
269$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object);
270$sql .= $hookmanager->resPrint;
272$sql .=
" WHERE asy.rowid = ".((int) $pcgver);
274if (strlen(trim($search_account))) {
275 $lengthpaddingaccount = 0;
279 $search_account_tmp = $search_account;
280 $weremovedsomezero = 0;
281 if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
282 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
283 if (preg_match(
'/0$/', $search_account_tmp)) {
284 $weremovedsomezero++;
285 $search_account_tmp = preg_replace(
'/0$/',
'', $search_account_tmp);
291 if ($search_account_tmp) {
292 if ($weremovedsomezero) {
293 $search_account_tmp_clean = $search_account_tmp;
294 $search_account_clean = $search_account;
296 if (substr($search_account_tmp, 0, 1) ===
'^') {
298 $search_account_tmp_clean = preg_replace(
'/^\^/',
'', $search_account_tmp);
299 $search_account_clean = preg_replace(
'/^\^/',
'', $search_account);
301 $sql .=
" AND (aa.account_number LIKE '".$db->escape($startchar.$search_account_tmp_clean).
"'";
302 $sql .=
" OR aa.account_number LIKE '".$db->escape($startchar.$search_account_clean).
"%')";
308if (strlen(trim($search_label))) {
311if (strlen(trim($search_labelshort))) {
314if (strlen(trim($search_accountparent)) && $search_accountparent !=
'-1') {
315 $sql .=
natural_search(
"aa.account_parent", $search_accountparent, 2);
317if (strlen(trim($search_pcgtype))) {
320if (strlen(trim($search_import_key))) {
325$parameters = array();
326$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
327$sql .= $hookmanager->resPrint;
329$sql .= $db->order($sortfield, $sortorder);
333$nbtotalofrecords =
'';
335 $resql = $db->query($sql);
336 $nbtotalofrecords = $db->num_rows($resql);
337 if (($page * $limit) > $nbtotalofrecords) {
343$sql .= $db->plimit($limit + 1, $offset);
345dol_syslog(
"accountancy/admin/account.php:: sql=".$sql);
346$resql = $db->query($sql);
349 $num = $db->num_rows($resql);
351 $arrayofselected = is_array($toselect) ? $toselect : array();
355 if ($contextpage != $_SERVER[
"PHP_SELF"]) {
356 $param .=
'&contextpage='.urlencode($contextpage);
358 if ($limit > 0 && $limit !=
$conf->liste_limit) {
359 $param .=
'&limit='.((int) $limit);
361 if ($search_account) {
362 $param .=
'&search_account='.urlencode($search_account);
365 $param .=
'&search_label='.urlencode($search_label);
367 if ($search_labelshort) {
368 $param .=
'&search_labelshort='.urlencode($search_labelshort);
370 if ($search_accountparent > 0 || $search_accountparent ==
'0') {
371 $param .=
'&search_accountparent='.urlencode($search_accountparent);
373 if ($search_pcgtype) {
374 $param .=
'&search_pcgtype='.urlencode($search_pcgtype);
376 if ($search_import_key) {
377 $param .=
'&search_import_key='.urlencode($search_import_key);
379 if ($optioncss !=
'') {
380 $param .=
'&optioncss='.urlencode($optioncss);
384 $parameters = array();
385 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
386 $param .= $hookmanager->resPrint;
388 if (!empty(
$conf->use_javascript_ajax)) {
389 print
'<!-- Add javascript to reload page when we click "Change plan" -->
390 <script type="text/javascript">
391 $(document).ready(function () {
392 $("#change_chart").on("click", function (e) {
393 console.log("chartofaccounts selected = "+$("#chartofaccounts").val());
395 window.location.href = "'.$_SERVER[
"PHP_SELF"].
'?valid_change_chart=1&chartofaccounts="+$("#chartofaccounts").val();
402 $arrayofmassactions = array();
404 $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
406 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
407 $arrayofmassactions = array();
410 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
413 $newcardbutton =
dolGetButtonTitle($langs->trans(
'Addanaccount'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/accountancy/admin/card.php?action=create',
'', $permissiontoadd);
416 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
417 if ($optioncss !=
'') {
418 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
420 print
'<input type="hidden" name="token" value="'.newToken().
'">';
421 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
422 print
'<input type="hidden" name="action" value="list">';
423 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
424 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
425 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
428 print_barre_liste($langs->trans(
'ListAccounts'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'accounting_account', 0, $newcardbutton,
'', $limit, 0, 0, 1);
430 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
433 print $langs->trans(
"Selectchartofaccounts").
" : ";
434 print
'<select class="flat minwidth200" name="chartofaccounts" id="chartofaccounts">';
435 $sql =
"SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
436 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_system as a";
437 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON a.fk_country = c.rowid AND c.active = 1";
438 $sql .=
" WHERE a.active = 1";
440 dol_syslog(
"accountancy/admin/account.php sql=".$sql);
442 $resqlchart = $db->query($sql);
444 $numbis = $db->num_rows($resqlchart);
446 print
'<option value="-1"> </option>';
447 while ($i < $numbis) {
448 $obj = $db->fetch_object($resqlchart);
450 print
'<option value="'.$obj->rowid.
'"';
451 print ($pcgver == $obj->rowid) ?
' selected' :
'';
452 print
'>'.$obj->pcg_version.
' - '.$obj->label.
' - ('.$obj->country_code.
')</option>';
461 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")).
'">';
465 $parameters = array();
466 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
467 print $hookmanager->resPrint;
471 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
472 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
473 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
474 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
478 $totalarray = array();
479 $totalarray[
'nbfield'] = 0;
488 print
'<div class="div-table-responsive">';
490 print
'<table class="tagtable liste">'.
"\n";
494 print
'<tr class="liste_titre_filter">';
498 print
'<td class="liste_titre center maxwidthsearch">';
499 $searchpicto = $form->showFilterButtons(
'left');
503 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
504 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_account" value="'.$search_account.
'"></td>';
506 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
507 print
'<td class="liste_titre"><input type="text" class="flat width150" name="search_label" value="'.$search_label.
'"></td>';
509 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
510 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_labelshort" value="'.$search_labelshort.
'"></td>';
512 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
513 print
'<td class="liste_titre">';
514 print $formaccounting->select_account($search_accountparent,
'search_accountparent', 2, array(), 0, 0,
'maxwidth150');
518 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
519 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_pcgtype" value="'.$search_pcgtype.
'"></td>';
522 if (!empty($arrayfields[
'categories'][
'checked'])) {
523 print
'<td class="liste_titre"></td>';
527 $parameters = array(
'arrayfields' => $arrayfields);
528 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
529 print $hookmanager->resPrint;
532 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
533 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_import_key" value="'.$search_import_key.
'"></td>';
536 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
537 print
'<td class="liste_titre"> </td>';
540 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
541 print
'<td class="liste_titre"> </td>';
545 print
'<td class="liste_titre center maxwidthsearch">';
546 $searchpicto = $form->showFilterButtons();
552 $totalarray = array();
553 $totalarray[
'nbfield'] = 0;
557 print
'<tr class="liste_titre">';
560 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
561 $totalarray[
'nbfield']++;
563 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
564 print_liste_field_titre($arrayfields[
'aa.account_number'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_number",
"", $param,
'', $sortfield, $sortorder);
565 $totalarray[
'nbfield']++;
567 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
568 print_liste_field_titre($arrayfields[
'aa.label'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.label",
"", $param,
'', $sortfield, $sortorder);
569 $totalarray[
'nbfield']++;
571 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
572 print_liste_field_titre($arrayfields[
'aa.labelshort'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.labelshort",
"", $param,
'', $sortfield, $sortorder);
573 $totalarray[
'nbfield']++;
575 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
576 print_liste_field_titre($arrayfields[
'aa.account_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_parent",
"", $param,
'', $sortfield, $sortorder,
'left ');
577 $totalarray[
'nbfield']++;
579 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
580 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);
581 $totalarray[
'nbfield']++;
583 if (!empty($arrayfields[
'categories'][
'checked'])) {
584 print_liste_field_titre($arrayfields[
'categories'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'categories'][
'help'], 1);
585 $totalarray[
'nbfield']++;
589 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
590 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
591 print $hookmanager->resPrint;
593 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
594 print_liste_field_titre($arrayfields[
'aa.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.import_key',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'aa.import_key'][
'help'], 1);
595 $totalarray[
'nbfield']++;
598 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
599 print_liste_field_titre($arrayfields[
'aa.reconcilable'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.reconcilable',
'', $param,
'', $sortfield, $sortorder);
600 $totalarray[
'nbfield']++;
603 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
604 print_liste_field_titre($arrayfields[
'aa.active'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.active',
'', $param,
'', $sortfield, $sortorder);
605 $totalarray[
'nbfield']++;
609 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
610 $totalarray[
'nbfield']++;
617 while ($i < min($num, $limit)) {
618 $obj = $db->fetch_object($resql);
620 $accountstatic->id = $obj->rowid;
621 $accountstatic->label = $obj->label;
622 $accountstatic->account_number = $obj->account_number;
624 print
'<tr class="oddeven">';
628 print
'<td class="center nowraponall">';
630 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
634 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
638 if ($massactionbutton || $massaction) {
640 if (in_array($obj->rowid, $arrayofselected)) {
643 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
648 $totalarray[
'nbfield']++;
653 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
655 print $accountstatic->getNomUrl(1, 0, 0,
'', 0, 1, 0,
'accountcard');
658 $totalarray[
'nbfield']++;
663 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
664 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">';
668 $totalarray[
'nbfield']++;
673 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
678 $totalarray[
'nbfield']++;
683 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
686 if (!empty($obj->account_parent) && !empty($obj->rowid2)) {
688 print
'<!-- obj->account_parent = '.$obj->account_parent.
' obj->rowid2 = '.$obj->rowid2.
' -->';
689 $accountparent->id = $obj->rowid2;
690 $accountparent->label = $obj->label2;
691 $accountparent->account_number = $obj->account_number2;
692 print $accountparent->getNomUrl(1);
695 $totalarray[
'nbfield']++;
699 if (!empty($obj->account_parent)) {
700 print
'<!-- Bad value for obj->account_parent = '.$obj->account_parent.
': is a rowid that does not exists -->';
704 $totalarray[
'nbfield']++;
710 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
715 $totalarray[
'nbfield']++;
719 if (!empty($arrayfields[
'categories'][
'checked'])) {
725 $totalarray[
'nbfield']++;
730 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
731 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
732 print $hookmanager->resPrint;
735 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
740 $totalarray[
'nbfield']++;
746 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
747 print
'<td class="center">';
748 if (empty($obj->reconcilable)) {
749 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&mode=1&token='.
newToken().
'">';
750 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
753 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&mode=1&token='.
newToken().
'">';
754 print
img_picto($langs->trans(
"Activated"),
'switch_on');
759 $totalarray[
'nbfield']++;
765 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
766 print
'<td class="center">';
767 if (empty($obj->active)) {
768 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&mode=0&token='.
newToken().
'">';
769 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
772 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&mode=0&token='.
newToken().
'">';
773 print
img_picto($langs->trans(
"Activated"),
'switch_on');
778 $totalarray[
'nbfield']++;
784 print
'<td class="center nowraponall">';
786 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
790 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
794 if ($massactionbutton || $massaction) {
796 if (in_array($obj->rowid, $arrayofselected)) {
799 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
804 $totalarray[
'nbfield']++;
814 foreach ($arrayfields as $key => $val) {
815 if (!empty($val[
'checked'])) {
819 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
824 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
825 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
826 print $hookmanager->resPrint;
828 print
'</table>'.
"\n";
831 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.