From 1d94ee083df4d066006770322730d624a33c2b0d Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 4 Mar 2019 14:11:10 +1300 Subject: [PATCH] dev/core#745 do not filter on 'on_hold' if it is an empty string Although I couldn't replicate this apparently in groups created in an earlier version it could be. We only care about number (0 or 1) or arrays (from the select widget) so add an extra check --- CRM/Contact/BAO/Query.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index e60884b6f1..ed6e960ee9 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1638,8 +1638,15 @@ class CRM_Contact_BAO_Query { } elseif ($id == 'email_on_hold') { if ($onHoldValue = CRM_Utils_Array::value('email_on_hold', $formValues)) { - $onHoldValue = (array) $onHoldValue; - $params[] = array('on_hold', 'IN', $onHoldValue, 0, 0); + // onHoldValue should be 0 or 1 or an array. Some legacy groups may hold '' + // so in 5.11 we have an extra if that should become redundant over time. + // https://lab.civicrm.org/dev/core/issues/745 + // @todo this renaming of email_on_hold to on_hold needs revisiting + // it preceeds recent changes but causes the default not to reload. + if (is_numeric($onHoldValue) || is_array($onHoldValue)) { + $onHoldValue = (array) $onHoldValue; + $params[] = ['on_hold', 'IN', $onHoldValue, 0, 0]; + } } } elseif (substr($id, 0, 7) == 'custom_' -- 2.25.1