Merge in 5.20
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 29 Nov 2019 08:33:26 +0000 (19:33 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 29 Nov 2019 08:33:26 +0000 (19:33 +1100)
1  2 
CRM/Contact/Form/Search.php
CRM/Event/Form/Search.php

index 6b3978bb86909b4c31a58579be139fabd52711a1,f62137c658d70b35bb0689802fa139c7d1dd7821..647bf880d34654694f360281cfd13720173ef253
@@@ -896,16 -925,11 +909,17 @@@ class CRM_Contact_Form_Search extends C
     * @throws \CiviCRM_API3_Exception
     */
    protected function loadMetadata() {
-     // @todo - check what happens if the person does not have 'access civicontribute' - make sure they
      // can't by pass acls by passing search criteria in the url.
-     $this->addSearchFieldMetadata(['Contribution' => CRM_Contribute_BAO_Query::getSearchFieldMetadata()]);
-     $this->addSearchFieldMetadata(['ContributionRecur' => CRM_Contribute_BAO_ContributionRecur::getContributionRecurSearchFieldMetadata()]);
+     if (self::checkComponentAccess('CiviContribute')) {
+       $this->addSearchFieldMetadata(['Contribution' => CRM_Contribute_BAO_Query::getSearchFieldMetadata()]);
+       $this->addSearchFieldMetadata(['ContributionRecur' => CRM_Contribute_BAO_ContributionRecur::getContributionRecurSearchFieldMetadata()]);
+     }
 +    $this->addSearchFieldMetadata(['Participant' => CRM_Event_BAO_Query::getSearchFieldMetadata()]);
 +    $this->addSearchFieldMetadata(['Membership' => CRM_Member_BAO_Query::getSearchFieldMetadata()]);
 +    $this->addSearchFieldMetadata(['Pledge' => CRM_Pledge_BAO_Query::getSearchFieldMetadata()]);
 +    $this->addSearchFieldMetadata(['PledgePayment' => CRM_Pledge_BAO_Query::getPledgePaymentSearchFieldMetadata()]);
 +    $this->addSearchFieldMetadata(['Grant' => CRM_Grant_BAO_Query::getSearchFieldMetadata()]);
 +    $this->addSearchFieldMetadata(['Case' => CRM_Case_BAO_Query::getSearchFieldMetadata()]);
    }
  
  }
index 10a05187f65e5ca6cc87292450497d42671af6e7,abf22b7a25c58d2947ba87a6bb23d9cea581e4f6..5c6a314c46850d16cd0ef2d328903e200ef2183d
@@@ -448,13 -496,16 +448,25 @@@ class CRM_Event_Form_Search extends CRM
      return ts('Find Participants');
    }
  
 +  /**
 +   * Set the metadata for the form.
 +   *
 +   * @throws \CiviCRM_API3_Exception
 +   */
 +  protected function setSearchMetadata() {
 +    $this->addSearchFieldMetadata(['Participant' => CRM_Event_BAO_Query::getSearchFieldMetadata()]);
 +  }
 +
+   /**
+    * Set the default form values.
+    *
+    *
+    * @return array
+    *   the default array reference
+    */
+   public function setDefaultValues() {
+     parent::setDefaultValues();
+     return $this->_formValues;
+   }
  }