fix(prefill): allow private annotations prefill
This commit is contained in:
parent
01653440e7
commit
c1afc985e4
5 changed files with 24 additions and 17 deletions
|
@ -3,13 +3,17 @@
|
|||
module DossierPrefillableConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def prefill!(champs_public_attributes)
|
||||
return unless champs_public_attributes.any?
|
||||
def prefill!(champs_attributes)
|
||||
return unless champs_attributes.any?
|
||||
|
||||
attr = { prefilled: true }
|
||||
attr[:champs_public_all_attributes] = champs_public_attributes.map { |h| h.merge(prefilled: true) }
|
||||
attributes = { prefilled: true }
|
||||
attributes[:champs_attributes] = champs_attributes.map { |h| h.merge(prefilled: true) }
|
||||
|
||||
assign_attributes(attr)
|
||||
assign_attributes(attributes)
|
||||
save(validate: false)
|
||||
end
|
||||
|
||||
def find_champs_by_stable_ids(stable_ids)
|
||||
champs.joins(:type_de_champ).where(types_de_champ: { stable_id: stable_ids.compact.uniq })
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1229,12 +1229,6 @@ class Dossier < ApplicationRecord
|
|||
termine_expired_to_delete.find_each(&:purge_discarded)
|
||||
end
|
||||
|
||||
def find_champs_by_stable_ids(stable_ids)
|
||||
return [] if stable_ids.compact.empty?
|
||||
|
||||
champs.joins(:type_de_champ).where(types_de_champ: { stable_id: stable_ids })
|
||||
end
|
||||
|
||||
def skip_user_notification_email?
|
||||
return true if brouillon? && procedure.declarative?
|
||||
return true if for_procedure_preview?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue