1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

adds a rake task to regenerate invoices by ids (see maintenance.rake)

This commit is contained in:
Nicolas Florentin 2023-11-02 13:49:54 +01:00
parent b70d095e37
commit 7e2b4593f5
2 changed files with 10 additions and 0 deletions

View File

@ -9,6 +9,7 @@
- decreases sidekiq concurrency from 25 to 5, 25 is too much and consumes memory for nothing
- do not log Notifications#polling action anymore, by default, can be enable via env variable ENABLE_NOTIFICATIONS_POLLING_LOGGING=true
- Fix a bug: api/products/index bug when sorting by amount
- adds a rake task to regenerate invoices by ids (see maintenance.rake)
## v6.2.0 2023 October 13

View File

@ -14,6 +14,15 @@ namespace :fablab do
puts '-> Done'
end
desc 'Regenerate the invoices (invoices & avoirs) PDF by ids'
# example: rails fablab:maintenance:regenerate_invoices_by_ids[1,2,3,4]
task regenerate_invoices_by_ids: :environment do |_task, args|
puts "-> Start regenerate the invoices PDF"
invoices = Invoice.where(id: args.extras)
invoices.each(&:regenerate_invoice_pdf)
puts '-> Done'
end
task :regenerate_schedules, %i[year month end] => :environment do |_task, args|
start_date, end_date = dates_from_args(args)
puts "-> Start regenerate the payment schedules PDF between #{I18n.l start_date, format: :long} and " \