-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX Accountancy - Blocking on annual closing #30653
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ udo | |
ue | ||
ro | ||
ws | ||
zar | ||
# Code string | ||
ect | ||
tempdate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?php | ||
/* Copyright (C) 2014-2017 Olivier Geffroy <[email protected]> | ||
* Copyright (C) 2015-2022 Alexandre Spangaro <[email protected]> | ||
* Copyright (C) 2015-2020 Florian Henry <[email protected]> | ||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> | ||
/* Copyright (C) 2014-2017 Olivier Geffroy <[email protected]> | ||
* Copyright (C) 2015-2024 Alexandre Spangaro <[email protected]> | ||
* Copyright (C) 2015-2020 Florian Henry <[email protected]> | ||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@free.fr> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -384,6 +384,15 @@ public function create(User $user, $notrigger = false) | |
$this->piece_num = 1; | ||
} | ||
|
||
if (empty($this->label_compte)) { | ||
$accountingaccount = new AccountingAccount($this->db); | ||
$accountingaccount->fetch('', $this->numero_compte); | ||
|
||
dol_syslog(get_class($this).":: fetch label_compte if empty for number =".$accountingaccount->label, LOG_DEBUG); | ||
|
||
$this->label_compte = $accountingaccount->label; | ||
} | ||
|
||
$now = dol_now(); | ||
|
||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; | ||
|
@@ -2692,7 +2701,6 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep | |
|
||
$sql = 'SELECT'; | ||
$sql .= " t.numero_compte,"; | ||
$sql .= " t.label_compte,"; | ||
if ($separate_auxiliary_account) { | ||
$sql .= " t.subledger_account,"; | ||
$sql .= " t.subledger_label,"; | ||
|
@@ -2707,7 +2715,7 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep | |
$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; | ||
$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; | ||
$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; | ||
$sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type'; | ||
$sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; | ||
if ($separate_auxiliary_account) { | ||
$sql .= ' ,t.subledger_account, t.subledger_label'; | ||
} | ||
|
@@ -2732,10 +2740,10 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep | |
$bookkeeping = new BookKeeping($this->db); | ||
$bookkeeping->doc_date = $new_fiscal_period->date_start; | ||
$bookkeeping->date_lim_reglement = ''; | ||
$bookkeeping->doc_ref = $new_fiscal_period->label; | ||
$bookkeeping->doc_ref = $fiscal_period->label; | ||
$bookkeeping->date_creation = $now; | ||
$bookkeeping->doc_type = 'closure'; | ||
$bookkeeping->fk_doc = $new_fiscal_period->id; | ||
$bookkeeping->fk_doc = $fiscal_period->id; | ||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add | ||
$bookkeeping->thirdparty_code = ''; | ||
|
||
|
@@ -2750,7 +2758,7 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep | |
$bookkeeping->numero_compte = $obj->numero_compte; | ||
$bookkeeping->label_compte = $obj->label_compte; | ||
|
||
$bookkeeping->label_operation = $new_fiscal_period->label; | ||
$bookkeeping->label_operation = $fiscal_period->label; | ||
$bookkeeping->montant = $mt; | ||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; | ||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0; | ||
|
@@ -2779,10 +2787,10 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep | |
$bookkeeping = new BookKeeping($this->db); | ||
$bookkeeping->doc_date = $new_fiscal_period->date_start; | ||
$bookkeeping->date_lim_reglement = ''; | ||
$bookkeeping->doc_ref = $new_fiscal_period->label; | ||
$bookkeeping->doc_ref = $fiscal_period->label; | ||
$bookkeeping->date_creation = $now; | ||
$bookkeeping->doc_type = 'closure'; | ||
$bookkeeping->fk_doc = $new_fiscal_period->id; | ||
$bookkeeping->fk_doc = $fiscal_period->id; | ||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add | ||
$bookkeeping->thirdparty_code = ''; | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imagine you have in database
1 line: account = 12345, label = 'A label for the transaction", amount 10
1 line: account = 12345, label = 'A different transaction', amount 15
What do we want after creating the "A nouveau" lines ?
Just 1 line with amount 25 and label = 'A nouveau for closure abc' ?
Can you confirm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that this is exactly what we're aiming for. It's the a-nouveaux principle.
The a-nouveaux entry is similar to a trial balance in reality.
In France, this consists of summarizing all class 1 to 5 accounts (CAPIT to FINAN) in a single account.
And the annual result class 7 - 6 (INCOME - EXPENSE) goes to account 120 or 129.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So PR seems good to me.