diff --git a/app/models/press_summary.rb b/app/models/press_summary.rb index dc969eb29..da41e61ff 100644 --- a/app/models/press_summary.rb +++ b/app/models/press_summary.rb @@ -3,11 +3,16 @@ class PressSummary < ApplicationRecord validates :form_answer, :token, presence: true validates :body, presence: true, unless: :contact_details_update? - validates :name, :email, :phone_number, + validates :name, :email, presence: true, unless: proc { |c| c.body_update.present? }, if: :applicant_submitted? + validates :phone_number, + phone: true, + unless: proc { |c| c.body_update.present? }, + if: :applicant_submitted? + validates :title, :last_name, presence: true, unless: proc { |c| c.body_update.present? && form_answer.award_year.year >= 2020 }, diff --git a/config/locales/en.yml b/config/locales/en.yml index b6c30030f..edf92aa3c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -81,6 +81,10 @@ en: attributes: phone_number: invalid: Enter a phone number, like 01635 960 001, 07701 900 982 or +44 808 157 0192 + press_summary: + attributes: + phone_number: + invalid: Enter a phone number, like 01635 960 001, 07701 900 982 or +44 808 157 0192 user: attributes: phone_number: