diff --git a/app/assets/javascripts/reports/content.js b/app/assets/javascripts/reports/content.js index ec6e45249..8dfe56103 100644 --- a/app/assets/javascripts/reports/content.js +++ b/app/assets/javascripts/reports/content.js @@ -8,12 +8,15 @@ var input = el.siblings('input.hot-table-contents'); var inputObj = JSON.parse(input.attr('value')); var data = inputObj.data; + var headers; + var parentEl; + var order; // Special handling if this is a repository table if (input.hasClass('hot-repository-items')) { - let headers = inputObj.headers; - let parentEl = el.closest('.report-module-repository-element'); - let order = parentEl.attr('data-order') === 'asc'; + headers = inputObj.headers; + parentEl = el.closest('.report-module-repository-element'); + order = parentEl.attr('data-order') === 'asc'; el.handsontable({ disableVisualSelection: true, diff --git a/app/jobs/reports/pdf_job.rb b/app/jobs/reports/pdf_job.rb index aebdb327d..c5dac05f8 100644 --- a/app/jobs/reports/pdf_job.rb +++ b/app/jobs/reports/pdf_job.rb @@ -21,8 +21,12 @@ module Reports report = Report.find(report_id) file = Tempfile.new(['report', '.pdf'], binmode: true) begin - template = Extends::REPORT_TEMPLATES[report.settings[:template]&.to_sym] - template ||= Extends::REPORT_TEMPLATES.values.first + template = + if Extends::REPORT_TEMPLATES.key?(report.settings[:template]&.to_sym) + report.settings[:template] + else + Extends::REPORT_TEMPLATES.keys.first + end raise StandardError, 'Report template not found!' if template.blank?