minor translation project modification
[openemr.git] / library / classes / Provider.class.php
blobe298e0e546e3f2c41a924bb21aafa7823f38f734
1 <?php
2 /************************************************************************
3 prescription.php - Copyright duhlman
5 /usr/share/apps/umbrello/headings/heading.php
7 This file was generated on %date% at %time%
8 The original location of this file is /home/duhlman/uml-generated-code/prescription.php
9 **************************************************************************/
11 require_once("ORDataObject.class.php");
12 require_once("InsuranceNumbers.class.php");
13 /**
14 * class Provider
17 class Provider extends ORDataObject{
19 var $id;
20 var $lname;
21 var $fname;
22 var $federal_drug_id;
23 var $insurance_numbers;
24 var $specialty;
26 /**
27 * Constructor sets all Prescription attributes to their default value
29 function Provider ($id = "", $prefix = "") {
30 $this->id = $id;
31 $this->federal_drug_id = "";
32 $this->_table = "users";
33 $this->insurance_numbers = array();
34 if ($id != "") {
35 $this->populate();
39 function populate() {
40 $res = sqlQuery("SELECT fname,lname,federaldrugid, specialty FROM users where id =". mysql_real_escape_string($this->id));
42 if (is_array($res)) {
43 $this->lname = $res['lname'];
44 $this->fname = $res['fname'];
45 $this->federal_drug_id = $res['federaldrugid'];
46 $this->specialty = $res['specialty'];
49 $ins = new InsuranceNumbers();
50 $this->insurance_numbers = $ins->insurance_numbers_factory($this->id);
53 function utility_provider_array() {
54 $provider_array = array();
55 $res = sqlQ("Select id,fname,lname from users where authorized = 1");
56 while ($row = mysql_fetch_array($res) ) {
57 $provider_array[$row['id']] = $row['fname'] . " " . $row['lname'];
59 return $provider_array;
62 function providers_factory($sort = "ORDER BY lname,fname") {
63 $psa = array();
64 $sql = "SELECT id FROM " . $this->_table . " where authorized = 1 " . $sort;
65 $results = sqlQ($sql);
67 while($row = mysql_fetch_array($results) ) {
68 $psa[] = new Provider($row['id']);
71 return $psa;
74 function get_id() {
75 return $this->id;
78 function get_name_display() {
79 return $this->fname . " " . $this->lname;
82 function get_specialty() {
83 return $this->specialty;
86 function get_provider_number_default() {
87 if (!empty($this->insurance_numbers)) {
88 return $this->insurance_numbers[0]->get_provider_number();
92 function get_rendering_provider_number_default() {
93 if (!empty($this->insurance_numbers)) {
94 return $this->insurance_numbers[0]->get_rendering_provider_number();
98 function get_insurance_numbers() {
99 return $this->insurance_numbers;
101 function get_insurance_numbers_default() {
102 return $this->insurance_numbers[0];
105 function get_group_number_default() {
106 if (!empty($this->insurance_numbers)) {
107 return $this->insurance_numbers[0]->get_group_number();
111 } // end of Provider