1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

[bug] various fixes on accouting exports

- accounting exports may ignore some invoices for the first and last days
- file caching for accounring exports is not used
This commit is contained in:
Sylvain 2021-03-22 17:42:54 +01:00
parent 39a7e23881
commit a5b3728f8c
4 changed files with 6 additions and 4 deletions

View File

@ -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`

View File

@ -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

View File

@ -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',

View File

@ -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