Skip to content

Commit

Permalink
Report archive widget: Fixed so the boolean options works correctly w…
Browse files Browse the repository at this point in the history
…ith true/false 1/0 values
  • Loading branch information
Alexander committed Apr 25, 2022
1 parent b5f03d0 commit 7c68331
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion api.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function MFN_get_reports_v2($lang, $from_year, $to_year, $offset, $limit, $gener
$entity_id = $ops['entity_id'];
$params = '?mod:tz-location=Europe/Stockholm';

if (isset($genericTitle)) {
if (isset($genericTitle) && $genericTitle) {
$params .= '&mod:generic-title';
}
if (isset($lang) && $lang != 'all') {
Expand Down
22 changes: 11 additions & 11 deletions widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,22 +266,22 @@ public function widget($args, $instance)
return $_GET[$name] ?? $default;
};

$w = [
'showdate' => $instance['showdate'] ?? false,
'showyear' => $instance['showyear'] ?? false,
'showfilter' => $instance['showfilter'] ?? false,
'showthumbnail' => $instance['showthumbnail'] ?? false,
'showgenerictitle' => $instance['showgenerictitle'] ?? false,
'usefiscalyearoffset' => $instance['usefiscalyearoffset'] ?? true,
'fiscalyearoffset' => $instance['fiscalyearoffset'] ?? 0,
'useproxiedattachments' => $instance['useproxiedattachments'] ?? true,
$w = array(
'showdate' => isset($instance['showdate']) && bool_check($instance['showdate']) ?? false,
'showyear' => isset($instance['showyear']) && bool_check($instance['showyear']) ?? false,
'showfilter' => isset($instance['showfilter']) && bool_check($instance['showfilter']) ?? false,
'showthumbnail' => isset($instance['showthumbnail']) && bool_check($instance['showthumbnail']) ?? false,
'showgenerictitle' => isset($instance['showgenerictitle']) && bool_check($instance['showgenerictitle']) ?? false,
'usefiscalyearoffset' => isset($instance['usefiscalyearoffset']) && bool_check($instance['usefiscalyearoffset']) ?? true,
'fiscalyearoffset' => (!empty($instance['fiscalyearoffset'])) ?? 0,
'useproxiedattachments' => isset($instance['useproxiedattachments']) && bool_check($instance['useproxiedattachments']) ?? true,
'fromyear' => $instance['fromyear'] ?? '',
'toyear' => $instance['toyear'] ?? '',
'limit' => (!empty($instance['limit'])) ? $instance['limit'] : 500,
'offset' => (!empty($instance['offset'])) ? $instance['offset'] : 0,
'instance_id' => random_int(1, time()),
'v2api' => $instance['v2api'] ?? false,
];
'v2api' => isset($instance['v2api']) && bool_check($instance['v2api']) ?? false,
);

// force to true, since 'showgenerictitle' depends on 'usefiscalyearoffset' to even show meaningful titles
if ($w['showgenerictitle']) {
Expand Down

0 comments on commit 7c68331

Please sign in to comment.