Revert "Export de tous les dossier d'une démarche"
This commit is contained in:
parent
4f79c0315d
commit
d9a588b52e
32 changed files with 36 additions and 675 deletions
|
@ -1,12 +1,14 @@
|
|||
class ActiveStorage::DownloadableFile
|
||||
def self.create_list_from_dossier(dossier)
|
||||
pjs = PiecesJustificativesService.liste_pieces_justificatives(dossier)
|
||||
pjs.map do |piece_justificative|
|
||||
files = pjs.map do |piece_justificative|
|
||||
[
|
||||
piece_justificative,
|
||||
"dossier-#{dossier.id}/#{self.timestamped_filename(piece_justificative)}"
|
||||
self.timestamped_filename(piece_justificative)
|
||||
]
|
||||
end
|
||||
files << [dossier.pdf_export_for_instructeur, self.timestamped_filename(dossier.pdf_export_for_instructeur)]
|
||||
files
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -20,23 +22,19 @@ class ActiveStorage::DownloadableFile
|
|||
timestamp = attachment.created_at.strftime("%d-%m-%Y-%H-%M")
|
||||
id = attachment.id % 10000
|
||||
|
||||
[folder, "#{basename}-#{timestamp}-#{id}#{extension}"].join
|
||||
"#{folder}/#{basename}-#{timestamp}-#{id}#{extension}"
|
||||
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