2 require_once("DataObjectBase.class.php");
3 require_once("xmlrpc.inc");
5 class BillingContact
Extends DataObjectBase
{
7 function BillingContact() {
8 $this->_addFunc("firstname", array( "name" => "FreeB.FBBillingContact.FirstName",
9 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
11 $this->_addFunc("middlename", array( "name" => "FreeB.FBBillingContact.MiddleName",
12 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
14 $this->_addFunc("lastname", array( "name" => "FreeB.FBBillingContact.LastName",
15 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
17 $this->_addFunc("streetaddress", array( "name" => "FreeB.FBBillingContact.StreetAddress",
18 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
20 $this->_addFunc("city", array( "name" => "FreeB.FBBillingContact.City",
21 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
23 $this->_addFunc("state", array( "name" => "FreeB.FBBillingContact.State",
24 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
26 $this->_addFunc("zipcode", array( "name" => "FreeB.FBBillingContact.Zipcode",
27 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
29 $this->_addFunc("phonecountry", array( "name" => "FreeB.FBBillingContact.PhoneCountry",
30 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
32 $this->_addFunc("phoneextension", array( "name" => "FreeB.FBBillingContact.PhoneExtension",
33 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
35 $this->_addFunc("phonearea", array( "name" => "FreeB.FBBillingContact.PhoneArea",
36 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
38 $this->_addFunc("phonenumber", array( "name" => "FreeB.FBBillingContact.PhoneNumber",
39 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
45 function firstname($m) {
49 $obj= $m->getparam(0);
50 $key = $obj->getval();
52 $sql = "SELECT * FROM facility where billing_location = '1'";
54 $db = $GLOBALS['adodb']['db'];
55 $results = $db->Execute($sql);
58 $err = $db->ErrorMsg();
62 $retval = $results->fields
['attn'];
66 // if we generated an error, create an error return response
68 return $this->_handleError($err);
71 // otherwise, we create the right response
72 // with the state name
73 return new xmlrpcresp(new xmlrpcval($retval));
77 function middlename($m) {
81 //unimplemented by OpenEMR
84 // if we generated an error, create an error return response
86 return $this->_handleError($err);
89 // otherwise, we create the right response
90 // with the state name
91 return new xmlrpcresp(new xmlrpcval($pkey));
95 function lastname($m) {
99 //unimplemented by OpenEMR
102 // if we generated an error, create an error return response
104 return $this->_handleError($err);
107 // otherwise, we create the right response
108 // with the state name
109 return new xmlrpcresp(new xmlrpcval($pkey));
113 function streetaddress($m) {
117 //unimplemented by OpenEMR
120 // if we generated an error, create an error return response
122 return $this->_handleError($err);
125 // otherwise, we create the right response
126 // with the state name
127 return new xmlrpcresp(new xmlrpcval($pkey));
136 //unimplemented by OpenEMR
139 // if we generated an error, create an error return response
141 return $this->_handleError($err);
144 // otherwise, we create the right response
145 // with the state name
146 return new xmlrpcresp(new xmlrpcval($pkey));
154 //unimplemented by OpenEMR
157 // if we generated an error, create an error return response
159 return $this->_handleError($err);
162 // otherwise, we create the right response
163 // with the state name
164 return new xmlrpcresp(new xmlrpcval($pkey));
168 function zipcode($m) {
172 //unimplemented by OpenEMR
175 // if we generated an error, create an error return response
177 return $this->_handleError($err);
180 // otherwise, we create the right response
181 // with the state name
182 return new xmlrpcresp(new xmlrpcval($pkey));
186 function phonecountry($m) {
190 //unimplemented by OpenEMR
193 // if we generated an error, create an error return response
195 return $this->_handleError($err);
198 // otherwise, we create the right response
199 // with the state name
200 return new xmlrpcresp(new xmlrpcval($pkey));
204 function phoneextension($m) {
209 //unimplemented by OpenEMR
212 // if we generated an error, create an error return response
214 return $this->_handleError($err);
217 // otherwise, we create the right response
218 // with the state name
219 return new xmlrpcresp(new xmlrpcval($pkey));
223 function phonearea($m) {
227 $obj= $m->getparam(0);
228 $key = $obj->getval();
230 $sql = "SELECT * FROM facility where billing_location = '1'";
232 $db = $GLOBALS['adodb']['db'];
233 $results = $db->Execute($sql);
236 $err = $db->ErrorMsg();
239 if (!$results->EOF
) {
240 $retval = $results->fields
['phone'];
244 $phone_parts = array();
245 // preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
246 preg_match("/(\d\d\d)\D*(\d\d\d)\D*(\d\d\d\d)/",$retval,$phone_parts);
247 $retval = $phone_parts[1];
249 // if we generated an error, create an error return response
251 return $this->_handleError($err);
254 // otherwise, we create the right response
255 // with the state name
256 return new xmlrpcresp(new xmlrpcval($retval));
260 function phonenumber($m) {
264 $obj= $m->getparam(0);
265 $key = $obj->getval();
267 $sql = "SELECT * FROM facility where billing_location = '1'";
269 $db = $GLOBALS['adodb']['db'];
270 $results = $db->Execute($sql);
273 $err = $db->ErrorMsg();
276 if (!$results->EOF
) {
277 $retval = $results->fields
['phone'];
281 $phone_parts = array();
282 // preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
283 preg_match("/(\d\d\d)\D*(\d\d\d)\D*(\d\d\d\d)/",$retval,$phone_parts);
284 $retval = $phone_parts[2] . "-" . $phone_parts[3];
286 // if we generated an error, create an error return response
288 return $this->_handleError($err);
291 // otherwise, we create the right response
292 // with the state name
293 return new xmlrpcresp(new xmlrpcval($retval));
298 //'FreeB.FBBillingContact.FirstName' => \&FreeB_FBBillingContact_FirstName,
299 //'FreeB.FBBillingContact.MiddleName' => \&FreeB_FBBillingContact_MiddleName,
300 //'FreeB.FBBillingContact.LastName' => \&FreeB_FBBillingContact_LastName,
301 //'FreeB.FBBillingContact.StreetAddress' => \&FreeB_FBBillingContact_StreetAddress,
302 //'FreeB.FBBillingContact.City' => \&FreeB_FBBillingContact_City,
303 //'FreeB.FBBillingContact.State' => \&FreeB_FBBillingContact_State,
304 //'FreeB.FBBillingContact.Zipcode' => \&FreeB_FBBillingContact_Zipcode,
305 //'FreeB.FBBillingContact.PhoneCountry' => \&FreeB_FBBillingContact_PhoneCountry,
306 //'FreeB.FBBillingContact.PhoneExtension' => \&FreeB_FBBillingContact_PhoneExtension,
307 //'FreeB.FBBillingContact.PhoneArea' => \&FreeB_FBBillingContact_PhoneArea,
308 //'FreeB.FBBillingContact.PhoneNumber' => \&FreeB_FBBillingContact_PhoneNumber,