Revert "Revert "Export de tous les dossier d'une démarche""
This reverts commit d9a588b52e
.
This commit is contained in:
parent
533fa903bc
commit
f40d96fbd2
32 changed files with 675 additions and 36 deletions
|
@ -1,14 +1,12 @@
|
|||
class ActiveStorage::DownloadableFile
|
||||
def self.create_list_from_dossier(dossier)
|
||||
pjs = PiecesJustificativesService.liste_pieces_justificatives(dossier)
|
||||
files = pjs.map do |piece_justificative|
|
||||
pjs.map do |piece_justificative|
|
||||
[
|
||||
piece_justificative,
|
||||
self.timestamped_filename(piece_justificative)
|
||||
"dossier-#{dossier.id}/#{self.timestamped_filename(piece_justificative)}"
|
||||
]
|
||||
end
|
||||
files << [dossier.pdf_export_for_instructeur, self.timestamped_filename(dossier.pdf_export_for_instructeur)]
|
||||
files
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -22,19 +20,23 @@ class ActiveStorage::DownloadableFile
|
|||
timestamp = attachment.created_at.strftime("%d-%m-%Y-%H-%M")
|
||||
id = attachment.id % 10000
|
||||
|
||||
"#{folder}/#{basename}-#{timestamp}-#{id}#{extension}"
|
||||
[folder, "#{basename}-#{timestamp}-#{id}#{extension}"].join
|
||||
end
|
||||
|
||||
def self.folder(attachment)
|
||||
if attachment.name == 'pdf_export_for_instructeur'
|
||||
return ''
|
||||
end
|
||||
|
||||
case attachment.record_type
|
||||
when 'Dossier'
|
||||
'dossier'
|
||||
'dossier/'
|
||||
when 'DossierOperationLog', 'BillSignature'
|
||||
'horodatage'
|
||||
'horodatage/'
|
||||
when 'Commentaire'
|
||||
'messagerie'
|
||||
'messagerie/'
|
||||
else
|
||||
'pieces_justificatives'
|
||||
'pieces_justificatives/'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue