|
|
@ -55,6 +55,15 @@ class CaseLogValidator < ActiveModel::Validator |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def validate_outstanding_rent_amount(record) |
|
|
|
|
|
|
|
if record.outstanding_rent_or_charges == "Yes" && record.outstanding_amount.blank? |
|
|
|
|
|
|
|
record.errors.add :outstanding_amount, "You must answer the oustanding amout question if you have outstanding rent or charges." |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
if record.outstanding_rent_or_charges == "No" && !record.outstanding_amount.blank? |
|
|
|
|
|
|
|
record.errors.add :outstanding_amount, "You must not answer the oustanding amout question if you don't have outstanding rent or charges." |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def validate(record) |
|
|
|
def validate(record) |
|
|
|
# If we've come from the form UI we only want to validate the specific fields |
|
|
|
# If we've come from the form UI we only want to validate the specific fields |
|
|
|
# that have just been submitted. If we're submitting a log via API or Bulk Upload |
|
|
|
# that have just been submitted. If we're submitting a log via API or Bulk Upload |
|
|
|