mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
(bug) unable to build accounting lines if no invoices
This commit is contained in:
parent
c21b45d453
commit
44a167f4c7
@ -1,5 +1,6 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Fix a bug: unable to build accounting lines if no invoices
|
||||
- Fix a security issue: updated json5 to 1.0.2 to fix [CVE-2022-46175](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-46175)
|
||||
|
||||
## v5.6.0 2023 January 5
|
||||
|
@ -12,9 +12,7 @@ namespace :fablab do
|
||||
|
||||
desc 'add missing VAT rate to history'
|
||||
task :add_vat_rate, %i[rate date] => :environment do |_task, args|
|
||||
unless args.rate && args.date
|
||||
raise 'Missing argument. Usage exemple: rails fablab:setup:add_vat_rate[20,2014-01-01]. Use 0 to disable'
|
||||
end
|
||||
raise 'Missing argument. Usage exemple: rails fablab:setup:add_vat_rate[20,2014-01-01]. Use 0 to disable' unless args.rate && args.date
|
||||
|
||||
if args.rate == '0'
|
||||
setting = Setting.find_by(name: 'invoice_VAT-active')
|
||||
@ -129,7 +127,7 @@ namespace :fablab do
|
||||
|
||||
desc 'generate acconting lines'
|
||||
task build_accounting_lines: :environment do
|
||||
start_date = Invoice.order(created_at: :asc).first&.created_at
|
||||
start_date = Invoice.order(created_at: :asc).first&.created_at || DateTime.current
|
||||
end_date = DateTime.current
|
||||
AccountingLine.where(date: start_date..end_date).destroy_all
|
||||
Accounting::AccountingService.new.build(start_date&.beginning_of_day, end_date.end_of_day)
|
||||
|
Loading…
x
Reference in New Issue
Block a user