OpenEMR-4.2.0

cmswest wrote on Sunday, January 04, 2015:

The offending code is here. Since the number above is 11 characters it’s not addressed.

The phone_numbers table is provincial. See attached.

Brady’s reference to a simple fix above is Fermatesque. Maybe the table could take on this rough shape?

id int(11) No 0
phone_number varchar(255) Yes NULL
fax_number varchar(255) Yes NULL
type int(11) Yes NULL
foreign_id

fsgl wrote on Monday, January 05, 2015:

If the phone numbers in Demographics have 255 characters, why are they shortchanged in the phone_numbers table?

Maybe not such a great, big Gordian Knot after all. (Had to look up Fermat’s Last Theorem.)

Stephen, the good people of Kuala Lumpur & I thank you for taking the sword to the Knot.

bradymiller wrote on Monday, January 05, 2015:

Agree that simple fix is very unlikely. Is there even a way to make the current unwieldy table work? Any thoughts from other developers?
-brady
OpenEMR

sunsetsystems wrote on Monday, January 05, 2015:

The table could be made to work by lengthening one of more of the columns. I suspect the best way to store them is with one field for country code, and another field for all the other digits.

Formatting conventions for display (and data entry) of phone numbers vary greatly by country and even within countries. See:

Perhaps there’s already a library somewhere to help with that.

Rod
http://www.sunsetsystems.com/

cmswest wrote on Monday, January 05, 2015:

hi Rod, nice call

fsgl wrote on Monday, January 05, 2015:

Why is it necessary to store insurer phone numbers in a separate table?

Why is it not possible to add a phone_numbers column, with the structure like that in patient_data (essentially dealing only with type & collation)?

Is the code change so difficult to re-route data from a table with 7 columns into a single column of patient_data?

If it can be accomplished; it will function as a “free form”, wherein the user can determine the grouping of area code, exchange & line number simply by the placement of the hyphen.

This would obviate the need for libraries. Do we have libraries for the phone numbers in patient_data?

cmswest wrote on Monday, January 05, 2015:

There’s also that pesky addresses table too. It looks like they are vestigial and also play a role for pharmacies.

A search for phone_numbers on GitHub yields 11 results. These would have to be tracked down and updated. Maybe shoot for incorporating a library for internationalization down the road when there aren’t bigger fish to fry?

here’s my hack for Kuala Lumpur, it works off the offending code link posted earlier:

    function get_phone_display() {
            if ($this->country_code == 60) {
                    return substr($this->area_code,0,1) . "-" . substr($this->area_code,1,1) . $this->prefix . "-" . $this->number;
                    } 
            elseif (is_numeric($this->area_code) && is_numeric($this->prefix) && is_numeric($this->number)) {
                    // return  "(" . $this->area_code . ") " . $this->prefix . "-" . $this->number;
                    return  $this->area_code . "-" . $this->prefix . "-" . $this->number;
            }
            return "";
    }


    function set_phone($num) {
     


            elseif (strlen($num) == 11) {   
               
                    $this->country_code = "+60";
                    fwrite($file, $current);
                    fwrite($file, print_r($nums, TRUE));
                            if (count($nums) == 3) {
                            $this->area_code = $nums[0] . substr($nums[1],0,1);
                            $this->prefix = substr($nums[1],1,3);
                            $this->number = $nums[2];
                    }