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

[bug] unable to generate a refund

This commit is contained in:
Sylvain 2019-07-29 12:07:22 +02:00
parent 1be7bda603
commit 0714878bca
4 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,7 @@
# Changelog Fab Manager
- Fix a bug: no user can be created after the last member was deleted
- Fix a bug: unable to generate a refund (Avoir)
- Fix a security issue: updated lodash to 4.17.14 to fix [CVE-2019-10744](https://github.com/lodash/lodash/pull/4336)
- Fix a security issue: updated mini_magick to 4.9.4 to fix [CVE-2019-13574](https://nvd.nist.gov/vuln/detail/CVE-2019-13574)
- Fix some security issues: updated bootstrap to 3.4.1 to fix [CVE-2019-8331](https://nvd.nist.gov/vuln/detail/CVE-2019-8331), [CVE-2019-14041](https://nvd.nist.gov/vuln/detail/CVE-2018-14041), and 3 other low severity CVE

View File

@ -619,8 +619,12 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
// check that at least 1 element of the invoice is refunded
$scope.avoir.invoice_items_ids = [];
for (let itemId in $scope.partial) {
if (Object.prototype.hasOwnProperty.call($scope.partial, itemId)) {
const refundItem = $scope.partial[itemId];
if (refundItem) { $scope.avoir.invoice_items_ids.push(parseInt(itemId)); }
if (refundItem) {
$scope.avoir.invoice_items_ids.push(parseInt(itemId));
}
}
}
if ($scope.avoir.invoice_items_ids.length === 0) {

View File

@ -10,7 +10,7 @@ class InvoicesService
# @param filters {Hash} allowed filters: number, customer, date.
def self.list(order_key, direction, page, size, filters = {})
invoices = Invoice.includes(:avoir, :invoicing_profile, invoice_items: %i[subscription invoice_item])
.joins(:invoicing_profile)
.joins('invoicing_profile')
.order("#{order_key} #{direction}")
.page(page)
.per(size)

View File

@ -1,4 +1,7 @@
json.extract! @invoice, :id, :created_at, :reference, :invoiced_type, :user_id, :avoir_date, :description
# frozen_string_literal: true
json.extract! @invoice, :id, :created_at, :reference, :invoiced_type, :avoir_date, :description
json.user_id @invoice.invoicing_profile&.user_id
json.total (@invoice.total / 100.00)
json.name @invoice.user.profile.full_name
json.has_avoir @invoice.refunded?