From cd8ae813f35f8002896c9fc671e1ee0c29812fda Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 9 Nov 2019 12:36:57 +1300 Subject: [PATCH] Convert contribution_page_id to url-supported parameter --- CRM/Contact/Form/Search/Advanced.php | 1 - CRM/Contribute/BAO/Query.php | 7 +------ CRM/Contribute/Form/Search.php | 7 ++++++- CRM/Contribute/Page/ContributionPage.php | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CRM/Contact/Form/Search/Advanced.php b/CRM/Contact/Form/Search/Advanced.php index d3f5c1c4f6..b7f043848f 100644 --- a/CRM/Contact/Form/Search/Advanced.php +++ b/CRM/Contact/Form/Search/Advanced.php @@ -341,7 +341,6 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { 'activity_type_id', 'status_id', 'priority_id', - 'contribution_page_id', 'contribution_product_id', 'payment_instrument_id', 'group', diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 53546df6d8..59b2f00137 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -902,6 +902,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { 'invoice_number', 'receive_date', 'contribution_cancel_date', + 'contribution_page_id', ]; $metadata = civicrm_api3('Contribution', 'getfields', [])['values']; return array_intersect_key($metadata, array_flip($fields)); @@ -943,12 +944,6 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { ['entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search', 'options' => $financialTypes] ); - $form->add('select', 'contribution_page_id', - ts('Contribution Page'), - CRM_Contribute_PseudoConstant::contributionPage(), - FALSE, ['class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -')] - ); - // use contribution_payment_instrument_id instead of payment_instrument_id // Contribution Edit form (pop-up on contribution/Contact(display Result as Contribution) open on search form), // then payment method change action not working properly because of same html ID present two time on one page diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index 8f47552a26..2c3d152e75 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -280,7 +280,6 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { 'contribution_soft_credit_type_id', 'contribution_status_id', 'contribution_trxn_id', - 'contribution_page_id', 'contribution_product_id', 'invoice_id', 'payment_instrument_id', @@ -473,6 +472,12 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { $this->_formValues['receive_date_high'] = date('Y-m-d H:i:s', strtotime($highReceiveDate)); CRM_Core_Error::deprecatedFunctionWarning('pass receive_date_high not end'); } + //check for contribution page id. + $contribPageId = CRM_Utils_Request::retrieve('pid', 'Positive', $this); + if ($contribPageId) { + CRM_Core_Error::deprecatedFunctionWarning('pass contribution_page_id'); + $this->_formValues['contribution_page_id'] = $contribPageId; + } } } diff --git a/CRM/Contribute/Page/ContributionPage.php b/CRM/Contribute/Page/ContributionPage.php index 233f4074d7..60c1dd5f21 100644 --- a/CRM/Contribute/Page/ContributionPage.php +++ b/CRM/Contribute/Page/ContributionPage.php @@ -240,7 +240,7 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page { $yearNow = $yearDate + 10000; $urlString = 'civicrm/contribute/search'; - $urlParams = 'reset=1&pid=%%id%%&force=1&test=0'; + $urlParams = 'reset=1&contribution_page_id=%%id%%&force=1&test=0'; self::$_contributionLinks = array( CRM_Core_Action::DETACH => array( -- 2.25.1