mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Check if invoice is already cancelled before cancelling
This commit is contained in:
parent
a26ce110b2
commit
41c2e2d5e4
2 changed files with 7 additions and 0 deletions
|
@ -72,6 +72,12 @@ class Invoice < ActiveRecord::Base
|
|||
errors.add(:base, I18n.t('cannot_cancel_paid_invoice'))
|
||||
return false
|
||||
end
|
||||
|
||||
if cancelled?
|
||||
errors.add(:base, I18n.t('cannot_cancel_cancelled_invoice'))
|
||||
return false
|
||||
end
|
||||
|
||||
self.cancelled_at = Time.zone.now
|
||||
save
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue