-
-
Notifications
You must be signed in to change notification settings - Fork 829
Extract isMembershipPriceSet
(useForMember
)
#25754
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
Conversation
(Standard links)
|
7bf7a80
to
e499272
Compare
//don't build membership block when pledge_id is passed | ||
if (empty($this->_values['pledge_id']) && empty($this->_ccid)) { | ||
$this->_separateMembershipPayment = FALSE; | ||
if (CRM_Core_Component::isEnabled('CiviMember')) { | ||
|
||
if ($this->_priceSetId && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
priceset would only be empty for no amounts section at all
// access via the get & not directly, it can go. | ||
$this->getPriceSetID(); | ||
$this->order = new CRM_Financial_BAO_Order(); | ||
$this->order->setPriceSetID($this->getPriceSetID()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added in the order
object here - we are only using it to get the cached price set metadata but it has a lot of helpers that can, in future fixes, remove a lot of the code in these classes. In general I want things that can be calculated to not be passed around / only to be set as properties within functions that expose how they would be calculated - so using the cached price set metadata is the direction I want to go. The order class functions will replace init
whic is where _priceSet
is otherwise retrieved from
The test run went bananas but it looks like there is a real fail: |
Test was - testing a non-form class 'as if' it were a form and pretending to check for an exception it was not asserting / hitting
@demeritcowboy yeah - it is an awful test - I think I fixed it. The test is awful because
|
It is passing now |
Right, I meant to take look-see. Will do. |
@demeritcowboy yeah - I don't want to put pressure on you - but it would be nice if this was on your list somewhere cos I am pretty confused with the code & variables!!! And your Sherlock Holmes senses would be very helpful I'm hoping to make the changes proposed above the the template & now we have other changes in that template this release it would be nice to hit the same release. |
I've looked through some of this before and it's a pit of doom. The code changes you are proposing look sane but it will almost certainly break some random scenario in a filing cabinet at the end of the universe. When it does break we can clean up the code a bit more and bring sanity to the universe. |
Thanks for looking at it. I had taken another look recently but other than it seeming to at least at one time be about using price sets for memberships it is really difficult to get into. |
thanks @briennekordis I will check it out! |
Overview
Extract isMembershipPriceSet (useForMember)
Before
I've spent hours trying to figure out what
useForMember
means & how it is set & usedAfter
Hopefully the meaning & how it is derieved is clear-ish. As for used - still figuring that out - see technical details....
Technical Details
@demeritcowboy I'm hoping you can help me here. I think I got the
if
forccid
right but it broke my brain a bitIn the online receipt we see
{if $membership_assign && !$useForMember}
After working through this I think that effectively means
{if $membership_assign && !$isQuickConfig}
and if true then present basic membership data & no line items{if !$useForMember and isset($membership_amount) and !empty($is_quick_config)}
$useFormMember
is redundant here & just checkingquickConfig
is enoughDitto in this line
{elseif empty($useForMember) && !empty($lineItem) and $priceSetID and empty($is_quick_config)}
and
My eventual theory is that
useForMember
wasn't robust enough andis_quick_config
was added, without removinguseForMember
.If you agree then I will remove all the usages of
useForMember
in theonline_membership_receipt
templateI'm trying to get rid of the
issets
aroundmembership_amount
andamount_level
- but kept getting confused on whatuseForMember
meansComments