diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 9c4536e94c4..5423ae7b41d 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -27,6 +27,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries")); @@ -180,6 +181,7 @@ if (empty($reshook)) */ $form = new Form($db); +$formaccounting = new FormAccounting($db); llxHeader('', $langs->trans("ListAccounts")); @@ -200,7 +202,7 @@ $sql .= " WHERE asy.rowid = ".$pcgver; //print $sql; if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account); if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label); -if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent); +if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2); if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype); if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype); $sql .= $db->order($sortfield, $sortorder); @@ -232,7 +234,7 @@ if ($resql) if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($search_account) $param .= '&search_account='.urlencode($search_account); if ($search_label) $param .= '&search_label='.urlencode($search_label); - if ($search_accountparent) $param .= '&search_accountparent='.urlencode($search_accountparent); + if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent); if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype); if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype); if ($optioncss != '') $param .= '&optioncss='.$optioncss; @@ -316,8 +318,13 @@ if ($resql) print ''; if (!empty($arrayfields['aa.account_number']['checked'])) print ''; if (!empty($arrayfields['aa.label']['checked'])) print ''; - if (!empty($arrayfields['aa.account_parent']['checked'])) print ''; - if (!empty($arrayfields['aa.pcg_type']['checked'])) print ''; + if (!empty($arrayfields['aa.account_parent']['checked'])) { + print ''; + print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2); + //print ''; + print ''; + } + if (!empty($arrayfields['aa.pcg_type']['checked'])) print ''; if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print ''; if (!empty($arrayfields['aa.active']['checked'])) print ' '; print ''; @@ -339,6 +346,7 @@ if ($resql) $accountstatic = new AccountingAccount($db); $accountparent = new AccountingAccount($db); + $totalarray = array(); $i = 0; while ($i < min($num, $limit)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bc69d809e46..921579df947 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6235,7 +6235,7 @@ class Form $out .= '