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

[bug] unable to sort invoices by date

This is a workaround. The real issue is that some invoices does not have the invoiced_id data for Reservation. This is likely due to the fact that invoices are created and saved before the reservation is saved (so they don't have an ID).

@see app/services/reservations/reserve.rb#34
This commit is contained in:
Sylvain 2021-05-17 12:34:12 +02:00
parent 0992999a32
commit bf2407467b
2 changed files with 3 additions and 1 deletions

View File

@ -17,6 +17,7 @@
- Fix a bug: responsiveness of the "about" page title
Fix a bug: unable to change the slots durations for a new availability
- Fix a bug: some invoices does not have the name of the user
- Fix a bug: unable to sort invoices by date
- Fix a security issue: updated underscore to 1.12.1 to fix [CVE-2021-23358](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23358)
- Fix a security issue: updated lodash to 4.17.21 to fix [CVE-2021-23337](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23337)
- Fix a security issue: updated url-parse to 1.5.1 to fix [CVE-2021-27515](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-27515)

View File

@ -135,7 +135,8 @@ class Invoice < PaymentDocument
def prevent_refund?
return true if user.nil?
if invoiced_type == 'Reservation' && invoiced.reservable_type == 'Training'
# workaround for reservation saved after invoice
if invoiced_type == 'Reservation' && invoiced&.reservable_type == 'Training'
user.trainings.include?(invoiced.reservable_id)
else
false