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

Refactor display of price sets and allow backend registration changes for sold out price set items #26112

Conversation

larssandergreen
Copy link
Contributor

@larssandergreen larssandergreen commented Apr 26, 2023

Overview

This replaces #24639 — as that one was old, so I'm bumping this back up. The can't remove people from full price set options bug has been a real pain for us in the past and I'm sure we aren't the only ones, so hopefully we can get this merged. The refactor also allows for some additional work that I've already done that will optionally show how many spaces are remaining in each option - something that has caused a lot of frustration for people trying to register a group of four for workshops with limited space (will post a PR for that once this one has been merged).


The most important change here is some refactoring of the very repetitive Quickform code for price sets to make that a little more maintainable (though there still a lot more that could be done).

Additionally, when editing price set selections for an event registrant, you cannot add or remove sold out items. This PR makes it possible for backend users to add or remove price set selections that are sold out from registrations. It also ensures that all full selections show (Sold out) text, both on the Register Participant form and the Change Selections and Edit Event Registration forms.

It also fixes some inconsistent fonts, margins, spacing, etc in price sets.

Before

Each of four types of price field was generated through a separate block of code, with a lot of repetition, making it hard to maintain.

If a price set selection is sold out, back-end users can add this selection on Events - Register Event Participant, but if they edit a existing registration they cannot either add or subtract from sold out selections as these are disabled/frozen (except for removing select fields, which was possible). Back-end users may add registrants to sold out selections unintentionally, as there is no warning that selections are sold out on the Register Participant Form. Backend users cannot remove registrants from sold out selections, which should clearly be possible. They cannot override price set limits if required to add participants to sold out selections.

Register Participant: Backend user can register participant for sold out selections, they are unmarked
image

Change Selections: Participant cannot be added or removed from sold out selections
image

Front end registration, lots of odd styling
image

After

A good chunk of the price set logic has been broken out into a separate function, allowing re-use in each type of price field, cutting down on repeated code.

Backend users can register and deregister participants for any price set selection. All price set selections that are sold out are now marked as sold out.

Register participant: Sold out selections are now marked
image

Change Selections: Participant can be added to or removed from all selections.
image

Front end registration, a little more readable and consistent
image

I've also removed the italics, font size and weight from sold out items so the form is less busy and more consistent, enclosed the none option in a span to match other radio options, and added the light sold out grey colour to all sold out options (except the select options). I removed the double 'Sold out' for text fields and added the missing 'Sold out' on select options. Added space between frozen checkbox and radios and text. Fixed inconsistent font size and spacing for pre and post field help.

Comments

I've also aligned the process for Text fields with the process for all the other types by moving this from the tpl to the Price Field BAO, so it can use the same function rather than implementing the same logic in Smarty. This required a small change that is a bit odd to get the label for the text field to the tpl, introducing an auxiliary form element that holds the label that goes after the text field, since the text field has two labels. This is all working around the unfortunate situation where text fields are both price fields and price options at the same time.

I've removed some now unneeded code that set form rules for selects and some other repeated code.

@civibot
Copy link

civibot bot commented Apr 26, 2023

(Standard links)

@larssandergreen
Copy link
Contributor Author

Jenkins re test this please
Looks like the failure was not related to this PR, something to do with translations.

@larssandergreen
Copy link
Contributor Author

jenkins, test this please

@larssandergreen larssandergreen changed the title Refactor display of price sets and allow backend (de)registration changes for sold out price set items Refactor display of price sets and allow backend registration changes for sold out price set items Apr 26, 2023
@larssandergreen larssandergreen force-pushed the refactor-event-price-sets,-allow-deregistration branch 5 times, most recently from 814667f to 26fe4f0 Compare May 23, 2023 16:49
@larssandergreen larssandergreen force-pushed the refactor-event-price-sets,-allow-deregistration branch from 26fe4f0 to 3aacfe1 Compare May 23, 2023 17:09
@larssandergreen larssandergreen marked this pull request as draft May 29, 2023 21:00
@larssandergreen
Copy link
Contributor Author

Splitting this up into multiple PRs to hopefully get it merged, starting with #26375

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.

1 participant