diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index c59d565e690..6ac97260e61 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -24,6 +24,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 . '/accountancy/class/html.formventilation.class.php'; @@ -44,10 +45,8 @@ $search_pcgtype = GETPOST("search_pcgtype"); $search_pcgsubtype = GETPOST("search_pcgsubtype"); // Security check -if ($user->societe_id > 0) - accessforbidden(); -if (! $user->rights->accounting->chartofaccount) - accessforbidden(); +if ($user->societe_id > 0) accessforbidden(); +if (! $user->rights->accounting->chartofaccount) accessforbidden(); // Load variable for pagination $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; @@ -95,6 +94,20 @@ if (empty($reshook)) $search_pcgsubtype = ""; } + if (GETPOST('change_chart')) + { + $chartofaccounts = GETPOST('chartofaccounts', 'int'); + + if (! empty($chartofaccounts)) { + + if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { + $error ++; + } + } else { + $error ++; + } + } + if ($action == 'disable') { if ($accounting->fetch($id)) { $result = $accounting->account_desactivate($id); @@ -129,6 +142,8 @@ if ($action == 'delete') { $pcgver = $conf->global->CHARTOFACCOUNTS; + + $sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, "; $sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; @@ -183,7 +198,34 @@ if ($result) { print '