From b9c90943cdc075013cf63ffd9d554e1da87fbdfe Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 20 Apr 2019 10:56:36 +1000 Subject: [PATCH] dev/core#887 Fix fatal error on pledge search --- CRM/Core/Form/Search.php | 5 +++++ CRM/Grant/BAO/Query.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index cb5839bf87..07b1a85489 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -178,6 +178,11 @@ class CRM_Core_Form_Search extends CRM_Core_Form { */ public static function formRule($fields, $files, $form) { $errors = []; + if (!is_a($form, 'CRM_Core_Form_Search')) { + // So this gets hit with a form object when doing an activity date search from + // advanced search, but a NULL object when doing a pledge search. + return $errors; + } foreach ($form->getSearchFieldMetadata() as $entity => $spec) { foreach ($spec as $fieldName => $fieldSpec) { if ($fieldSpec['type'] === CRM_Utils_Type::T_DATE || $fieldSpec['type'] === (CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME)) { diff --git a/CRM/Grant/BAO/Query.php b/CRM/Grant/BAO/Query.php index 7e2f9d48fa..b76fcfd511 100644 --- a/CRM/Grant/BAO/Query.php +++ b/CRM/Grant/BAO/Query.php @@ -297,7 +297,7 @@ class CRM_Grant_BAO_Query extends CRM_Core_BAO_Query { } /** - * Get the metadata for fields to be included on the activity search form. + * Get the metadata for fields to be included on the grant search form. */ public static function getSearchFieldMetadata() { $fields = [ -- 2.25.1