Pharmacy not saving in Browser Chrome(Only)

zhhealthcare wrote on Thursday, August 12, 2010:

There is a potential bug in saving Pharmacy data when Chrome browser is used.
It occurs when we insert data.

Issue Explained

Use Browser Chrome.
Browse to Administration->Practice
Click “Add a Pharmacy” button
Enter the details and save.The Pharmacy listing page comes but the newly entered data is not present.
For the case of modification the same issue is there.

But if we do the same process with Mozilla Firefox or Internet Explorer(IE) the issue is not there.

This is the case with the following.
1)Insurance Companies(add,edit)
2)Insurance Numbers(add only)
3)X12 Partners(add,edit)

Cause of Issue

File templates/pharmacies/general_edit.html has got 3 lines starting at line number 73

document.pharmacy.submit();
Waittoredirect(500);
this.location.href="{/literal}{$WEB_ROOT}{literal}/controller.php?practice_settings&pharmacy&action=list";

After submition, page is redirected.Firefox and IE does as written.Chrome browser redirects without submitting.

Solution

Removed the following 2 lines

Waittoredirect(500);
this.location.href="{/literal}{$WEB_ROOT}{literal}/controller.php?practice_settings&pharmacy&action=list";

Added in file controllers/C_Pharmacy.class.php, a line of redirection at line number 70.

header(‘Location:’.$GLOBALS."/controller.php?" . “practice_settings&pharmacy&action=list”);

In short the redirection will only happen after the data is saved.

Another one is that when enter key is pressed the page gets submitted.
That issue is also only for Chrome.
onKeyDown=“PreventIt(event)” is written in each text box.
Function is defined in library/js/common.js
The same is written below.

function PreventIt(evt)//Specially for chrome.
{
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 13)//enter key
{
if (evt.preventDefault) evt.preventDefault();
if (evt.stopPropagation) evt.stopPropagation();
}
}


Corrected all the pages in Administration->Practice link.
Need to check other areas whether this issue is there.

The corrected files and the patch can be got at the link
https://sourceforge.net/tracker/?func=detail&atid=493001&aid=3041929&group_id=60081

Would like to here from you whether Iam in the correct way.

Paul
Z&H Healthcare Solutions, LLC.