Merge pull request #3325 from okriuchykhin/ok_SCI_5709_v2

Fix table rendering in PDF reports [SCI-5709]
This commit is contained in:
Miha Mencin 2021-05-17 10:17:07 +02:00 committed by GitHub
commit 65004fa65f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -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,

View file

@ -40,8 +40,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?