-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Builds on #27049 to extract getPriceSetID() #27050
Conversation
Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷 Introduction for new contributors
Quick links for reviewers |
278b758
to
1ff517e
Compare
ae812bc
to
158a4b6
Compare
e8fc6fb
to
54b8d5c
Compare
test this please |
* @noinspection PhpUnhandledExceptionInspection | ||
* @noinspection PhpDocMissingThrowsInspection | ||
*/ | ||
public function getPriceSetID(): ?int { |
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.
Should probably use this at 127 as well for consistency.
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.
Actually, $priceSetId is unused, we can just remove 127.
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.
done!
@@ -1428,7 +1428,7 @@ public function buildEventFeeForm($form) { | |||
|
|||
//retrieve custom information | |||
$form->_values = []; | |||
CRM_Event_Form_Registration::initEventFee($form, $event['id'], FALSE, $form->getDiscountID()); | |||
CRM_Event_Form_Registration::initEventFee($form, $event['id'], FALSE, $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 don't think it makes any difference as things stand now, but shouldn't it be $form->getPriceSetID for consistency?
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.
Hmm - I've been trying to go the other way for consistency - ditch the use of form & even the passing of it
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.
Agreed. I guess it doesn't matter here as long as this doesn't get called from anywhere else, just looks a bit odd.
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.
Not sure if this is affected or not https://github.com/eileenmcnaughton/civicrm-core/blob/master/tests/phpunit/CRM/Event/Form/ParticipantTest.php#L360
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.
@seamuslee001 yeah that needs cleaning up - although as long as this PR passes tests it is out of scope for it
54b8d5c
to
97d8f92
Compare
Started giving this an r-run, which is quite tricky as some of this stuff doesn't work very well presently. But to start, if you:
Then you can no longer edit the selections for the participant (that part doesn't show up at all). |
Also noting, though I suppose it is technically out of scope here as it is the current behaviour on master: if I change selections for a registration with a discounted price set, I expect the options to show the discounted price set, but what I get is the current price set based on the current date. For example, if someone registered for a student ticket with an early bird discount and I need to change them to an adult ticket, I would expect they would still get the early bird price. I thought initEventFee was supposed to get the price set that the participant currently had based on the discount id, but that doesn't seem to be happening. |
@larssandergreen thanks for that - I think I agree with you that the price set they selected from should be the one that is loaded so I will check in on that |
@@ -423,7 +423,7 @@ public function buildQuickForm() { | |||
// build amount only when needed, skip incase of event full and waitlisting is enabled | |||
// and few other conditions check preProcess() | |||
if (!$this->_noFees) { | |||
self::buildAmount($this); | |||
self::buildAmount($this, FALSE, NULL, $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.
$required was TRUE by default before, now FALSE - intentional?
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.
opps no
e1069a7
to
1943162
Compare
This gets away from it needing to be set on the form as a property
e4de92b
to
613887a
Compare
whoa that discount code is a can of worms - it adds the property to the form only if the property context exists - which is only true for one of the forms involved Hmm that's a question - it makes sense that a back-office user can change the event selection within the same time-based discount set- but should a self-service user? I suspect not - if they want to do that they maybe have to contact the organization as the discount might depend on them paying on time & they could work the system by buying a cheap ticket early & getting the expensive one later |
OK, makes sense. Yes, let's do the discount thing separately. Looks like the test fails are related. |
Yeah - but super odd Test Result (2 failures / +2) |
613887a
to
6566de7
Compare
Now just a concurrency test fail, so good. |
@@ -540,12 +540,13 @@ public function buildQuickForm() { | |||
* Form object. | |||
* @param bool $required | |||
* True if you want to add formRule. | |||
* @param int $discountId | |||
* @param null $discountId |
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.
int|null
Another small related bug in master. Not an issue here. |
OK, I've given this a fairly thorough run and I think it is ready to merge. |
Excepting that one docblock issue above |
This is ths only one of the forms that has context as a property so the only one that does it
6566de7
to
25687f5
Compare
I fixed the docblock & the test magically passed |
Builds on #27049 to extract
getPriceSetID()
Before
discountID
(newly) pass in toCRM_Event_Form_Registration::initEventFee(
- but used only to getpriceSetID
After
$priceSetID
passed inNote that the
getPriceSetID
function now handles setting the form property & form value, as used. So I removed that from the shared code. I didn't put it in the setting forParticipantFeeSelection
because it is currently interacting with an undefined propertyTechnical Details
Per #27049 the only other usage is a unit test @mlutfy wrote