progressivetech / net.ourpowerbase.qrcodecheckin

QRCode Checkin allows you to send an email that contains a scanable code to the registered participants for your event.
Other
16 stars 15 forks source link

Issue w/ opening QR Code Check-in page #16

Closed mariav0 closed 2 years ago

mariav0 commented 3 years ago

When I try to scan the QR code it opens a link but only the start page is showing. When I use this link with my computer it also doesn't work the first time but wen I reload the page it works. Has someone else similar issues?

edit: And when I click on "Update to Attended" the error "There was an error updating the status. Sorry." occurs. (I've changed the date of the event to today but the code was sent 2 weeks ago already)

CiviCRM 5.39.0 PHP 7.4.19

jmcclelland commented 3 years ago

Hi - are you using Drupal, Wordpress or Joomla? Each handles links differntly, so that may be a cause for the problem.

Also, do you have any errors listed in your ConfigAndLog file?

And lastly, when you get the "There was an error updating the status. Sorry" - can you check your browser console log? There may be more info in that log (right click any where on the page, then click "Inspect" and then choose the "Console" tab).

mariav0 commented 3 years ago

Hi! I am using Wordpress.

And yes, there is an error when I get the error message "There was an error updating the status. Sorry": Object { is_error: 1, error_message: "'Teilnehmer/in is not a valid option for field role_id" } It seems it compares the label of the role instead of the id.

In my ConfigAndLog file I can't find any errors. Only this (which seems fine):

Aug 17 12:02:53  [info] $result = Array
(
    [is_error] => 0
    [version] => 3
    [count] => 1
    [id] => 19
    [values] => Array
        (
            [0] => Array
                (
                    [contact_id] => 15
                    [contact_type] => Individual
                    [contact_sub_type] => 
                    [sort_name] => Maria
                    [display_name] => Maria
                    [event_id] => 1
                    [event_title] => Art Event
                    [event_start_date] => 2021-08-12 21:00:00
                    [event_end_date] => 2021-08-13 22:00:00
                    [default_role_id] => 1
                    [participant_id] => 19
                    [participant_fee_level] => Array
                        (
                            [0] => Single ticket - 1
                        )

                    [participant_fee_amount] => 150.00
                    [participant_fee_currency] => EUR
                    [event_type] => Event
                    [participant_status_id] => 1
                    [participant_status] => Registriert
                    [participant_role_id] => 1
                    [participant_role] => Teilnehmer/in
                    [participant_register_date] => 2021-07-22 16:35:00
                    [participant_source] => 
                    [participant_note] => 
                    [participant_is_pay_later] => 0
                    [participant_is_test] => 0
                    [participant_registered_by_id] => 
                    [participant_discount_name] => 
                    [participant_campaign_id] => 
                    [custom_1] => Array
                        (
                        )

                    [custom_1_9] => Array
                        (
                        )

                    [id] => 19
                    [qr_token] => 
                    [image_URL] => 
                    [display_image_URL] => 
                )
        )
)
jmcclelland commented 3 years ago

That's strange. The code sets the status_id to Attended which should work fine provided there is a status with the name attended (regardless of the label). Is it possible that your status has the name as well as label changed?

Without the use of the english name, there is no way to know which status should be "Attended".

Seems like someone else (#10) had this issue also.

mariav0 commented 3 years ago

That's really weird since the name is always in English. Only our label is in German and when I change it to Attended as well it still doesn't work.

jmcclelland commented 3 years ago

When you change the label to Attended, does it still give the error: "'Teilnehmer/in is not a valid option for field role_id" } or does it give the error: "Attended is not a valid option for field role_id" }?

mariav0 commented 3 years ago

It still gives the error: "'Teilnehmer/in is not a valid option for field role_id" } I also tried "Participant" but it also doesn't work.

jmcclelland commented 3 years ago

Ohhh. Woops. I'm sorry. I mis-read role_id for status_id. The problem is with the role_id, not the status_id. The defalt role is is: Attendee.

However still... I can't quite seem to replicate the problem. Since participant_role_id is provided, it should be ignoring the value for it when saving.

What version of CiviCRM are you using?

mariav0 commented 3 years ago

I've updated on 5.40.2 yesterday and before it was 5.39.0. But I've changed the label of the role to "Attendee" and now it works. Since this role has 1 as value by default it would help most people which are using another language than English to use the value instead of the label. What do you think?

jmcclelland commented 3 years ago

I agree - this should definitely be fixed. I'm just struggling to figure it out why it happens and how to fix it. I'm open to suggestions!

agileware-justin commented 3 years ago

17 fixes the URL being wrong on WordPress.

I can also confirm that the update attendance status page wasn't working when I tested this. I ran out of time to debug fully, sorry.

sebalis commented 2 years ago

As my colleague @mariav0 said, the problem occurs when she changes the label for the Attendee role. It was changed to a non-standard German version, “Teilnehmer·in”, where the “·in” is appended for the purpose of gender neutrality (and there is not yet a standardised way to achieve this in German). I don’t know if the use of the standard translation Teilnehmer would have avoided the issue but that would not be satisfactory.

As you know, both the role ID and the label are not parameters of the API call used to make the change, only the status label (status_id = Attended is a parameter, not role_id = Attendee). But clearly when executing the API call CIviCRM somehow tries to find the new role ID via its label and fails when the label is changed. But it turns out that the API call used to make the change in Checkin.php – Participant/udpate – is deprecated. Using create instead (as the API Explorer suggests when choosing update) works around the problem. I cannot say if you want to maintain compatibility with older systems that maybe don’t have create (I don’t even know when create was introduced or when update got deprecated), but I will now submit a PR so you can make a decision on this.

jmcclelland commented 2 years ago

Thank you for the PR! I'm glad to see a work around.