Report Filter Statistics don't show filters with value of "0"
Reproduce on dmaster as of today's date:
-
Open a report (e.g. Constituent Summary) and specify a value of "0" for any filter (e.g. Postal Code Suffix :: contains :: "0")
-
Refresh results and observe.
-
Good behavior:
- The filter appears to be used to limit the output of the report (e.g. it shows only contacts having "0" in their Postal Code Suffix)
- Other specified filters (e.g. Is Deceased :: is equal to :: no) display correctly in the Filter Statistics section above report rows.
-
Bad behavior
- The filter with a 0 value is not displayed in the Filter Statistics
Proposed fix:
I believe this patch should fix the problem. Maybe somebody wants to use this as a starting point for a PR:
diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php
index 9793e13..c27e48f 100644
--- a/CRM/Report/Form.php
+++ b/CRM/Report/Form.php
@@ -3510,7 +3510,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
$value = CRM_Utils_Array::value($op, $pair) . " " .
CRM_Utils_Array::value($val, $field['options'], $val);
}
- elseif ($val) {
+ elseif ($val || $val == '0') {
$value = CRM_Utils_Array::value($op, $pair) . " " . $val;
}
}