Skip to content

Commit 142bd18

Browse files
committed
fix: handle checkbox profile fields in category report
1 parent 1e149ed commit 142bd18

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

modules/category-report/category_report.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,17 @@
401401
}
402402

403403
if ($getMode == 'csv') {
404+
// special case for checkbox profile fields
405+
if ($usf_id !== 0 && $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX') {
406+
$content = ($content) ? 'X' : '';
407+
}
404408
$tmp_csv .= $separator . $valueQuotes . $content . $valueQuotes;
405409
} // pdf should show only text and not much html content
406410
elseif ($getMode === 'pdf') {
411+
// special case for checkbox profile fields
412+
if ($usf_id !== 0 && $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX') {
413+
$content = ($content) ? 'X' : '';
414+
}
407415
$columnValues[] = $content;
408416
} else { // create output in html layout for getMode = html or print
409417
if ($usf_id !== 0) { // profile fields
@@ -421,6 +429,8 @@
421429
|| $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'PHONE'
422430
|| $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'URL')) {
423431
$columnValues[] = $content;
432+
} elseif ($getMode === 'xlsx' && $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX') {
433+
$columnValues[] = ($content) ? 'X' : '';
424434
} else {
425435
// checkbox must set a sorting value
426436
if ($gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX') {

themes/simple/templates/modules/category-report.list.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
{foreach $rows as $row}
2121
<tr id="{$row.id}" {if isset($exportMode)}style="{$rowsStyle}"{/if}>
2222
{foreach $row.data as $key => $cell}
23-
<td style="text-align:{$columnAlign[$key]};">{$cell}</td>
23+
<td style="text-align:{$columnAlign[$key]};"{if isset($cell.order)} data-order="{$cell.order}"{/if}>{if isset($cell.value)} {$cell.value} {else} {$cell} {/if}</td>
2424
{/foreach}
2525
</tr>
2626
{/foreach}

0 commit comments

Comments
 (0)