From 8f3a254259bba32baf0ec532ad5eb62d0bad2a0d Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 22 Apr 2016 06:31:40 +0200 Subject: [PATCH 1/4] FIX: Bug with category functionnality --- htdocs/core/class/html.formaccounting.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 9f75316ed14..04d643d4b2f 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -67,7 +67,7 @@ class FormAccounting $sql = "SELECT c.rowid, c.label as type, c.range_account"; $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql.= " WHERE c.active = 1"; - $sql.= " AND c.account_type = 0"; + $sql.= " AND c.category_type = 0"; $sql.= " AND c.fk_country = ".$mysoc->country_id; $sql.= " ORDER BY c.label ASC"; } From 4a078db060f670eac705d710e4962e5014ad0178 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 22 Apr 2016 06:57:37 +0200 Subject: [PATCH 2/4] FIX: Migration script --- htdocs/install/mysql/migration/3.9.0-4.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 7ce46730aa9..f793a6b471a 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -365,7 +365,7 @@ CREATE TABLE llx_c_accounting_category ( ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code); UPDATE llx_accounting_account SET account_parent = '0' WHERE account_parent = ''; -ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer; +ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0; DROP INDEX uk_bordereau_cheque ON llx_bordereau_cheque; From 24fddaa0390babe9fd04c5779adc8f33ef868c10 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 22 Apr 2016 06:58:18 +0200 Subject: [PATCH 3/4] Hidden old functions --- htdocs/accountancy/admin/account.php | 4 ++-- htdocs/accountancy/admin/export.php | 6 ++++-- htdocs/accountancy/bookkeeping/list.php | 10 +++++----- htdocs/core/modules/modAccounting.class.php | 8 ++++++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 70f191f3679..623cb44cb28 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -145,8 +145,8 @@ if ($result) { print '
'; print '' . $langs->trans("Addanaccount") . ''; - print '' . $langs->trans("ImportAccount") . ''; - print '' . $langs->trans("CheckProductAccountancyCode") . ''; + // print '' . $langs->trans("ImportAccount") . ''; + // print '' . $langs->trans("CheckProductAccountancyCode") . ''; print '

'; print ''; diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 7b4ca7f91ce..14d91d85581 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -50,12 +50,14 @@ $main_option = array ( $model_option = array ( 'ACCOUNTING_EXPORT_SEPARATORCSV', - 'ACCOUNTING_EXPORT_DATE', + 'ACCOUNTING_EXPORT_DATE' + /* 'ACCOUNTING_EXPORT_PIECE', 'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT', 'ACCOUNTING_EXPORT_LABEL', 'ACCOUNTING_EXPORT_AMOUNT', - 'ACCOUNTING_EXPORT_DEVISE' + 'ACCOUNTING_EXPORT_DEVISE' + */ ); /* diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 5d3dcd737a8..f287c0ad9dd 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -385,7 +385,7 @@ else { print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; @@ -396,7 +396,7 @@ else { print $langs->trans('From') . ': '; print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print '
'; - print $langs->trans('To') . ': '; + print $langs->trans('to') . ': '; print $form->select_date($search_date_end, 'date_end', 0, 0, 1); print ''; print ''; @@ -404,14 +404,14 @@ else { print $langs->trans('From'); print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); print '
'; - print $langs->trans('To'); + print $langs->trans('to'); print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print ''; print ''; @@ -450,7 +450,7 @@ else { print ''; print ''; print ''; - print ''; + print ''; print '
'; print $langs->trans('From'); print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); print '
'; - print $langs->trans('To'); + print $langs->trans('to'); print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print '
' . $line->label_compte . '' . price($line->debit) . '' . price($line->credit) . '' . $line->code_journal . '' . $line->code_journal . ''; print '' . img_edit() . ' '; print '' . img_delete() . ''; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index e2c50c23d53..04fccce1285 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2014 Florian Henry * @@ -20,7 +20,7 @@ /** * \file htdocs/core/modules/modAccounting.class.php - * \ingroup Accounting Expert + * \ingroup Advanced accountancy * \brief Module to activate Accounting Expert module */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; @@ -157,16 +157,19 @@ class modAccounting extends DolibarrModules "yesno", "1" ); + /* $this->const[15] = array ( "ACCOUNTING_GROUPBYACCOUNT", "yesno", "1" ); + */ $this->const[16] = array ( "ACCOUNTING_EXPORT_DATE", "chaine", "%d%m%Y" ); + /* $this->const[17] = array ( "ACCOUNTING_EXPORT_PIECE", "yesno", @@ -192,6 +195,7 @@ class modAccounting extends DolibarrModules "yesno", "1" ); + */ $this->const[22] = array( "ACCOUNTING_EXPENSEREPORT_JOURNAL", "chaine", From df91a95b9be5a1cd251490f0b8f616d1fbac81dd Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 22 Apr 2016 07:05:24 +0200 Subject: [PATCH 4/4] FIX: Add right to manage chart of accounts for non-admin --- htdocs/accountancy/admin/account.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 623cb44cb28..94ce450ff30 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -43,7 +43,9 @@ $search_pcgtype = GETPOST("search_pcgtype"); $search_pcgsubtype = GETPOST("search_pcgsubtype"); // Security check -if (! $user->admin) +if ($user->societe_id > 0) + accessforbidden(); +if (! $user->rights->accounting->chartofaccount) accessforbidden(); $sortfield = GETPOST("sortfield", 'alpha');