eventespresso / eea-attendee-mover

Addon for EE4+
GNU General Public License v2.0
0 stars 2 forks source link

Fix - Fatal error: Uncaught EventEspresso\core\exceptions\InvalidFormSubmissionException: Registrations can not be moved if you select the exact same ticket that the registration already has! Please select a different ticket. in \eea-attendee-mover\form\SelectTicket.php on line 159 #10

Closed Pebblo closed 5 years ago

Pebblo commented 5 years ago

If you try to move an attendee to the same ticket they are currently on and invlaid exception is thrown:

An EventEspresso\core\exceptions\InvalidFormSubmissionException was thrown!   code: SelectTicket - process - 159
"The data for the "Registrations can not be moved if you select the exact same ticket that the registration already has! Please select a different ticket." form, is either missing or was not submitted properly."
click to view backtrace and class/method details 
\eea-attendee-mover\form\SelectTicket.php   ( line no: 159 )

If I fix this by adding $this->form()->name() to the exception call for the form name, like so:

throw new InvalidFormSubmissionException(
    $this->form()->name(),
    esc_html__(
        'Registrations can not be moved if you select the exact same ticket that the registration already has! Please select a different ticket.',
        'event_espresso'
    )
);

Then an exception is thrown and without WP_DEBUG enable you get error 500. Full error:

Fatal error: Uncaught EventEspresso\core\exceptions\InvalidFormSubmissionException: Registrations can not be moved if you select the exact same ticket that the registration already has! Please select a different ticket. in \eea-attendee-mover\form\SelectTicket.php on line 159

EventEspresso\core\exceptions\InvalidFormSubmissionException: Registrations can not be moved if you select the exact same ticket that the registration already has! Please select a different ticket. in \eea-attendee-mover\form\SelectTicket.php on line 159

If I then navigate back to the ticket selection and refresh a notice is shown with the error about moving a ticket to the same ticket - https://monosnap.com/file/lrkqq16VdYT3eHPNkg5GFPsv6xTdc5

Bug report or feature request?

Expected Behaviour

Display the notice on the page without the fatal from the exception.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

joshfeck commented 5 years ago

This was fixed in core:

https://github.com/eventespresso/event-espresso-core/pull/1201