1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +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)
previous_file = previous_period&.archive_file
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(
partial: 'archive/accounting',
locals: {
@ -47,7 +47,7 @@ class AccountingPeriod < ActiveRecord::Base
end
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
def archive_closed_data