When using Fax/SMS module with twillo, after entering all my account id and keys/secrets, I can look at my history of messages before the patch of 7.0.2. When using the function to test and run the SMS reminders, the popup browser errors Not Authorized. I have reproduced this error on the demo at OpenEMR Login after enabling the module and entering my account credentials.
Browser:
chrome, firefox Operating System
I’m using:
Search
yes Logs
no errors noted. The popup says Not Authorized. Everything else works on the module.
Hi @toddmleleux ,
yep 7.0.2 is broken for running from module but should work okay for cron. The last person that modified the reminder script hard coded to cron and removed the user select for logged in user so, broke!
You try to use this patch Newly Improved Fax, SMS and Email Module - #6 by sjpadgett
or just to fix the version you’re on replace existing script interface/modules/custom_modules/oe-module-faxsms/library/rc_sms_notification.php with this file removed sjp
Thanks for the response. I have substituted the rc_sms_notification file. It works, however when running the code it will only send 1 text reminder at a time. I have to click send SMS reminder icon for each reminder. So if I have 50 scheduled appointments, the test will show how many are to be sent. But when I hit send sms it only sends one which requires me to hit it an additional 49 times until 0 reminders are remaining. Everything else works to my knowledge.
@toddmleleux
Sorry about that but it looks like I didn’t submit the latest version of the file in my PR but try the below.
I’ve tested both email and sms
Thanks for the help. The last rc_sms_notification.php file you provided does NOT fix the issue of only 1 reminder sent per click. perhaps there is another setting I am missing. Seems like it worked before for sending out multiple per click before the patch.
@toddmleleux
Are you sure file is saved in correct place? If windows ensure file save didn’t rename for duplicate.
Also be sure your appointment status hasn’t changed to SMS or EMAIL.
Clear browser cache.
I’m going to release a new module patch 9/7/24-9/9/24 that will give and option to start a background task to auto send either SMS and/or EMAIL notifications. I need to understand why this isn’t working for you where if necessary I can give you a debug version to help figure it out.
I’m going to send file again just to be sure. Only difference is I cleaned up some messages and getting ready to add status changes to recurring appointments. Please don’t wait days to report back so I can release a patch!: rc_sms_notification.php (16.3 KB)
Im using ubuntu 22LTS on aws server. Using sudo nano rc_sms_notifications.php i delete the contents and paste the new code from the file you provided. Unfortunately it still only sends 1 message at a time. When running the test it behaves like it would send the entire list. For hippa reasons i cannot incude a screenshot of the test. when actually running the script i get something to this effect. With each click of send, it incrementally decreases by 1 reminder.
Working and may take a few minutes to finish.
Total of: 58 Reminders Found and Sending for reminders 100 hrs from now.
One more while I have you working on this, I as the provider seem to be the only one that has privledges to run the command. I have changed other users to admin but still cannot get them to have the access to run the code.
For cron running batch script only clinician auth is required however running module, admin is required. I think I should revisit this for all my modules except setups! Why your admins aren’t working beats me.
Are they our default admin(super) or modified?
What module are you using RC or Twilio?
Are you sure batch run isn’t returning any errors? With new script they will show in result window but check error log.
Are any appointments recurring events? Shouldn’t matter except not setting status.
I’m still testing but this just works for me but not saying you don’t have an issue with the script however, I don’t see what it could be!
I don’t readily see an issue with nano cut and paste but verify the save and permissions.
I assume you’re not using docker or you’d said but please assure me.
I was able to view the error log and get this error when actually running the send SMS and not the test SMS. When running the test SMS i get the same expected results that you sent screenshots of.
[Thu Sep 05 12:34:25.820062 2024] [php:error] [pid 1921996] [client XXXXXXXX] PHP Fatal error: Uncaught TypeError: cron_UpdateEntry(): Return value must be of type int, ADORecordSet_empty returned in /var/www/XXXXXX/openemr/interface/modules/custom_modules/oe-module-faxsms/library/rc_sms_notification.php:301\nStack trace:\n#0 /var/www/XXXXXXXX/openemr/interface/modules/custom_modules/oe-module-faxsms/library/rc_sms_notification.php(200): cron_UpdateEntry(’…’, 569, 1122, 0)\n#1 {main}\n thrown in /var/www/XXXXXXXXX/openemr/interface/modules/custom_modules/oe-module-faxsms/library/rc_sms_notification.php on line 301, referer: https://www.XXXXXXXXX/interface/modules/custom_modules/oe-module-faxsms/messageUI.php?type=sms
I am not on docker. Lets clear this up and we can work on user access after to avoid clouding the response.
yep, let me recreate although the error should appear it your run window.
Looks like the error comes from setting appointment status which I patched out because all my sms account are disabled as getting sms accounts require having to report to government agencies violating my privacy so if this is how Twilio and RC want to bow to government restrictions, I won’t support. It’s the E.U that started all of this btw! Sorry for the little rant but how long are we going to allow government interventions into our privacy?
I should have this fixed quickly but still don’t understand why exception isn’t showing in you result window!
@toddmleleux
An easy fix use below new script or just edit your current by going to L-281 and remove the : int from function
function cron_UpdateEntry($type, $pid, $pc_eid, $recur = ''): int
To:
function cron_UpdateEntry($type, $pid, $pc_eid, $recur = '')
Sorry this on me by trying to follow newer PHP code requirements. I also found out that change to appointment status doesn’t clear the events notification flag preventing user to allow resenting notification. I’ll fix in my patch so look for the announcement. The patch is only for my modules and not a production patch.