This commit is contained in:
Kara Diaby 2023-11-22 17:16:41 +00:00
parent 061da95aaf
commit 2ac9c13c4a
2 changed files with 18 additions and 5 deletions

View file

@ -447,6 +447,9 @@ class Dossier < ApplicationRecord
validates :user, presence: true, if: -> { deleted_user_email_never_send.nil? }, unless: -> { prefilled }
validates :individual, presence: true, if: -> { revision.procedure.for_individual? }
validates :mandataire_first_name, presence: true, if: :for_tiers?
validates :mandataire_last_name, presence: true, if: :for_tiers?
validates :for_tiers, inclusion: { in: [true, false] }, if: -> { revision&.procedure&.for_individual? }
validates_associated :prefilled_champs_public, on: :champs_public_value
@ -1366,6 +1369,10 @@ class Dossier < ApplicationRecord
groupe_instructeur&.contact_information || procedure.service
end
def mandataire_full_name
"#{mandataire_first_name} #{mandataire_last_name}"
end
private
def create_missing_traitemets

View file

@ -1,19 +1,25 @@
class Individual < ApplicationRecord
enum notification_method: {
email: 'email',
no_notification: 'no_notification'
}
belongs_to :dossier, optional: false
validates :dossier_id, uniqueness: true
validates :gender, presence: true, allow_nil: false, on: :update
validates :nom, presence: true, allow_blank: false, allow_nil: false, on: :update
validates :prenom, presence: true, allow_blank: false, allow_nil: false, on: :update
validates :notification_method, presence: true,
inclusion: { in: notification_methods.keys },
if: -> { dossier.for_tiers? },
on: :update
validates :email, presence: true, if: -> { dossier.for_tiers? && self.email? }, on: :update
GENDER_MALE = "M."
GENDER_FEMALE = 'Mme'
enum notification_method: {
email: 'email',
no_notification: 'no_notification'
}
def self.from_france_connect(fc_information)
new(
nom: fc_information.family_name,