diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index c7681c6f9ca..1b83d5eb03f 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -47,6 +47,8 @@ $search_accountparent = GETPOST('search_accountparent', 'alpha'); $search_pcgtype = GETPOST('search_pcgtype', 'alpha'); $search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha'); +$chartofaccounts = GETPOST('chartofaccounts', 'int'); + // Security check if ($user->socid > 0) accessforbidden(); if (!$user->rights->accounting->chartofaccount) accessforbidden(); @@ -104,11 +106,9 @@ if (empty($reshook)) $search_pcgsubtype = ""; $search_array_options = array(); } - - if (GETPOST('change_chart', 'alpha') && (GETPOST('valid_change_chart', 'int') || empty($conf->use_javascript_ajax))) + if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on + || (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) // a submit of form is done and chartofaccounts combo has been modified { - $chartofaccounts = GETPOST('chartofaccounts', 'int'); - if ($chartofaccounts > 0) { // Get language code for this $chartofaccounts @@ -279,21 +279,13 @@ if ($resql) if (!empty($conf->use_javascript_ajax)) { - print ' + print ' '; @@ -340,8 +332,7 @@ if ($resql) else dol_print_error($db); print ""; print ajax_combobox("chartofaccounts"); - print ''; - print ''; + print ''; print '
'; print '
';