From 03ee227bbe450917a6d68782dd20f75bcccb5c1d Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 13 Mar 2020 16:00:19 +1300 Subject: [PATCH] dev/user-interface#14 Fix regression whereby links from membership dashboard don't work for export Note it also applies to membership_status_id but the lack of a uniquename makes the fix trickier so I'm reluctant to target the rc --- CRM/Core/Form/Search.php | 3 +++ CRM/Member/BAO/Query.php | 10 +++------- CRM/Member/DAO/Membership.php | 3 ++- CRM/Member/Page/DashBoard.php | 10 +++++----- xml/schema/Member/Membership.xml | 1 + 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index 66cebe8282..0a9969685f 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -202,6 +202,9 @@ class CRM_Core_Form_Search extends CRM_Core_Form { if (isset($fields[$fieldName]['unique_title'])) { $props['label'] = $fields[$fieldName]['unique_title']; } + elseif (isset($fields[$fieldName]['html']['label'])) { + $props['label'] = $fields[$fieldName]['html']['label']; + } elseif (isset($fields[$fieldName]['title'])) { $props['label'] = $fields[$fieldName]['title']; } diff --git a/CRM/Member/BAO/Query.php b/CRM/Member/BAO/Query.php index a8908e0553..0bbe5dadc0 100644 --- a/CRM/Member/BAO/Query.php +++ b/CRM/Member/BAO/Query.php @@ -505,6 +505,7 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { 'membership_join_date', 'membership_start_date', 'membership_end_date', + 'membership_type_id', ]; $metadata = civicrm_api3('Membership', 'getfields', [])['values']; return array_intersect_key($metadata, array_flip($fields)); @@ -514,6 +515,8 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { * Build the search form. * * @param CRM_Core_Form $form + * + * @throws \CiviCRM_API3_Exception */ public static function buildSearchForm(&$form) { $form->addSearchFieldMetadata(['Membership' => self::getSearchFieldMetadata()]); @@ -525,13 +528,6 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { 'class' => 'crm-select2', ]); - $form->addEntityRef('membership_type_id', ts('Membership Type'), [ - 'entity' => 'MembershipType', - 'multiple' => TRUE, - 'placeholder' => ts('- any -'), - 'select' => ['minimumInputLength' => 0], - ]); - $form->addElement('text', 'member_source', ts('Source')); $form->add('number', 'membership_id', ts('Membership ID'), ['class' => 'four', 'min' => 1]); diff --git a/CRM/Member/DAO/Membership.php b/CRM/Member/DAO/Membership.php index a4b79fffec..24582838d3 100644 --- a/CRM/Member/DAO/Membership.php +++ b/CRM/Member/DAO/Membership.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Member/Membership.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:15846e936cabb40c951fc8bc37c6f79a) + * (GenCodeChecksum:8a676a436711b85a6c7228e6566a12fc) */ /** @@ -222,6 +222,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'FKClassName' => 'CRM_Member_DAO_MembershipType', 'html' => [ 'type' => 'Select', + 'label' => ts("Membership Type"), ], 'pseudoconstant' => [ 'table' => 'civicrm_membership_type', diff --git a/CRM/Member/Page/DashBoard.php b/CRM/Member/Page/DashBoard.php index d44ce85c25..66aeba71ae 100644 --- a/CRM/Member/Page/DashBoard.php +++ b/CRM/Member/Page/DashBoard.php @@ -168,9 +168,9 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { foreach ($membershipSummary as $typeID => $details) { if (!$isCurrentMonth) { $membershipSummary[$typeID]['total']['total']['url'] = CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&start=&end=$ymd&status=$status&type=$typeID" + "reset=1&force=1&start=&end=$ymd&status=$status&membership_type_id=$typeID" ); - $membershipSummary[$typeID]['total_owner']['total_owner']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&start=&end=$ymd&status=$status&type=$typeID&owner=1"); + $membershipSummary[$typeID]['total_owner']['total_owner']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&start=&end=$ymd&status=$status&membership_type_id=$typeID&owner=1"); } else { $membershipSummary[$typeID]['total']['total']['url'] = CRM_Utils_System::url('civicrm/member/search', @@ -178,11 +178,11 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { ); $membershipSummary[$typeID]['total_owner']['total_owner']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"); } - $membershipSummary[$typeID]['current']['total']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&type=$typeID"); - $membershipSummary[$typeID]['current_owner']['current_owner']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&type=$typeID&owner=1"); + $membershipSummary[$typeID]['current']['total']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&membership_type_id=$typeID"); + $membershipSummary[$typeID]['current_owner']['current_owner']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&membership_type_id=$typeID&owner=1"); } - $totalCount = array(); + $totalCount = []; $newCountPreMonth = $newCountMonth = $newCountYear = 0; $renewCountPreMonth = $renewCountMonth = $renewCountYear = 0; diff --git a/xml/schema/Member/Membership.xml b/xml/schema/Member/Membership.xml index 9522592d80..15d53ab3a2 100644 --- a/xml/schema/Member/Membership.xml +++ b/xml/schema/Member/Membership.xml @@ -61,6 +61,7 @@ Select + 1.5 -- 2.25.1