dev/core#887 Fix fatal error on pledge search
authoreileen <emcnaughton@wikimedia.org>
Sat, 20 Apr 2019 00:56:36 +0000 (10:56 +1000)
committereileen <emcnaughton@wikimedia.org>
Sat, 20 Apr 2019 00:57:27 +0000 (10:57 +1000)
CRM/Core/Form/Search.php
CRM/Grant/BAO/Query.php

index cb5839bf877e39b010002ff1b51689b343bf8e0a..07b1a85489672ce9d60e2d58234af08a42b48a41 100644 (file)
@@ -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)) {
index 7e2f9d48fa05f88f41d1574300c1e45e5b7c190b..b76fcfd5118e728e677894735017b73ea92268de 100644 (file)
@@ -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 = [