Skip to content

Commit 2adedfc

Browse files
committed
fix: xlsx exports of dropdowns and radio buttons in category report
1 parent 142bd18 commit 2adedfc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

modules/category-report/category_report.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@
374374
$usf_id = $report->headerData[$key]['id'];
375375

376376
if ($usf_id !== 0
377-
&& in_array($getMode, array('csv', 'pdf'), true)
377+
&& in_array($getMode, array('xlsx', 'csv', 'pdf'), true)
378378
&& $content > 0
379379
&& ($gProfileFields->getPropertyById($usf_id, 'usf_type') == 'DROPDOWN'
380380
|| $gProfileFields->getPropertyById($usf_id, 'usf_type') == 'DROPDOWN_MULTISELECT'
@@ -429,8 +429,16 @@
429429
|| $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'PHONE'
430430
|| $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'URL')) {
431431
$columnValues[] = $content;
432-
} elseif ($getMode === 'xlsx' && $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX') {
433-
$columnValues[] = ($content) ? 'X' : '';
432+
} elseif ($getMode === 'xlsx'
433+
&& ($gProfileFields->getPropertyById($usf_id, 'usf_type') == 'DROPDOWN'
434+
|| $gProfileFields->getPropertyById($usf_id, 'usf_type') == 'DROPDOWN_MULTISELECT'
435+
|| $gProfileFields->getPropertyById($usf_id, 'usf_type') == 'RADIO_BUTTON'
436+
|| $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX')) {
437+
if ($gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX') {
438+
$columnValues[] = ($content) ? 'X' : '';
439+
} else {
440+
$columnValues[] = $content;
441+
}
434442
} else {
435443
// checkbox must set a sorting value
436444
if ($gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX') {

0 commit comments

Comments
 (0)