Clinic not saving in outlook calendar

omo66 wrote on Wednesday, November 19, 2008:

Hi,
Did anyone have problem saving or selecting a clinic from pop up window add-edit events ?

I have 2 locations A B, two clinics A B, the add-edit event pop up window drop menu shows A and B then accept the location B. When I go back and click on the time within outlook I found only clinic A is assigned instead of B.
is this a bug?

cfapress wrote on Wednesday, November 19, 2008:

Indeed there is some bug here!

After a brief inspection I believe I’ve found the cause. It comes in the add-edit event part of the code. You’re seeing the default clinic for the provider instead of the clinic chosen when the event was created. So this means your data is stored correctly but not displayed properly.

Here’s the quick-fix if you’re inclined to edit PHP code:
Open the file <oemr>/interface/main/calendar/add_edit_event.php
Go to line 835, you should see this code
//-------------------------------------
//(CHEMED)
//Set default facility for a new event based on the given ‘userid’
if ($userid) {
     $pref_facility = sqlFetchArray(sqlStatement(“SELECT facility_id, facility FROM users WHERE id = $userid”));
     $e2f = $pref_facility[‘facility_id’];
     $e2f_name = $pref_facility[‘facility’];
}
//END of CHEMED -----------------------

Prefix each line with two slashes like this //
Then save the file

Problem fixed.

Now I need to look into the code a little further to determine the logic behind this. Perhaps there was a good reason for this code snippet in the past and it’s just legacy code. In that case it can safely be removed. But maybe not. Maybe it’s well intentioned code that really belongs elsewhere in the file.

Jason

omo66 wrote on Thursday, November 20, 2008:

thank you Jason, this helped.
Another question for you:

The medications entry auto complete ( I believe you developed) does only find the spelling of the drug name but not dosage, strength etc…
I would like to click on one selection to fill out all boxes with remaining details.
Could you guide me where the AJAX and functions,database are?

Thanks again.

cfapress wrote on Thursday, November 20, 2008:

Hi Omar,

The auto-complete code I put together was to make drug name lookups easier. Nothing about dosages, quantity, etc. I believe what you’re asking for is something like a ‘favorite’ where you pick the drug from a list of frequently prescribed ones. I too would like to see something like that. Other EMR products offer a feature like that.

I just peeked into the code and indeed OpenEMR offers this sort of feature. I don’t believe it is turned on by default. I don’t have the time to look any deeper into this right now. Perhaps you’d like to?

The source code you should look at is:
<oemr>/templates/prescription/general_edit.html

If I were you, I’d take a look at the code around the variables:
DRUG_ARRAY_VALUES
SIMPLIFIED_PRESCRIPTIONS

When you scroll to the bottom of the file you’ll see the jQuery stuff I added for the type-and-lookup stuff.

Jason