correctif(export.pdf): ETQ expert, lorsque j'exporte un dossier au format PDF, celui ci contenient les avis non confidentiels ainsi que mes avis
This commit is contained in:
parent
4f9c45c489
commit
c6e9674de2
5 changed files with 16 additions and 9 deletions
|
@ -147,7 +147,7 @@ module Experts
|
||||||
end
|
end
|
||||||
|
|
||||||
def telecharger_pjs
|
def telecharger_pjs
|
||||||
files = ActiveStorage::DownloadableFile.create_list_from_dossiers(Dossier.where(id: @dossier.id))
|
files = ActiveStorage::DownloadableFile.create_list_from_dossiers(Dossier.where(id: @dossier.id), include_avis_for_expert: current_expert)
|
||||||
cleaned_files = ActiveStorage::DownloadableFile.cleanup_list_from_dossier(files)
|
cleaned_files = ActiveStorage::DownloadableFile.cleanup_list_from_dossier(files)
|
||||||
|
|
||||||
zipline(cleaned_files, "dossier-#{@dossier.id}.zip")
|
zipline(cleaned_files, "dossier-#{@dossier.id}.zip")
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
class ActiveStorage::DownloadableFile
|
class ActiveStorage::DownloadableFile
|
||||||
def self.create_list_from_dossiers(dossiers, with_bills: false, with_champs_private: false, include_infos_administration: false)
|
def self.create_list_from_dossiers(
|
||||||
PiecesJustificativesService.generate_dossier_export(dossiers, include_infos_administration:) +
|
dossiers,
|
||||||
|
with_bills: false,
|
||||||
|
with_champs_private: false,
|
||||||
|
include_infos_administration: false,
|
||||||
|
include_avis_for_expert: false
|
||||||
|
)
|
||||||
|
PiecesJustificativesService.generate_dossier_export(dossiers, include_infos_administration:, include_avis_for_expert:) +
|
||||||
PiecesJustificativesService.liste_documents(dossiers, with_bills:, with_champs_private:)
|
PiecesJustificativesService.liste_documents(dossiers, with_bills:, with_champs_private:)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class PiecesJustificativesService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.generate_dossier_export(dossiers, include_infos_administration: false)
|
def self.generate_dossier_export(dossiers, include_infos_administration: false, include_avis_for_expert: false)
|
||||||
return [] if dossiers.empty?
|
return [] if dossiers.empty?
|
||||||
|
|
||||||
pdfs = []
|
pdfs = []
|
||||||
|
@ -98,6 +98,7 @@ class PiecesJustificativesService
|
||||||
.render(template: 'dossiers/show', formats: [:pdf],
|
.render(template: 'dossiers/show', formats: [:pdf],
|
||||||
assigns: {
|
assigns: {
|
||||||
include_infos_administration:,
|
include_infos_administration:,
|
||||||
|
include_avis_for_expert:,
|
||||||
dossier: dossier
|
dossier: dossier
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -873,7 +873,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(PiecesJustificativesService).to receive(:generate_dossier_export).with([dossier], include_infos_administration: true).and_call_original
|
allow(PiecesJustificativesService).to receive(:generate_dossier_export).with([dossier], include_infos_administration: true, include_avis_for_expert: false).and_call_original
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'includes an attachment' do
|
it 'includes an attachment' do
|
||||||
|
|
Loading…
Reference in a new issue