Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Cleanup CRM_Member_BAO_Membership::buildMembershipTypeValues #16059

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Dec 9, 2019

Overview

Fixes function to be more readable, use caching & return more data

Before

  • Function not using cached variables
  • Function kinda long
  • tax information not available
  • No specific test cover

After

  • MembershipTypes retrieved from cached function
  • Additional tax info added to this cached function
  • Various test bugs fixed & cover added

Technical Details

This is towards a fix for #15895 - I hit #16058 in the process. It doesn't fix #15895 but it points towards the solution which, to my mind, is assigning more useful values to the template & doing less in javascript. The next step is to use the correct tax_rate rather than have to use 2 arrays just to get the tax_rate - ie

eileenmcnaughton@458a559#diff-fa0276456bc05f4629f775e6846f62ed

However, following that we can have the js use the figure which includes the tax, rather than having to calculate that in js with unknowns to deal with

Comments

Anything else you would like the reviewer to note

@civibot
Copy link

civibot bot commented Dec 9, 2019

(Standard links)

@civibot civibot bot added the master label Dec 9, 2019
@eileenmcnaughton eileenmcnaughton changed the title Mem val2 [REF] Cleanup CRM_Member_BAO_Membership::buildMembershipTypeValues Dec 9, 2019
@eileenmcnaughton eileenmcnaughton force-pushed the mem_val2 branch 2 times, most recently from 17e8ef5 to fc694f0 Compare December 9, 2019 11:13
list($MembershipRenew) = CRM_Member_BAO_Membership::processMembership(
$contactId,
$this->_membershipTypeID,
FALSE,
$membershipRenewal,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This param is a bool!

@@ -811,7 +808,7 @@ public function testMembershipPaymentForSingleContributionMultipleMembership() {
$parentContactId = $this->individualCreate();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test actually didn't pass in isolation for set-up related reasons

*
* @throws \CiviCRM_API3_Exception
*/
public function testBuildMembershipTypeValues() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the new testt

@seamuslee001
Copy link
Contributor

@eileenmcnaughton 2 of the test failure look like they relate

This simplifies this function & switches it to use a cached function to get the MembershipTypes. In general I would
argue that we should be caching metadata entities (membership types, statues, price fields, etc) and accessing
the cached versions & ideally the v4 api would be able to access cached versions filter-dependent.

In order to keep the test passing I worked a little on standardisation
@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 this has passed now

@mattwire
Copy link
Contributor

mattwire commented Jan 9, 2020

Useful step in the right direction

@mattwire mattwire merged commit 91e3e6b into civicrm:master Jan 9, 2020
@eileenmcnaughton eileenmcnaughton deleted the mem_val2 branch January 9, 2020 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants