Support

Home Forums Attendee Mover Add-on Attendee Mover and PRIMARY_REGISTRANT_ANSWER_* error

Attendee Mover and PRIMARY_REGISTRANT_ANSWER_* error

Posted: March 19, 2017 at 11:58 pm

Viewing 4 reply threads


Cecil Goldstein

March 19, 2017 at 11:58 pm

Hi there,

I tracked down what I think is a bug you might be interested in.

Scenario: we use [PRIMARY_REGISTRANT_ANSWER_*] to (a) send emails to a person other than the attendee (b) in the body of message templates.

The bug manifests itself in registrations that have been moved by the attendee mover. When we choose to manually resend moved registrations via the Registrations screen (after a moved email), we noticed blanks where the answers to the questions should have been substituted.

Tracing the code, I found the problem to be a lookup in

core/libraries/shortcodes/EE_Primary_Registration_Details_Shortcodes.lib.php

The problem shows up in this snippet:

$primary_registration->registrations[$primary_reg->ID()]

$primary_registration is assigned (correctly) to the “new” registration that is created for the moved attendee. $primary_reg appears to be the “old” registration (i.e. the one that was cancelled when moving the attendee).

Further digging revealed that the objects are created in

core/libraries/messages/data_class/EE_Messages_incoming_data.core.php

This calls EE_Transaction->primary_registration

The problem appears to be in the body of the primary_registration() function, which uses the get_first_related mapping in the object model. In this case, it should be something like primary_active_registration – as first_related returns the previous, cancelled registration – causing the lookup failure in the first line of code above.

I fixed this issue by:

  • Added a get_first_related function to EE_Transaction
  • Editing EE_Messages_incoming_data to use the new function (which I feel might have side effects I don’t understand yet – probably they’ll reveal themselves)

This doesn’t matter in when parsing other PRIMARY_REGISTRANT fields because they map to method calls on an object that is correctly populated.

My guess is that the real solution is to amek the get_first_related call do an order-by primary key descending, but I’ve no idea what effect this might have.

Hope that’s useful, would love to know your opinion.

Daragh


Josh

  • Support Staff

March 20, 2017 at 10:52 am

Hi there,

Thank you for for reaching out and reporting this. In the future if you run into another issue like this, these are best posted as an issue on Github:

https://github.com/eventespresso/event-espresso-core/issues


Josh

  • Support Staff

March 20, 2017 at 11:15 am

And actually, if you can submit a pull request with your changes, the developers can review and follow up with you.


Cecil Goldstein

March 20, 2017 at 6:26 pm

Great. Thanks Josh – I wasn’t sure. Hope that it helps!


Cecil Goldstein

March 20, 2017 at 6:27 pm

Just submitted as an issue.

Viewing 4 reply threads

The support post ‘Attendee Mover and PRIMARY_REGISTRANT_ANSWER_* error’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso