mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
print an error if the current invoice does not have a main_item
This commit is contained in:
parent
bb7eec924c
commit
56b254dffc
@ -129,6 +129,11 @@ class Invoice < PaymentDocument
|
|||||||
def prevent_refund?
|
def prevent_refund?
|
||||||
return true if user.nil?
|
return true if user.nil?
|
||||||
|
|
||||||
|
if main_item.nil?
|
||||||
|
Rails.logger.error "Invoice (id: #{id}) does not have a main_item and is probably in error"
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
if main_item.object_type == 'Reservation' && main_item.object&.reservable_type == 'Training'
|
if main_item.object_type == 'Reservation' && main_item.object&.reservable_type == 'Training'
|
||||||
user.trainings.include?(main_item.object.reservable_id)
|
user.trainings.include?(main_item.object.reservable_id)
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user