Merge branch 'develop' into staging

This commit is contained in:
Xavier J 2016-10-06 11:45:40 +02:00
commit 074b2d1c16
4 changed files with 22 additions and 2 deletions

View file

@ -48,6 +48,15 @@ class Users::DossiersController < UsersController
@facade = facade @facade = facade
@siret = current_user.siret unless current_user.siret.nil? @siret = current_user.siret unless current_user.siret.nil?
if @facade.procedure.for_individual? && current_user.loged_in_with_france_connect?
individual = @facade.dossier.individual
individual.update_column :gender, @facade.dossier.france_connect_information.gender
individual.update_column :nom, @facade.dossier.france_connect_information.family_name
individual.update_column :prenom, @facade.dossier.france_connect_information.given_name
individual.update_column :birthdate, @facade.dossier.france_connect_information.birthdate.strftime("%d/%m/%Y")
end
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
flash.alert = t('errors.messages.dossier_not_found') flash.alert = t('errors.messages.dossier_not_found')
redirect_to url_for users_dossiers_path redirect_to url_for users_dossiers_path
@ -132,7 +141,7 @@ class Users::DossiersController < UsersController
end end
def update_params def update_params
params.require(:dossier).permit(:id, :autorisation_donnees, individual_attributes: [:nom, :prenom, :birthdate]) params.require(:dossier).permit(:id, :autorisation_donnees, individual_attributes: [:gender, :nom, :prenom, :birthdate])
end end
def checked_autorisation_donnees? def checked_autorisation_donnees?

View file

@ -13,6 +13,11 @@
= f.hidden_field :id = f.hidden_field :id
= f.fields_for :individual, @facade.individual do |ff| = f.fields_for :individual, @facade.individual do |ff|
.form-group
%label
%h4
Civilité
= ff.select :gender, ['Mr', 'Mme']
.form-group .form-group
%label %label
%h4 %h4

View file

@ -0,0 +1,5 @@
class AddGenderInIndividualTable < ActiveRecord::Migration
def change
add_column :individuals, :gender, :string
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161005144657) do ActiveRecord::Schema.define(version: 20161006085422) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -218,6 +218,7 @@ ActiveRecord::Schema.define(version: 20161005144657) do
t.string "prenom" t.string "prenom"
t.string "birthdate" t.string "birthdate"
t.integer "dossier_id" t.integer "dossier_id"
t.string "gender"
end end
create_table "invites", force: :cascade do |t| create_table "invites", force: :cascade do |t|