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

Fix missing error on Transfer Participant and allow multiple #26365

Conversation

larssandergreen
Copy link
Contributor

Before

If you attempt to transfer an event registration to a contact who is already registered for an event on the back end, the form fails validation, but no error is shown.

If you attempt to transfer an event registration to a contact who is already registered for an event when Allow same email and multiple registrations? is enabled, you cannot transfer the registration.

After

You can transfer an event registration to an already registered contact if Allow same email and multiple registrations? is enabled.

An error is shown on both front and back end if you cannot transfer an event registration because the contact is already registered for the event.

image

@civibot
Copy link

civibot bot commented May 28, 2023

(Standard links)

@civibot civibot bot added the master label May 28, 2023
@@ -288,7 +295,8 @@ public static function checkRegistration($fields, $self, $contact_id, &$errors)
if (!empty($to_event_id)) {
foreach ($to_event_id as $id) {
if ($id == $self->_event_id) {
$errors['email'] = $display_name . ts(" is already registered for this event");
$error_field = $fields['contact_id'] ? 'contact_id' : 'email';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this array key always set or do you need to use !empty()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fixed. Actually, further testing showed this was a little funky because it was only matching on email and so if you entered an email address with a different name, it came back with an error about the name associated with that email address, when the email address was the actual error, so I've corrected that too.

@larssandergreen larssandergreen force-pushed the Show-already-registered-error-on-Transfer-Participant branch 2 times, most recently from 9d5c5bb to 2f5896d Compare May 30, 2023 15:59
@larssandergreen larssandergreen force-pushed the Show-already-registered-error-on-Transfer-Participant branch from 2f5896d to a0ebf09 Compare May 30, 2023 16:03
@larssandergreen
Copy link
Contributor Author

I decided just to fix the whole function properly, the way it worked was a bit silly and hard to read.

@larssandergreen
Copy link
Contributor Author

jenkins, test this please (failures don't look related)

@mattwire mattwire merged commit 1aa7c7b into civicrm:master Jun 7, 2023
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