feat(dossier): allow to rebase champs with value made mandatory
This commit is contained in:
parent
5a7ddd52d2
commit
4c516a6991
2 changed files with 16 additions and 1 deletions
|
@ -43,7 +43,7 @@ module DossierRebaseConcern
|
|||
when :drop_down_other
|
||||
!change[:from] && change[:to]
|
||||
when :mandatory
|
||||
change[:from] && !change[:to]
|
||||
(change[:from] && !change[:to]) || can_change_mandatory?(change)
|
||||
when :type_champ, :condition
|
||||
false
|
||||
else
|
||||
|
@ -160,4 +160,8 @@ module DossierRebaseConcern
|
|||
def purge_piece_justificative_file(champ)
|
||||
ActiveStorage::Attachment.where(id: champ.piece_justificative_file.ids).delete_all
|
||||
end
|
||||
|
||||
def can_change_mandatory?(change)
|
||||
!champs.filter { _1.stable_id == change[:stable_id] }.any?(&:blank?)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue