From ff1e8db4c6b4720487520cb178b66d6472661711 Mon Sep 17 00:00:00 2001 From: taitus Date: Thu, 25 Apr 2019 17:04:55 +0200 Subject: [PATCH] Update Residence validation - Update residence_valid? method to don't check :year_of_birth when :date_of_birth is present. - Remove unused 'census_year_of_birth' method. --- app/models/officing/residence.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/officing/residence.rb b/app/models/officing/residence.rb index 94261e4e9..9f5b56cc0 100644 --- a/app/models/officing/residence.rb +++ b/app/models/officing/residence.rb @@ -117,12 +117,12 @@ class Officing::Residence end def residency_valid? - @census_api_response.valid? && - @census_api_response.date_of_birth.year.to_s == year_of_birth.to_s + @census_api_response.valid? && valid_year_of_birth? end - def census_year_of_birth - @census_api_response.date_of_birth.year + def valid_year_of_birth? + return true if Setting.force_presence_date_of_birth? + @census_api_response.date_of_birth.year.to_s == year_of_birth.to_s end def clean_document_number