|
|
|
@ -41,22 +41,22 @@ module Validations::DateValidations
|
|
|
|
|
record.errors.add :startdate, I18n.t("validations.date.outside_collection_window") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if FeatureToggle.startdate_two_week_validation_enabled? && (record.startdate > Time.zone.today + 14) |
|
|
|
|
if FeatureToggle.startdate_two_week_validation_enabled? && record.startdate > Time.zone.today + 14 |
|
|
|
|
record.errors.add :startdate, I18n.t("validations.setup.startdate.later_than_14_days_after") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if record.scheme_id.present? |
|
|
|
|
scheme_end_date = record.scheme.end_date |
|
|
|
|
if scheme_end_date.present? && (record.startdate > scheme_end_date) |
|
|
|
|
if scheme_end_date.present? && record.startdate > scheme_end_date |
|
|
|
|
record.errors.add :startdate, I18n.t("validations.setup.startdate.before_scheme_end_date") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if record["voiddate"].present? && (record.startdate < record["voiddate"]) |
|
|
|
|
if record["voiddate"].present? && record.startdate < record["voiddate"] |
|
|
|
|
record.errors.add :startdate, I18n.t("validations.setup.startdate.after_void_date") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if record["mrcdate"].present? && (record.startdate < record["mrcdate"]) |
|
|
|
|
if record["mrcdate"].present? && record.startdate < record["mrcdate"] |
|
|
|
|
record.errors.add :startdate, I18n.t("validations.setup.startdate.after_major_repair_date") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|