Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-04-11 09:46:19 +02:00
commit 51ca11113a
7 changed files with 9 additions and 8 deletions

View file

@ -14,7 +14,7 @@ class Champs::SiretController < ApplicationController
end
@error = "SIRET invalide"
else
etablissement_attributes = SIRETService.fetch(siret, @champ.dossier.procedure_id)
etablissement_attributes = ApiEntrepriseService.get_etablissement_params_for_siret(siret, @champ.dossier.procedure_id)
if etablissement_attributes.present?
@etablissement = @champ.build_etablissement(etablissement_attributes)
@etablissement.champ = @champ

View file

@ -107,7 +107,7 @@ class Users::DossiersController < UsersController
update_current_user_siret!(siret)
etablissement_attributes = SIRETService.fetch(siret, @facade.dossier.procedure_id, @facade.dossier)
etablissement_attributes = ApiEntrepriseService.get_etablissement_params_for_siret(siret, @facade.dossier.procedure_id, @facade.dossier)
if etablissement_attributes.present?
etablissement_attributes = ActionController::Parameters.new(etablissement_attributes).permit!

View file

@ -1,5 +1,5 @@
module EtablissementHelper
def pretty_currency(capital_social)
number_to_currency(capital_social, delimiter: ' ', unit: '€', format: '%n %u')
number_to_currency(capital_social, locale: :fr)
end
end

View file

@ -2,7 +2,7 @@ class EtablissementUpdateJob < ApplicationJob
queue_as :default
def perform(dossier, siret)
etablissement_attributes = SIRETService.fetch(siret, dossier.procedure_id, dossier)
etablissement_attributes = ApiEntrepriseService.get_etablissement_params_for_siret(siret, dossier.procedure_id, dossier)
if etablissement_attributes.present?
if dossier.entreprise.present?

View file

@ -1,5 +1,5 @@
class SIRETService
def self.fetch(siret, procedure_id, dossier = nil)
class ApiEntrepriseService
def self.get_etablissement_params_for_siret(siret, procedure_id, dossier = nil)
etablissement_params = ApiEntreprise::EtablissementAdapter.new(siret, procedure_id).to_params
entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siret, procedure_id).to_params

View file

@ -58,7 +58,7 @@
= image_tag "icons/super-admin.svg"
Passer en super-admin
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
- if user_signed_in? && nav_bar_profile != :usager
- if user_signed_in? && nav_bar_profile != :user
%li
= link_to users_dossiers_path, class: "menu-item menu-link" do
= image_tag "icons/switch-profile.svg"

View file

@ -3,7 +3,8 @@ namespace :'2018_04_03_attestation_closed_mail_discrepancy' do
Administrateur.includes(:procedures).find_each(batch_size: 10) do |admin|
procedures = admin.procedures.where(archived_at: nil).select { |p| p.closed_mail_template_attestation_inconsistency_state == :missing_tag }
if procedures.any?
Mailers::AttestationClosedMailDiscrepancyMailer.missing_attestation_tag_email(admin, procedures).deliver_later
# Use `deliver_now` because the delayed job cannot find the `Mailers::AttestationClosedMailDiscrepancyMaile` class in production
Mailers::AttestationClosedMailDiscrepancyMailer.missing_attestation_tag_email(admin, procedures).deliver_now!
print "#{admin.email}\n"
end
end