Merge branch 'staging'
This commit is contained in:
commit
9332ff081a
2 changed files with 14 additions and 12 deletions
|
@ -41,7 +41,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
def download_dossiers_tps
|
def download_dossiers_tps
|
||||||
if procedure = Procedure.find_by(id: params[:procedure_id])
|
if procedure = Procedure.find_by(id: params[:procedure_id])
|
||||||
dossiers = dossiers_list_facade(param_liste).dossiers_to_display
|
dossiers = dossiers_list_facade(param_liste).dossiers_to_display
|
||||||
respond_with Dossier.export_full_generation(dossiers, request.format) if dossiers.empty?
|
respond_with Dossier.export_full_generation(dossiers, request.format) unless dossiers.empty?
|
||||||
else
|
else
|
||||||
dossiers = dossiers_list_facade(param_liste).dossiers_to_display
|
dossiers = dossiers_list_facade(param_liste).dossiers_to_display
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -293,17 +293,19 @@ class Dossier < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.export_full_generation(dossiers, format)
|
def self.export_full_generation(dossiers, format)
|
||||||
data = []
|
if dossiers && !dossiers.empty?
|
||||||
headers = dossiers.first.export_headers
|
data = []
|
||||||
dossiers.each do |dossier|
|
headers = dossiers.first.export_headers
|
||||||
data << dossier.convert_specific_array_values_to_string(dossier.data_with_champs)
|
dossiers.each do |dossier|
|
||||||
end
|
data << dossier.convert_specific_array_values_to_string(dossier.data_with_champs)
|
||||||
if ["csv"].include?(format)
|
end
|
||||||
return SpreadsheetArchitect.to_csv(data: data, headers: headers)
|
if ["csv"].include?(format)
|
||||||
elsif ["xlsx"].include?(format)
|
return SpreadsheetArchitect.to_csv(data: data, headers: headers)
|
||||||
return SpreadsheetArchitect.to_xlsx(data: data, headers: headers)
|
elsif ["xlsx"].include?(format)
|
||||||
elsif ["ods"].include?(format)
|
return SpreadsheetArchitect.to_xlsx(data: data, headers: headers)
|
||||||
return SpreadsheetArchitect.to_ods(data: data, headers: headers)
|
elsif ["ods"].include?(format)
|
||||||
|
return SpreadsheetArchitect.to_ods(data: data, headers: headers)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue