1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-06 01:08:21 +01:00

fix last archive infos in closed accounting period

This commit is contained in:
Sylvain 2019-02-12 16:19:11 +01:00
parent 2ba3890325
commit 9f4d026f30

View File

@ -31,7 +31,7 @@ class AccountingPeriod < ActiveRecord::Base
def to_json_archive(invoices) def to_json_archive(invoices)
previous_file = previous_period&.archive_file previous_file = previous_period&.archive_file
code_checksum = Checksum.code code_checksum = Checksum.code
last_archive_checksum = Checksum.file(previous_file) last_archive_checksum = previous_file ? Checksum.file(previous_file) : nil
ApplicationController.new.view_context.render( ApplicationController.new.view_context.render(
partial: 'archive/accounting', partial: 'archive/accounting',
locals: { locals: {
@ -47,7 +47,7 @@ class AccountingPeriod < ActiveRecord::Base
end end
def previous_period def previous_period
AccountingPeriod.order(closed_at: :desc).limit(2).last AccountingPeriod.where('closed_at < ?', closed_at).order(closed_at: :desc).limit(1).last
end end
def archive_closed_data def archive_closed_data