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

Fix campaign_id handling for batch entry #18792

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Oct 19, 2020

Overview

Fixes a bug whereby campaign_id is not updated on batch entry if it has been added to the profile.

Before

  1. create a campaign
  2. add campaign id to the build in reserved profile for membership bulk entry

Screen Shot 2020-10-19 at 3 29 15 PM

  1. go to the membership batch data entry form - choose 'membership' (easiest to choose 1 row & $100 as General membership is $100 by default)
  2. IMPORTANT - choose a member with an Existing membership and choose renew (the new membership code path is different)
  3. fill in campaign id - it is not saved

After

Campaign id saved & tested.

Technical Details

The underlying issue appears to be an attack of copy and paste. I tidied up the variable
in both the places that call the processMembership function such that it is passed in
as an array of pass-through params. Campaign id is the only param treated this way for now - but several of the params are in fact simply part of the array of 'memParams' that is passed through.

The function processMembership can be simplified & eventually removed building off this.

Comments

Pre-existing e-notice not addressed - it's in the buildForm & I'm looking at the post process. Unrelated

Screen Shot 2020-10-19 at 3 28 57 PM

@civibot
Copy link

civibot bot commented Oct 19, 2020

(Standard links)

@eileenmcnaughton
Copy link
Contributor Author

@jitendrapurohit is this one you could review?

@@ -838,7 +831,7 @@ private function processMembership(&$params) {
$value['contact_id'], $value['membership_type_id'], FALSE,
//$numTerms should be default to 1.
NULL, NULL, $value['custom'], 1, NULL, FALSE,
NULL, $membershipSource, $isPayLater, $campaignId, $formDates
NULL, $membershipSource, $isPayLater, ['campaign_id' => $value['campaign_id'] ?? NULL], $formDates
Copy link
Contributor

Choose a reason for hiding this comment

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

The element build on the batch entry form is member_campaign_id so think we should replace the key in $value with the same? The patch after being applied is still not able to update the campaign in the membership due to the above mismatch. Replacing it with

NULL, $membershipSource, $isPayLater, ['campaign_id' => $value['member_campaign_id'] ?? NULL], $formDates

works fine. @eileenmcnaughton Can you confirm pls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @jitendrapurohit I've updated it as you suggest

Fixes a bug whereby campaign_id is not updated on batch entry if it has been added to the profile.

The underlying issue appears to be an  attack of copy and paste. I tidied up the variable
in both the places that call the processMembership function such that it is passed in
as an array of pass-through params. The function can be simplified & eventually removed.
@seamuslee001
Copy link
Contributor

Jenkins re test this please

@jitendrapurohit
Copy link
Contributor

Have tested multiple membership renewals via batch screen. This is working fine now 👍

@eileenmcnaughton
Copy link
Contributor Author

@colemanw @seamuslee001 could one of you merge based on @jitendrapurohit review

@seamuslee001
Copy link
Contributor

Merging as per review by @jitendrapurohit

@seamuslee001 seamuslee001 merged commit 9de7f13 into civicrm:master Oct 26, 2020
@seamuslee001 seamuslee001 deleted the status2 branch October 26, 2020 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants