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

Code cleanup on Membership form when freezing fields in a recurring exists situation #12642

Merged
merged 3 commits into from
Aug 17, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Minor code extraction & tidy up

Before

an array of $elements is built as fields are added. It takes work to figure out why

After

Elements to be frozen are frozen as they are added.

Technical Details

I actually was trying to extract out the handling of the date fields to the addEntityFieldsToTemplate() function & convert them to datepicker but I wound up feeling I had to unravel this first

Comments

@civibot
Copy link

civibot bot commented Aug 10, 2018

(Standard links)

@eileenmcnaughton eileenmcnaughton changed the title Recur Code cleanup on Membership form when freezing fields in a recurring exists situation Aug 10, 2018
if ($this->_action & CRM_Core_Action::UPDATE
&& CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id,
'contribution_recur_id')
&& !CRM_Member_BAO_Membership::isSubscriptionCancelled($this->_id)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this function coming out of some existing code? I think it makes sense but I need to be sure it's not a change in behaviour? - ie. this is assuming that a cancelled membership cannot be renewed and that may not previously have been the case (even if it's the right thing to do)

Copy link
Contributor

Choose a reason for hiding this comment

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

@mattwire check old lines 666 - 671

@mattwire
Copy link
Contributor

@eileenmcnaughton Could do with a bit of context here - is this a step towards merging Membership and MembershipRenewal forms? Is the freezing elements new for the Membership form, but existing on the MembershipRenewal forms?

@eileenmcnaughton
Copy link
Contributor Author

@mattwire yeah - a very preliminary step IMHO. When I looked at Membership form the 2 steps I thought should be first were

  1. replacing the jcalendar fields
  2. setting the status message 'as we go' rather than building $createdMemberships & passing to $this->setStatusMessage($membership, $endDate, $receiptSent, $membershipTypes, $createdMemberships, $isRecur, $calcDates, $mailSend); - This latter is because in order to rationalise post process code it is necessary to reduct / sanitise what variables are needed in later parts of the code.

When I went to do 1 I added the entityFieldsTrait & defined the 3 fields in the setEntityFields & changed the tpl - I got it close to working but realised the setEntityFields needed to be able to specify whether end_date if freezable.

@mattwire
Copy link
Contributor

Good to merge @eileenmcnaughton @seamuslee001

@seamuslee001
Copy link
Contributor

Merging as per @mattwire's review

@seamuslee001 seamuslee001 merged commit 1a4e65f into civicrm:master Aug 17, 2018
@seamuslee001 seamuslee001 deleted the recur branch August 17, 2018 22:34
@eileenmcnaughton
Copy link
Contributor Author

thanks @mattwire

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.

4 participants