Merge pull request #10420 from mfo/US/fix-for-tiers

ETQ usager, je ne peux pas mettre mon dossier dans un etat invalide en essayant le bouton deposer pour un mandataire sans remplir les autres champs du mandataire
This commit is contained in:
mfo 2024-05-15 13:04:21 +00:00 committed by GitHub
commit 6e71a20257
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View file

@ -1,4 +1,5 @@
= form_for @dossier, url: update_identite_dossier_path(@dossier), html: { id: 'identite-form', class: "form", "data-controller" => "for-tiers" } do |f|
= f.hidden_field :for_tiers
- if for_tiers?
.fr-alert.fr-alert--info.fr-mb-2w
%p.fr-notice__text

View file

@ -139,7 +139,7 @@ module Users
respond_to do |format|
format.html
format.turbo_stream do
@dossier.update_columns(params.require(:dossier).permit(:for_tiers).to_h)
@dossier.for_tiers = params[:dossier][:for_tiers]
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
module Maintenance
class BackfillInvalidDossiersForTiersTask < MaintenanceTasks::Task
def collection
Dossier.where(for_tiers: true).where(mandataire_first_name: nil)
end
def process(element)
element.update_column(for_tiers: false)
end
end
end