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

Can't update Attendee status #4

Closed arake closed 3 years ago

arake commented 5 years ago

Hi! When I scan the QR Code with the camera I'm directed to the QR Code Check-in page. All information is correct but the "Update to Attended" button is disabled. Looking at the console I found: qrcodecheckin.js?r=ekc5z:5 Uncaught TypeError: Cannot read property '1' of null at HTMLButtonElement. (qrcodecheckin.js?r=ekc5z:5) at HTMLButtonElement.dispatch (jquery.min.js?r=ekc5z:3) at HTMLButtonElement.r.handle (jquery.min.js?r=ekc5z:3)

It points the error to this line in qrcodecheckin.js r participant_id = reg.exec(window.location.pathname)[1];

image

jmcclelland commented 5 years ago

Thanks for the report. I think this is a drupal vs. wordpress problem. Can you paste in the exact URL that WordPress produces (you can leave off your server name for privacy reasons if you want - I just want the path part).

I think the javascript code will need to be smart enough to parse the URL for wordpress as well as drupal (and probably joomla too).

arake commented 5 years ago

Sure. The URL the QR Code directs me to is /wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fqrcodecheckin%2F65%2Fa21855da08cb102d1d217c53dc5824a3a795c1c1a44e971bf01ab9da3a2acbbf

Em qua, 16 de jan de 2019 às 12:34, Jamie McClelland < notifications@github.com> escreveu:

Thanks for the report. I think this is a drupal vs. wordpress problem. Can you paste in the exact URL that WordPress produces (you can leave off your server name for privacy reasons if you want - I just want the path part).

I think the javascript code will need to be smart enough to parse the URL for wordpress as well as drupal (and probably joomla too).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin/issues/4#issuecomment-454822629, or mute the thread https://github.com/notifications/unsubscribe-auth/AHQijYKPWcuDgxfiDB3AIIx6mArwYXulks5vD0aDgaJpZM4aDPwX .

-- https://about.me/kenedy.araujo?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel Kenedy Araujo about.me/kenedy.araujo https://about.me/kenedy.araujo?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel

arake commented 5 years ago

Hi Jamie, any update on this? Is there something I can do to help? What would the correct path look like?

Thanks!

jmcclelland commented 5 years ago

Sorry for the delay. The problem code is in qrcodecheckin.js. The Drupal path presented is something like this: /civicrm/qrcodecheckin/123/blahblahhash which makes it easy to extract the participant id (in this case, 123). The code used to extract it is:

var reg = /\/qrcodecheckin\/([0-9]+)\//
var participant_id = reg.exec(window.location.pathname)[1];

To fix this for wordpress, I think we would have to test for the path containing wp-admin, then test for the presence of a q variable, then URL decode the q variable and try to extract it that way.

jmcclelland commented 5 years ago

I just updated qrcodecheckin.js with a new version that should work with Wordpress. Can you give it a shot and let us know if that does the trick? https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin/blob/master/qrcodecheckin.js

arake commented 5 years ago

Hi Jamie! Thanks for jumping into this. I tested it today and figured out you need to change lines 16 and 17 to:

16: var reg_wordpress_path = /\/wp-admin\/admin\.php/ 17: //var reg_wordpress_path = /test\.html/

I did that and it extracted the correct participant_id. However, now I'm blocked by this error: {is_error: 1, error_message: "'Participante' is not a valid option for field role_id"} error_message: "'Participante' is not a valid option for field role_id" is_error: 1

I still need to investigate if that's a civicrm configuration issue or something related to the qrcodecheckin code. Any insights would be much appreciated.

Thanks!

jmcclelland commented 5 years ago

Ah, thanks for correcting my mistake. As you can see I wasn't properly testing on a wordpress site. I've just fixed that.

As for the new error... I suspect it might have something to do with localization. Is your site set to use Spanish?

I don't know why that would cause the problem. But it seems that your site is objecting to setting the role to 'participante' - I suspect it might be expecting 'participant' instead.

arake commented 5 years ago

Spot on! At some point, I setup civicrm to work in Portuguese. During an update, I moved back to English only and for some reason, some strings remained in Portuguese. I changed 'Participante' to 'Attendee' and it worked like a charm.

Thanks!

Em seg, 11 de fev de 2019 às 14:57, Jamie McClelland < notifications@github.com> escreveu:

Ah, thanks for correcting my mistake. As you can see I wasn't properly testing on a wordpress site. I've just fixed that.

As for the new error... I suspect it might have something to do with localization. Is your site set to use Spanish?

I don't know why that would cause the problem. But it seems that your site is objecting to setting the role to 'participante' - I suspect it might be expecting 'participant' instead.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin/issues/4#issuecomment-462428289, or mute the thread https://github.com/notifications/unsubscribe-auth/AHQijY15-tNmT6ablR1qD7rg3Y1YZSCRks5vMa8hgaJpZM4aDPwX .

-- https://about.me/kenedy.araujo?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel Kenedy Araujo about.me/kenedy.araujo https://about.me/kenedy.araujo?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel

jmcclelland commented 5 years ago

Great - thanks for the update. I'm going to re-open though because I shouldn't have "Attendee" hard coded. I want to be sure it will still work even if you have portuguese set as the language.

jmcclelland commented 3 years ago

I'm closing this issue in favor of #10.