"Undo Checkout" sometimes fails to load dialog box (dlgopen() issue?)

Situation

In the ‘Checkout’ submenu under ‘Fees’ pressing the ‘undo checkout’ link fails to load the following dialog box:
image

It goes from this:


To this:

But the dialog box never loads, and thus we can’t undo a checkout currently.

Two workarounds that seems to work are:

  1. right clicking and selecting ‘reload frame’ seems to work, but it usually needs to be done more than once. After a few reloads, the dialog box appears upon clicking ‘undo checkout’.
  2. Without fail, after opening chrome dev tools the dialog box appears upon clicking ‘undo checkout’.

My thinking so far is:

  • Perhaps this is an issue with the dlgopen() function here, which is located in dialog.js:
        function deleteme() {
         dlgopen('deleter.php?billing=' + <?php echo js_url($patient_id.".".$encounter); ?> + '&csrf_token_form=' + <?php echo js_url(CsrfUtils::collectCsrfToken()); ?>, '_blank', 500, 450);
         return false;
        }

I’ve tried remove the console.log calls in the function (thinking that dev tools works because console is open), but that had no effect. Perhaps it is a caching issue with ajax and XMLHttpRequest? Though I’m not sure how to approach that, and clearing cache hasn’t seemed to have an effect.

Here is what my dev tool console shows (upon successful loading of the dialog box, because the dialog box always loads when dev tools is open):

As you can see, there is a deprecation error there regarding XMLHttpRequest.

dialog.js?v=:130 Needed to load:[ /openemr/public/assets/bootstrap-3-3-4/dist/css/bootstrap.min.css ] For: [ http://medconsultemr.com/openemr/interface/patient_file/pos_checkout.php?framed=1 ]
dialog.js?v=:134 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
includeScript @ dialog.js?v=:134
(anonymous) @ dialog.js?v=:302
j @ index.js:2
k @ index.js:2
setTimeout (async)
(anonymous) @ index.js:2
i @ index.js:2
add @ index.js:2
(anonymous) @ index.js:2
Deferred @ index.js:2
then @ index.js:2
r.fn.ready @ index.js:2
r.fn.init @ index.js:2
r @ index.js:2
dlgopen @ dialog.js?v=:279
deleteme @ pos_checkout.php?framed=1:80
onclick @ pos_checkout.php?framed=1:154
dialog.js?v=:144 Needed to load:[ /openemr/public/assets/bootstrap-3-3-4/dist/js/bootstrap.min.js ] For: [ http://medconsultemr.com/openemr/interface/patient_file/pos_checkout.php?framed=1 ]
dialog.js?v=:144 Needed to load:[ /openemr/public/assets/jquery-ui-1-12-1/jquery-ui.min.js ] For: [ http://medconsultemr.com/openemr/interface/patient_file/pos_checkout.php?framed=1 ]
dialog.js?v=:709 Modal loaded and sized! Content:338 Viewport:338 Modal height:100.0000vh Max height:96vh isHeader:False  isFooter:False

Thanks in advance.

OpenEMR Version
I’m using OpenEMR version 5.0.1 patch 7 (latest)

Browser:
I’m using: Chrome, latest version.

Operating System
I’m using: Windows 10 64bit

Logs
No errors showing in the apache error log.

I’ve replaced dlgopen() with the legacy dlgOpenWindow() which resolved the issue, so it’s definitely to do with dlgopen.

I’ve submitted an issue on GitHub here: