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

dev/events#56 Allow backend (de)registration changes for sold out price set items, refactor #24639

Closed

Conversation

larssandergreen
Copy link
Contributor

@larssandergreen larssandergreen commented Sep 28, 2022

Overview

This replaces #20252, which I cannot re-open — but it now includes some refactoring and even more clean up of styles.

Currently, 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.

Perhaps most importantly, it refactors some of the very repetitive Quickform code for price sets to hopefully make that a little more maintainable (though there still a lot more that could be done).

Before

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

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 moved the great concatenate fest that was building the labels for price set options into a separate function so it isn't repeated four times. 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.

The warning found in the previous PR by @BettyDolfing and @jaapjansma has been fixed in the refactoring (thanks for testing and sorry to have been unable to respond at the time). I'm unable to reproduce the blank preview issue.

@civibot
Copy link

civibot bot commented Sep 28, 2022

(Standard links)

@civibot civibot bot added the master label Sep 28, 2022
@larssandergreen larssandergreen marked this pull request as ready for review September 28, 2022 06:49
@larssandergreen larssandergreen marked this pull request as draft October 18, 2022 02:48
@larssandergreen larssandergreen changed the title dev/events#56 Allow backend (de)registration changes for sold out price set items WIP: /events#56 Allow backend (de)registration changes for sold out price set items Oct 18, 2022
@larssandergreen larssandergreen force-pushed the allow-deregistration branch 4 times, most recently from 1c2933c to d787073 Compare October 28, 2022 03:59
@larssandergreen
Copy link
Contributor Author

test this please

1 similar comment
@larssandergreen
Copy link
Contributor Author

test this please

@seamuslee001
Copy link
Contributor

Jenkins re test this please

@larssandergreen
Copy link
Contributor Author

@seamuslee001 Looks like it's still giving the same error.

@larssandergreen larssandergreen marked this pull request as ready for review October 28, 2022 23:46
@larssandergreen larssandergreen changed the title WIP: /events#56 Allow backend (de)registration changes for sold out price set items dev/events#56 Allow backend (de)registration changes for sold out price set items, refactor Oct 28, 2022
@seamuslee001
Copy link
Contributor

Jenkins re test this please (investigating)

@larssandergreen
Copy link
Contributor Author

Thanks @seamuslee001 for whatever you did to get this working.

@larssandergreen larssandergreen force-pushed the allow-deregistration branch 2 times, most recently from 6fc5743 to 25ed19c Compare December 17, 2022 21:20
@larssandergreen
Copy link
Contributor Author

larssandergreen commented Dec 17, 2022

There was a conflict with #25033 from @kurund. I have changed from if ($opt['label']) to if !empty($opt['label']) per that PR, the remainder of the changes in that PR were already included in this PR.

@civicrm-builder
Copy link

Can one of the admins verify this patch?

@larssandergreen
Copy link
Contributor Author

jenkins test this please

@larssandergreen
Copy link
Contributor Author

Closing, replaced with #26112

@larssandergreen larssandergreen deleted the allow-deregistration branch May 24, 2023 05:50
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.

3 participants