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);
213 if (!
dolibarr_set_const($db,
'CHARTOFACCOUNTS', $chartofaccounts,
'chaine', 0,
'', $conf->entity)) {
221 if ($action ==
'disable' ) {
222 if ($accounting->fetch(
$id)) {
224 $result = $accounting->accountDeactivate(
$id, $mode);
231 } elseif ($action ==
'enable' ) {
232 if ($accounting->fetch(
$id)) {
234 $result = $accounting->accountActivate(
$id, $mode);
247$form =
new Form($db);
250$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
252llxHeader(
'', $langs->trans(
"ListAccounts"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy page-admin_account');
254if ($action ==
'delete') {
255 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$id, $langs->trans(
'DeleteAccount'), $langs->trans(
'ConfirmDeleteAccount'),
'confirm_delete',
'', 0, 1);
261$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,";
262$sql .=
" aa.reconcilable, aa.centralized, aa.active, aa.import_key,";
263$sql .=
" a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
266$parameters = array();
267$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
268$sql .= $hookmanager->resPrint;
269$sql = preg_replace(
'/,\s*$/',
'', $sql);
271$sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_account as aa";
272$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int) $conf->entity);
273$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int) $conf->entity);
276$parameters = array();
277$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object);
278$sql .= $hookmanager->resPrint;
280$sql .=
" WHERE asy.rowid = ".((int) $pcgver);
282if (strlen(trim($search_account))) {
283 $lengthpaddingaccount = 0;
287 $search_account_tmp = $search_account;
288 $weremovedsomezero = 0;
289 if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
290 for ($i = 0; $i < $lengthpaddingaccount; $i++) {
291 if (preg_match(
'/0$/', $search_account_tmp)) {
292 $weremovedsomezero++;
293 $search_account_tmp = preg_replace(
'/0$/',
'', $search_account_tmp);
299 if ($search_account_tmp) {
300 if ($weremovedsomezero) {
301 $search_account_tmp_clean = $search_account_tmp;
302 $search_account_clean = $search_account;
304 if (substr($search_account_tmp, 0, 1) ===
'^') {
306 $search_account_tmp_clean = preg_replace(
'/^\^/',
'', $search_account_tmp);
307 $search_account_clean = preg_replace(
'/^\^/',
'', $search_account);
309 $sql .=
" AND (aa.account_number LIKE '".$db->escape($startchar.$search_account_tmp_clean).
"'";
310 $sql .=
" OR aa.account_number LIKE '".$db->escape($startchar.$search_account_clean).
"%')";
316if (strlen(trim($search_label))) {
319if (strlen(trim($search_labelshort))) {
322if (strlen(trim($search_accountparent)) && $search_accountparent !=
'-1') {
323 $sql .=
natural_search(
"aa.account_parent", $search_accountparent, 2);
325if (strlen(trim($search_pcgtype))) {
328if ($search_reconcilable !=
'' && $search_reconcilable !=
'-1') {
329 $sql .=
" AND aa.reconcilable = ".((int) $search_reconcilable);
331if ($search_centralized !=
'' && $search_centralized !=
'-1') {
332 $sql .=
" AND aa.centralized = ".((int) $search_centralized);
334if ($search_active !=
'' && $search_active !=
'-1') {
335 $sql .=
" AND aa.active = ".((int) $search_active);
337if (strlen(trim($search_import_key))) {
342$parameters = array();
343$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
344$sql .= $hookmanager->resPrint;
346$sql .= $db->order($sortfield, $sortorder);
350$nbtotalofrecords =
'';
352 $resql = $db->query($sql);
353 $nbtotalofrecords = $db->num_rows($resql);
354 if (($page * $limit) > (
int) $nbtotalofrecords) {
360$sql .= $db->plimit($limit + 1, $offset);
362dol_syslog(
"accountancy/admin/account.php:: sql=".$sql);
363$resql = $db->query($sql);
366 $num = $db->num_rows($resql);
368 $arrayofselected = is_array($toselect) ? $toselect : array();
372 if ($contextpage != $_SERVER[
"PHP_SELF"]) {
373 $param .=
'&contextpage='.urlencode($contextpage);
375 if ($limit > 0 && $limit != $conf->liste_limit) {
376 $param .=
'&limit='.((int) $limit);
378 if ($search_account) {
379 $param .=
'&search_account='.urlencode($search_account);
382 $param .=
'&search_label='.urlencode($search_label);
384 if ($search_labelshort) {
385 $param .=
'&search_labelshort='.urlencode($search_labelshort);
387 if ($search_accountparent > 0 || $search_accountparent ==
'0') {
388 $param .=
'&search_accountparent='.urlencode($search_accountparent);
390 if ($search_pcgtype) {
391 $param .=
'&search_pcgtype='.urlencode($search_pcgtype);
393 if ($search_import_key) {
394 $param .=
'&search_import_key='.urlencode($search_import_key);
396 if ($optioncss !=
'') {
397 $param .=
'&optioncss='.urlencode($optioncss);
401 $parameters = array();
402 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
403 $param .= $hookmanager->resPrint;
405 if (!empty($conf->use_javascript_ajax)) {
406 print
'<!-- Add javascript to reload page when we click "Change plan" -->
407 <script type="text/javascript">
408 $(document).ready(function () {
409 $("#change_chart").on("click", function (e) {
410 console.log("chartofaccounts selected = "+$("#chartofaccounts").val());
412 window.location.href = "'.$_SERVER[
"PHP_SELF"].
'?valid_change_chart=1&chartofaccounts="+$("#chartofaccounts").val();
419 $arrayofmassactions = array();
421 $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
423 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
424 $arrayofmassactions = array();
427 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
430 $newcardbutton =
dolGetButtonTitle($langs->trans(
'Addanaccount'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/accountancy/admin/card.php?action=create',
'', $permissiontoadd);
433 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
434 if ($optioncss !=
'') {
435 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
437 print
'<input type="hidden" name="token" value="'.newToken().
'">';
438 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
439 print
'<input type="hidden" name="action" value="list">';
440 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
441 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
442 print
'<input type="hidden" name="page" value="'.$page.
'">';
443 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
444 print
'<input type="hidden" name="page_y" value="">';
447 print_barre_liste($langs->trans(
'ListAccounts'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'accounting_account', 0, $newcardbutton,
'', $limit, 0, 0, 1);
449 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
452 print $langs->trans(
"Selectchartofaccounts").
" : ";
453 print
'<select class="flat minwidth200" name="chartofaccounts" id="chartofaccounts">';
454 $sql =
"SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
455 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_system as a";
456 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON a.fk_country = c.rowid AND c.active = 1";
457 $sql .=
" WHERE a.active = 1";
458 $sql .=
" ORDER BY c.code, a.pcg_version";
460 dol_syslog(
"accountancy/admin/account.php sql=".$sql);
462 $resqlchart = $db->query($sql);
464 $numbis = $db->num_rows($resqlchart);
466 print
'<option value="-1"> </option>';
467 while ($i < $numbis) {
468 $obj = $db->fetch_object($resqlchart);
470 $labeltoshow = $obj->country_code.
' - '.$obj->pcg_version.
' - '.$obj->label;
471 $htmltoshow =
picto_from_langcode($obj->country_code).
' '.$obj->country_code.
' - '.$obj->pcg_version.
' <span class="opacitymedium">- '.$obj->label.
'</span>';
473 print ($pcgver == $obj->rowid) ?
' selected' :
'';
474 print
'>'.$labeltoshow.
'</option>';
483 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")).
'">';
487 $parameters = array(
'chartofaccounts' => $chartofaccounts,
'permissiontoadd' => $permissiontoadd,
'permissiontodelete' => $permissiontodelete);
488 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $accounting, $action);
489 print $hookmanager->resPrint;
491 $parameters = array();
492 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
493 print $hookmanager->resPrint;
497 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
498 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
499 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
500 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
514 print
'<div class="div-table-responsive">';
516 print
'<table class="tagtable liste">'.
"\n";
520 print
'<tr class="liste_titre_filter">';
524 print
'<td class="liste_titre center maxwidthsearch">';
525 $searchpicto = $form->showFilterButtons(
'left');
529 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
530 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_account" value="'.$search_account.
'"></td>';
532 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
533 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$search_label.
'"></td>';
535 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
536 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_labelshort" value="'.$search_labelshort.
'"></td>';
538 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
539 print
'<td class="liste_titre">';
540 print $formaccounting->select_account($search_accountparent,
'search_accountparent', 2, array(), 0, 0,
'maxwidth150');
544 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
545 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_pcgtype" value="'.$search_pcgtype.
'"></td>';
548 if (!empty($arrayfields[
'categories'][
'checked'])) {
549 print
'<td class="liste_titre"></td>';
553 $parameters = array(
'arrayfields' => $arrayfields);
554 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
555 print $hookmanager->resPrint;
558 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
559 print
'<td class="liste_titre"><input type="text" class="flat width75" name="search_import_key" value="'.$search_import_key.
'"></td>';
563 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
564 print
'<td class="liste_titre center">';
565 print $form->selectyesno(
'search_reconcilable', $search_reconcilable, 1,
false, 1, 1,
'search_status onrightofpage width75');
570 if (!empty($arrayfields[
'aa.centralized'][
'checked'])) {
571 print
'<td class="liste_titre center">';
572 print $form->selectyesno(
'search_centralized', $search_centralized, 1,
false, 1, 1,
'search_status onrightofpage width75');
577 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
578 print
'<td class="liste_titre center parentonrightofpage">';
579 print $form->selectyesno(
'search_active', $search_active, 1,
false, 1, 1,
'search_status onrightofpage width75');
585 print
'<td class="liste_titre center maxwidthsearch">';
586 $searchpicto = $form->showFilterButtons();
597 print
'<tr class="liste_titre">';
600 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
603 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
604 print_liste_field_titre($arrayfields[
'aa.account_number'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_number",
"", $param,
'', $sortfield, $sortorder);
607 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
608 print_liste_field_titre($arrayfields[
'aa.label'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.label",
"", $param,
'', $sortfield, $sortorder);
611 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
612 print_liste_field_titre($arrayfields[
'aa.labelshort'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.labelshort",
"", $param,
'', $sortfield, $sortorder);
615 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
616 print_liste_field_titre($arrayfields[
'aa.account_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_parent",
"", $param,
'', $sortfield, $sortorder,
'left ');
620 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
621 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);
625 if (!empty($arrayfields[
'categories'][
'checked'])) {
626 print_liste_field_titre($arrayfields[
'categories'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'categories'][
'help'].
'::-1', 1);
631 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
632 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
633 print $hookmanager->resPrint;
635 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
636 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);
639 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
640 print_liste_field_titre($arrayfields[
'aa.reconcilable'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.reconcilable',
'', $param,
'', $sortfield, $sortorder,
'center ');
643 if (!empty($arrayfields[
'aa.centralized'][
'checked'])) {
644 print_liste_field_titre($arrayfields[
'aa.centralized'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.centralized',
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'aa.centralized'][
'help'].
'::-1', 1);
647 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
648 print_liste_field_titre($arrayfields[
'aa.active'][
'label'], $_SERVER[
"PHP_SELF"],
'aa.active',
'', $param,
'', $sortfield, $sortorder,
'center ');
653 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
661 while ($i < min($num, $limit)) {
662 $obj = $db->fetch_object($resql);
664 $accountstatic->id = $obj->rowid;
665 $accountstatic->label = $obj->label;
666 $accountstatic->account_number = $obj->account_number;
668 print
'<tr class="oddeven">';
672 print
'<td class="center nowraponall">';
674 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
678 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param).
'">';
682 if ($massactionbutton || $massaction) {
684 if (in_array($obj->rowid, $arrayofselected)) {
687 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
697 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
699 print $accountstatic->getNomUrl(1, 0, 0,
'', 0, 1, 0,
'accountcard');
707 if (!empty($arrayfields[
'aa.label'][
'checked'])) {
708 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">';
717 if (!empty($arrayfields[
'aa.labelshort'][
'checked'])) {
727 if (!empty($arrayfields[
'aa.account_parent'][
'checked'])) {
730 if (!empty($obj->account_parent) && !empty($obj->rowid2)) {
732 print
'<!-- obj->account_parent = '.$obj->account_parent.
' obj->rowid2 = '.$obj->rowid2.
' -->';
733 $accountparent->id = $obj->rowid2;
734 $accountparent->label = $obj->label2;
735 $accountparent->account_number = $obj->account_number2;
736 print $accountparent->getNomUrl(1);
743 if (!empty($obj->account_parent)) {
744 print
'<!-- Bad value for obj->account_parent = '.$obj->account_parent.
': is a rowid that does not exists -->';
754 if (!empty($arrayfields[
'aa.pcg_type'][
'checked'])) {
763 if (!empty($arrayfields[
'categories'][
'checked'])) {
764 print
'<td class="right">';
774 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
775 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
776 print $hookmanager->resPrint;
779 if (!empty($arrayfields[
'aa.import_key'][
'checked'])) {
789 if (!empty($arrayfields[
'aa.reconcilable'][
'checked'])) {
790 print
'<td class="center">';
791 if (empty($obj->reconcilable)) {
792 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&page='.$page.
'&mode=1&token='.
newToken().
'">';
793 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
796 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&page='.$page.
'&mode=1&token='.
newToken().
'">';
797 print
img_picto($langs->trans(
"Activated"),
'switch_on');
807 if (!empty($arrayfields[
'aa.centralized'][
'checked'])) {
808 print
'<td class="center">';
809 if (empty($obj->centralized)) {
810 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&page='.$page.
'&mode=2&token='.
newToken().
'">';
811 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
814 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&page='.$page.
'&mode=2&token='.
newToken().
'">';
815 print
img_picto($langs->trans(
"Activated"),
'switch_on');
825 if (!empty($arrayfields[
'aa.active'][
'checked'])) {
826 print
'<td class="center">';
827 if (empty($obj->active)) {
828 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=enable&page='.$page.
'&mode=0&token='.
newToken().
'">';
829 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
832 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid.
'&action=disable&page='.$page.
'&mode=0&token='.
newToken().
'">';
833 print
img_picto($langs->trans(
"Activated"),
'switch_on');
844 print
'<td class="center nowraponall">';
846 print
'<a class="editfielda" href="./card.php?action=update&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param.
'&page='.$page).
'">';
850 print
'<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().
'&id='.$obj->rowid.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$param.
'&page='.$page).
'">';
854 if ($massactionbutton || $massaction) {
856 if (in_array($obj->rowid, $arrayofselected)) {
859 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
874 foreach ($arrayfields as $key => $val) {
875 if (!empty($val[
'checked'])) {
879 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
884 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
885 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
886 print $hookmanager->resPrint;
888 print
'</table>'.
"\n";
891 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 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.
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, $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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
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.