diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dee75bf6..5e5dab41e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ - Fix a bug: subscriptions tab is selected by default in statistics, even if the module is disabled - Fix a bug: select all plans for slot restriction (through the dedicated button) also selects the disabled plans - Fix a bug: recurring availabilities are not restricted to subscribers +- Fix a bug: accounting exports may ignore some invoices for the first and last days +- Fix a bug: accounting export caching is not working - Fix a security issue: updated elliptic to 6.5.4 to fix [CVE-2020-28498](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-28498) - [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/nginx-packs-directive.sh | bash` - [TODO DEPLOY] `rails db:seed` diff --git a/app/controllers/api/accounting_exports_controller.rb b/app/controllers/api/accounting_exports_controller.rb index 24d15492a..20dd342dd 100644 --- a/app/controllers/api/accounting_exports_controller.rb +++ b/app/controllers/api/accounting_exports_controller.rb @@ -8,7 +8,7 @@ class API::AccountingExportsController < API::ApiController def export authorize :accounting_export - export = Export.where(category: 'accounting', export_type: 'accounting-software', key: params[:key]) + export = Export.where(category: 'accounting', export_type: params[:type], key: params[:key]) .where(extension: params[:extension], query: params[:query]) .where('created_at > ?', Invoice.maximum('updated_at')) .last diff --git a/app/frontend/src/javascript/controllers/admin/invoices.js b/app/frontend/src/javascript/controllers/admin/invoices.js index 168e42089..31a0a240a 100644 --- a/app/frontend/src/javascript/controllers/admin/invoices.js +++ b/app/frontend/src/javascript/controllers/admin/invoices.js @@ -1309,8 +1309,8 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope', columns: $scope.exportTarget.settings.columns, encoding: $scope.exportTarget.settings.encoding, date_format: $scope.exportTarget.settings.dateFormat, - start_date: $scope.exportTarget.startDate, - end_date: $scope.exportTarget.endDate, + start_date: moment.utc($scope.exportTarget.startDate).startOf('day').toISOString(), + end_date: moment.utc($scope.exportTarget.endDate).endOf('day').toISOString(), label_max_length: $scope.exportTarget.settings.labelMaxLength, decimal_separator: $scope.exportTarget.settings.decimalSeparator, export_invoices_at_zero: $scope.exportTarget.settings.exportInvoicesAtZero @@ -1370,7 +1370,6 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib $scope.publicKeyStatus = false; return; } - const today = new Date(); $http({ method: 'POST', url: 'https://api.stripe.com/v1/tokens', diff --git a/app/services/accounting_export_service.rb b/app/services/accounting_export_service.rb index f3986f75a..c86797b1a 100644 --- a/app/services/accounting_export_service.rb +++ b/app/services/accounting_export_service.rb @@ -33,6 +33,7 @@ class AccountingExportService invoices = Invoice.where('created_at >= ? AND created_at <= ?', start_date, end_date).order('created_at ASC') invoices = invoices.where('total > 0') unless export_zeros invoices.each do |i| + puts "processing invoice #{i.id}..." content << generate_rows(i) end