Country field for address book, insurance & pharmacies, users

Hi OEMR from me and our furry :dog2: :cat2: :racehorse: :dromedary_camel: :rabbit2: ,

Is it a lot of work to introduce country fields to the address book/entry form, insurance companies, and pharmacies?
Our vet clinic is located near 2 borders, which means we have customers+addresses/users in 3 (+) countries. Clients no problem there, but the rest…
Just to name a few of our contacts : Belgian, German + Dutch providers, Swiss and German insurance co, Pharmacies in Netherlands, Belgium, Germany and Switzerland, In our European situation it has become quite common to order medication from abroad, and the insurance market was opened up years ago for companies abroad, not just the client’s home country. Doctors and staff come from 3 countries.
Very unusual for the USA maybe (or don’t you have clinics near the Canadian or Mexican border that do the same? just curious…)
I noticed that the adresses table of Pharmacies and Insurances always defaults to USA but I didn’t enter that anywhere…
I realize that I am not the first one to bring this up :blush:, found another thread in 2015 but that doesn’t solve the problem.

Thanks and keep up the good work.
Roland
Hope it doesn’t take too much development time if you decide to help me…

Hi @roland

To include countries of your choice in Demographics, follow these steps.

  1. Under Administration -> Lists -> select “Country” from the available list
  2. Add/Remove the list of countries that you want (Make sure to enable the “Active box”) and click on save.
  3. Now this newly update list will be available in the “Country” dropdown in the “Demographics” page.

Check this approach and let us know if this helps you.

Thanks,
ViSolve

Hi @visolveemr,

Thank you, but that was not my question. I know country dropdown works and how to fill in the list. Problem is that apart from the Demographics form the country field is not used anywhere.

  1. In Administration -> Practice -> add/edit a Pharmacy form is without a country field.

  2. In Administration -> Practice -> add/edit an Insurance Company form is without a country field.

  3. Neither in Administration -> Address Book -> Add new edit form - no country field

  4. In the Address Book itself there is no country column displayed

Strangely enough there is a country column in the addresses table in the database. It’s just not used in the above mentioned forms. So now both my pharmacies in the Netherlands and in Belgium country field read “USA”. This causes issues with claims etc. I have no possibility to edit that in the settings for Practice nor in Address Book, and this value is not shown to me in any of the above forms.

Hope you see my problem. Seems like It requires some changes in the code…

Thanks
Roland

Hi,
Sounds like a needed feature. This shouldn’t be too tough of a development project. If anybody’s willing to take this on, I’d am always glad to provide guidance.
-brady

Hello Brady,

I already have this in my test set up so I will submit the code ASAP.

Regards,

epsdky.

1 Like

Hello @Roland,

You can prevent the string ‘USA’ from being written to the country column in the addresses table when data from…

Admin > Practice > Pharmacies > Add a Pharmacy

or

Admin > Practice > Insurance Companies > Add a Company

is saved by modifying the following file…

library/classes/Address.class.php

(with a code editor)

by changing "USA" to "" in line 40.

1 Like

Hello @Roland,

(These mods apply to OpenEMR version 5.0.0)

To add a country field to the forms in…

Admin > Practice > Pharmacies

need to modify…

templates/pharmacies/general_edit.html

by adding the following code between lines 29 and 30…

<tr>
    <td VALIGN="MIDDLE" >{xl t='Country'}</td>
    <td VALIGN="MIDDLE" >
        <input type="text" size="40" name="country" value="{$pharmacy->address->country}" onKeyDown="PreventIt(event)" />
    </td>
</tr>

and also need to modify…

library/classes/Pharmacy.class.php

by adding the following code between lines 87 and 89…

function set_country($country) {
    $this->address->set_country($country);
}

Hello @Roland,

(These mods apply to OpenEMR version 5.0.0)

To add a country field to the forms in…

Admin > Practice > Insurance Companies

need to modify…

templates/insurance_companies/general_edit.html

by adding the following code between lines 58 and 59…

<tr>
    <td VALIGN="MIDDLE" >{xl t='Country'}</td>
    <td VALIGN="MIDDLE" >
        <input type="text" size="40" name="country" value="{$insurancecompany->address->country}" onKeyDown="PreventIt(event)" />
    </td>
</tr>

and also need to modify…

library/classes/InsuranceCompany.class.php

by adding the following code between lines 185 and 186

function set_country($country) {
    $this->address->set_country($country);
}

@brady.miller

hi Brady,
thanks, it would really solve some issues, & I won’t have to mess with the code with every update…
sorry for the late reply, we got caught on the German seaside in the biggest storm I’ve ever seen, no electricity, no internet and the mobile network overloaded…

@epsdky

Hi,

Thank you so much for this. I could solve most of the problem with your help. My reply is a bit late because we were caught in a huge storm in northern Germany in seaside cottage (electricity cut off, no internet, and no trains to go home) :slightly_frowning_face: . We had to stay at the veterinary conference for much longer than planned.
Today (Friday the 13th… :fearful:) I changed all the code lines and it works…(in spite of the date)

Still the address book has no country column, and the new/edit address book entry form don’have a country field either. Could you point me to the files that control that?
Thanks very much for helping me so far
-Roland

Hello @roland,

  1. To add a new field in Addr Book, You need to make changes in the following file
    interface/usergroup/addrbook_edit.php
  2. Addr Book data are saved in the users table. You need to add a new column in the users table to save the data.

Thanks,
ViSolve

@visolveemr,

Hello Visolve,
thanks for pointing me to the files. I am no developer, but I think I can get it to work, copying and pasting some of the code. It seems like the users table will need two new columns (country 1 and 2) for the two address sets, or am I overdoing things again?
I’ll give it a try, when it doesn’t do what I want I’ll get back to you with more questions…
thanks
Roland

@roland Sure. Please let us know if you have more questions.

Thanks,
ViSolve

@visolveemr, @epsdky, @brady.miller,

Well, gentlemen (no lady developers?)… thank you very much, I changed all you told me to plus 3 more

  • templates/pharmacies/general_list.html
  • templates/insurance_companies/general_list.html
  • interface/usergroup/address_book_list.php

so now OpenEMR 5.01-dev shows countries everywhere in a consistent way. :gift::kiss::kiss::bouquet::bouquet: from the front office staff, they’re happy again.
no more questions on this subject
-Roland

1 Like

hi @roland ,

Sounds like we need to get your fixes into the main codebase :slight_smile:

-brady

1 Like