Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Issue #238 Membership Discount not applied. #200

Merged
merged 2 commits into from Nov 15, 2018
Merged

Issue #238 Membership Discount not applied. #200

merged 2 commits into from Nov 15, 2018

Conversation

chamilwijesooriya
Copy link
Contributor

Overview

GitLab Issue #238

Before

  1. Create a discount for membership
  2. Go to Membership > New Membership
  3. Select contact and set membership type to that used in 1.
  4. Note the amount under the Membership Payment and Receipt section
  5. Enter the discount code and Apply
  6. Note that membership type changes to eg "General (Includes applied discount code SummerSpecial: 25%)" but the Amount is unchanged

Observed on dmaster.demo (5.5.alpha1) and 5.2.1

After

Discount is applied and changed in Amount text field.

Technical Details

Unset submitted form value 'total_amount' in membershipTypeValues hook.

@chamilwijesooriya
Copy link
Contributor Author

@elisseck @mattwire @MegaphoneJon any thoughts on this?

@elisseck
Copy link

Hey @chamilwijesooriya - i'm interested in reviewing this one as well - just slammed this afternoon and tomorrow unless something drops off.

What I can say is I was definitely able to recreate it, so that's a start 👍

@chamilwijesooriya
Copy link
Contributor Author

@elisseck thanks for taking the time.

@eileenmcnaughton
Copy link
Contributor

I tested this - it seems possibly to be a regression in CiviDiscount after some changes to how the discount is calculated but this fix doesn't result in the total_amount being correctly set on the form - which is what we need. I think the form needs a bit of re-work

@chamilwijesooriya
Copy link
Contributor Author

@eileenmcnaughton didn't realise the hook is getting called after each submit. Added another fix, but the issue is if the user wanted to enter a different value than the discount, this will reset it to the discount amount.
(for eg: if membership value is £100, discount is 10%, discounted value will be £90. But if the user changed it to £80 and submitted, it will still keep £90)

Would be nice if you guys further improved the membership discount part

@eileenmcnaughton
Copy link
Contributor

I just retested this & was able to replicate the bug before but not after so it seems good to merge

@eileenmcnaughton eileenmcnaughton merged commit b3aec87 into civicrm:master Nov 15, 2018
@eileenmcnaughton
Copy link
Contributor

(note I tested on 5.8 rc)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants