From 65e6b49abb30c14ceb868249fe9dde0443b52e54 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 14 Oct 2018 08:08:55 +0200 Subject: [PATCH 1/5] Remove MAIN_FEATURES_LEVEL > 1 on fiscal year access --- htdocs/core/menus/standard/eldy.lib.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 51a9907a16e..303e2813245 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1019,10 +1019,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 60); // Fiscal year - if ($conf->global->MAIN_FEATURES_LEVEL > 1) // Not yet used. In a future will lock some periods. - { - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); - } + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); // Binding if (! empty($conf->facture->enabled)) From c6163a389b8f8e27b1294017d325bba6a050fe05 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 15 Oct 2018 06:22:28 +0200 Subject: [PATCH 2/5] Revert "Remove MAIN_FEATURES_LEVEL > 1 on fiscal year access" This reverts commit 65e6b49abb30c14ceb868249fe9dde0443b52e54. --- htdocs/core/menus/standard/eldy.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 303e2813245..51a9907a16e 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1019,7 +1019,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 60); // Fiscal year - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); + if ($conf->global->MAIN_FEATURES_LEVEL > 1) // Not yet used. In a future will lock some periods. + { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); + } // Binding if (! empty($conf->facture->enabled)) From c8b9c11a011c82f01afc1ed848a3667bcfb5aaf4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 15 Oct 2018 06:53:48 +0200 Subject: [PATCH 3/5] Fix FEC Missing some subledger label on bookeeping --- .../journal/expensereportsjournal.php | 16 +++++++-------- .../accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 20 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index ef21557932b..520fd004f16 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -1,11 +1,11 @@ - * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2013-2016 Florian Henry +/* Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2007-2010 Jean Heimburger + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -208,7 +208,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code']; - $bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code']; + $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->montant = $mt; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index d8be52cef90..71bdb6a5bd4 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -310,7 +310,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; - $bookkeeping->subledger_label = ''; // TODO To complete + $bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount"); $bookkeeping->montant = $mt; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index b3b354be02d..dcfd11ac67a 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -1,13 +1,13 @@ - * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2014 Raphaël Doursenaud +/* Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2007-2010 Jean Heimburger + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -317,7 +317,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; - $bookkeeping->subledger_label = ''; // TODO To complete + $bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount"); $bookkeeping->montant = $mt; From 3a6824da68b8effacbbbf3a0583d8b7152a4fc01 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 15 Oct 2018 21:50:05 +0200 Subject: [PATCH 4/5] Fix FEC Missing label_compte & label_operation --- htdocs/accountancy/journal/bankjournal.php | 77 ++++++++++++++++------ 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 4e52481b287..f0e6aa8455d 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1,12 +1,12 @@ - * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2018 Alexandre Spangaro - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Olivier Geffroy +/* Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2007-2010 Jean Heimburger + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.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/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; @@ -155,6 +156,8 @@ $accountingjournalstatic->fetch($id_journal); $journal = $accountingjournalstatic->code; $journal_label = $accountingjournalstatic->label; +$accountingaccountstatic = new AccountingAccount($db); + dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -461,7 +464,12 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $langs->trans("Bank"); + + $accountingaccountstatic->fetch('',$k,1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; + + $bookkeeping->label_operation = $reflabel; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0 ? $mt : 0); @@ -517,6 +525,7 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->doc_type = 'bank'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_bank"]; + $bookkeeping->label_operation = $reflabel; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0 ? - $mt : 0); @@ -530,22 +539,34 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch('',$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER,1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch('',$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER,1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else if ($tabtype[$key] == 'payment_expensereport') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch('',$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT,1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else if ($tabtype[$key] == 'payment_salary') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch('',$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT,1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; @@ -555,27 +576,42 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch($k,'',1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else if ($tabtype[$key] == 'payment_donation') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch($k,'',1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else if ($tabtype[$key] == 'payment_loan') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch($k,'',1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else if ($tabtype[$key] == 'payment_various') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch($k,'',1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else if ($tabtype[$key] == 'banktransfert') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch($k,'',1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } else { if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty. { @@ -583,7 +619,10 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE; - $bookkeeping->label_compte = ''; + + $accountingaccountstatic->fetch('',$conf->global->ACCOUNTING_ACCOUNT_SUSPENSE,1); + $accountingaccount_label = $accountingaccountstatic->label; + $bookkeeping->label_compte = $accountingaccount_label; } } $bookkeeping->label_operation = $reflabel; From a971a2afe6432a2c330aa3c70bd2e3f1e9f8d9a5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 16 Oct 2018 06:32:55 +0200 Subject: [PATCH 5/5] Fix FEC --- htdocs/accountancy/journal/bankjournal.php | 58 ++++++++----------- .../journal/expensereportsjournal.php | 13 ++++- .../accountancy/journal/purchasesjournal.php | 29 ++++++---- 3 files changed, 52 insertions(+), 48 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f0e6aa8455d..7b4248630ae 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -150,13 +150,14 @@ $paymentvariousstatic = new PaymentVarious($db); $paymentloanstatic = new PaymentLoan($db); $accountLinestatic=new AccountLine($db); +$accountingaccount = new AccountingAccount($db); + // Get code of finance journal $accountingjournalstatic = new AccountingJournal($db); $accountingjournalstatic->fetch($id_journal); $journal = $accountingjournalstatic->code; $journal_label = $accountingjournalstatic->label; -$accountingaccountstatic = new AccountingAccount($db); dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); $result = $db->query($sql); @@ -465,9 +466,8 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->numero_compte = $k; - $accountingaccountstatic->fetch('',$k,1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch(null, $k, true); + $bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_operation = $reflabel; $bookkeeping->montant = $mt; @@ -540,33 +540,29 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - $accountingaccountstatic->fetch('',$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER,1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); + $bookkeeping->label_compte = $accountingaccount->label; } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; - $accountingaccountstatic->fetch('',$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER,1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); + $bookkeeping->label_compte = $accountingaccount->label; } else if ($tabtype[$key] == 'payment_expensereport') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - $accountingaccountstatic->fetch('',$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT,1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch(null ,$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); + $bookkeeping->label_compte = $accountingaccount->label; } else if ($tabtype[$key] == 'payment_salary') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - $accountingaccountstatic->fetch('',$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT,1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch(null ,$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); + $bookkeeping->label_compte = $accountingaccount->label; } else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; @@ -577,41 +573,36 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $accountingaccountstatic->fetch($k,'',1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; } else if ($tabtype[$key] == 'payment_donation') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $accountingaccountstatic->fetch($k,'',1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; } else if ($tabtype[$key] == 'payment_loan') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $accountingaccountstatic->fetch($k,'',1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; } else if ($tabtype[$key] == 'payment_various') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $accountingaccountstatic->fetch($k,'',1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; } else if ($tabtype[$key] == 'banktransfert') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $accountingaccountstatic->fetch($k,'',1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; } else { if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty. { @@ -620,9 +611,8 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE; - $accountingaccountstatic->fetch('',$conf->global->ACCOUNTING_ACCOUNT_SUSPENSE,1); - $accountingaccount_label = $accountingaccountstatic->label; - $bookkeeping->label_compte = $accountingaccount_label; + $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE, true); + $bookkeeping->label_compte = $accountingaccount->label; } } $bookkeeping->label_operation = $reflabel; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 520fd004f16..6fb8aed5c31 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France @@ -61,6 +61,7 @@ if ($user->societe_id > 0) /* * Actions */ +$accountingaccount = new AccountingAccount($db); // Get informations of journal $accountingjournalstatic = new AccountingJournal($db); @@ -210,6 +211,10 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + + $accountingaccount->fetch(null ,$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); + $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -248,7 +253,6 @@ if ($action == 'writebookkeeping') { foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { // get compte id and label - $accountingaccount = new AccountingAccount($db); if ($accountingaccount->fetch(null, $k, true)) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -260,6 +264,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; + $bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_operation = $accountingaccount->label; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -316,6 +321,10 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; + + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 71bdb6a5bd4..beb9891276f 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -1,11 +1,11 @@ - * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2013-2016 Florian Henry +/* Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2007-2010 Jean Heimburger + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -66,10 +66,7 @@ $parameters=array(); */ $reshook=$hookmanager->executeHooks('doActions',$parameters,$user,$action); // Note that $action and $object may have been modified by some hooks - -/* - * Views - */ +$accountingaccount = new AccountingAccount($db); // Get informations of journal $accountingjournalstatic = new AccountingJournal($db); @@ -312,6 +309,10 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; + + $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); + $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount"); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -352,7 +353,6 @@ if ($action == 'writebookkeeping') { foreach ( $tabht[$key] as $k => $mt ) { //if ($mt) { // get compte id and label - $accountingaccount = new AccountingAccount($db); if ($accountingaccount->fetch(null, $k, true)) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -366,6 +366,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; + $bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -426,6 +427,10 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; + + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:''); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';