@ -274,6 +274,7 @@ class BulkUpload::Sales::Year2022::RowParser
validates :field_114 , presence : { message : I18n . t ( " validations.not_answered " , question : " company buyer " ) } , if : :outright_sale? , on : :after_log
validates :field_114 , presence : { message : I18n . t ( " validations.not_answered " , question : " company buyer " ) } , if : :outright_sale? , on : :after_log
validates :field_109 , presence : { message : I18n . t ( " validations.not_answered " , question : " more than 2 buyers " ) } , if : :joint_purchase? , on : :after_log
validates :field_109 , presence : { message : I18n . t ( " validations.not_answered " , question : " more than 2 buyers " ) } , if : :joint_purchase? , on : :after_log
validate :validate_buyer1_economic_status , on : :before_log
validate :validate_nulls , on : :after_log
validate :validate_nulls , on : :after_log
validate :validate_valid_radio_option , on : :before_log
validate :validate_valid_radio_option , on : :before_log
@ -812,7 +813,7 @@ private
end
end
def owning_organisation
def owning_organisation
Organisation . find_by_id_on_multiple_fields ( field_92 )
@owning_organisation || = Organisation . find_by_id_on_multiple_fields ( field_92 )
end
end
def created_by
def created_by
@ -946,7 +947,7 @@ private
end
end
else
else
fields . each do | field |
fields . each do | field |
unless errors . any ? { | e | fields . include? ( e . attribute ) }
if errors . none ? { | e | fields . include? ( e . attribute ) }
errors . add ( field , I18n . t ( " validations.not_answered " , question : question . check_answer_label & . downcase ) )
errors . add ( field , I18n . t ( " validations.not_answered " , question : question . check_answer_label & . downcase ) )
end
end
end
end
@ -971,7 +972,7 @@ private
end
end
else
else
fields . each do | field |
fields . each do | field |
unless errors . any ? { | e | fields . include? ( e . attribute ) }
if errors . none ? { | e | fields . include? ( e . attribute ) }
errors . add ( field , I18n . t ( " validations.invalid_option " , question : QUESTIONS [ field ] ) )
errors . add ( field , I18n . t ( " validations.invalid_option " , question : QUESTIONS [ field ] ) )
end
end
end
end
@ -1021,4 +1022,10 @@ private
errors . add ( :field_1 , error_message ) # Purchaser code
errors . add ( :field_1 , error_message ) # Purchaser code
end
end
end
end
def validate_buyer1_economic_status
if field_24 == 9
errors . add ( :field_24 , " Buyer 1 cannot be a child under 16 " )
end
end
end
end