diff --git a/CHANGELOG.md b/CHANGELOG.md index dfd8da9f7..784975ed6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog Fab Manager +## v4.2.4 2019 October 30 + +- Fix a bug: in some cases, the invoices were not generated after deploying v4.2.0+. This can occurs if VAT was changed/enabled during the application life (#156) +- [TODO DEPLOY] `rake fablab:maintenance:regenerate_invoices[2019,10]` only if you had download issues with your last invoices + ## v4.2.3 2019 October 22 - Ability to set the default view in project gallery: openLab or local diff --git a/app/services/vat_history_service.rb b/app/services/vat_history_service.rb index 320f62d69..ef8cf60d4 100644 --- a/app/services/vat_history_service.rb +++ b/app/services/vat_history_service.rb @@ -32,9 +32,10 @@ class VatHistoryService chronology.push(start: v.created_at, end: end_date, enabled: v.value == 'true') end_date = v.created_at end + chronology.push(start: DateTime.new(0), end: end_date, enabled: false) date_rates = [] Setting.find_by(name: 'invoice_VAT-rate').history_values.order(created_at: 'ASC').each do |rate| - range = chronology.select { |p| rate.created_at.between?(p[:start], p[:end]) }.first + range = chronology.select { |p| rate.created_at.to_i.between?(p[:start].to_i, p[:end].to_i) }.first date = range[:enabled] ? rate.created_at : range[:end] date_rates.push(date: date, rate: rate.value.to_i) end diff --git a/package.json b/package.json index 506e35655..d410ec13c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "4.2.3", + "version": "4.2.4", "description": "FabManager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.", "keywords": [ "fablab",