2 require_once("DataObjectBase.class.php");
3 require_once("xmlrpc.inc");
5 class Provider
Extends DataObjectBase
{
8 $this->_addFunc("socialsecuritynumber", array( "name" => "FreeB.FBProvider.SocialSecurityNumber",
9 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
11 $this->_addFunc("tin", array( "name" => "FreeB.FBProvider.TIN",
12 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
14 $this->_addFunc("ipn", array( "name" => "FreeB.FBProvider.IPN",
15 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
17 $this->_addFunc("npi", array( "name" => "FreeB.FBProvider.NPI",
18 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
20 $this->_addFunc("firstname", array( "name" => "FreeB.FBProvider.FirstName",
21 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
23 $this->_addFunc("middlename", array( "name" => "FreeB.FBProvider.MiddleName",
24 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
26 $this->_addFunc("lastname", array( "name" => "FreeB.FBProvider.LastName",
27 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
29 $this->_addFunc("streetaddress", array( "name" => "FreeB.FBProvider.StreetAddress",
30 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
32 $this->_addFunc("city", array( "name" => "FreeB.FBProvider.City",
33 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
35 $this->_addFunc("state", array( "name" => "FreeB.FBProvider.State",
36 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
38 $this->_addFunc("zipcode", array( "name" => "FreeB.FBProvider.Zipcode",
39 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
41 $this->_addFunc("phonecountry", array( "name" => "FreeB.FBProvider.PhoneCountry",
42 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
44 $this->_addFunc("phoneextension", array( "name" => "FreeB.FBProvider.PhoneExtension",
45 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
47 $this->_addFunc("phonearea", array( "name" => "FreeB.FBProvider.PhoneArea",
48 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
50 $this->_addFunc("phonenumber", array( "name" => "FreeB.FBProvider.PhoneNumber",
51 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
56 function socialsecuritynumber($m) {
57 // since this function is useless I will get the NPI number using this
60 $obj= $m->getparam(0);
61 $key = $obj->getval();
63 $sql = "SELECT * FROM users where id = '" . $key . "'";
65 $db = $GLOBALS['adodb']['db'];
66 $results = $db->Execute($sql);
69 $err = $db->ErrorMsg();
73 $retval = $results->fields
['npi'];
77 // if we generated an error, create an error return response
79 return $this->_handleError($err);
82 // otherwise, we create the right response
83 // with the state name
84 return new xmlrpcresp(new xmlrpcval($retval,"string"));
92 $obj= $m->getparam(0);
93 $key = $obj->getval();
95 $sql = "SELECT * FROM users where id = '" . $key . "'";
97 $db = $GLOBALS['adodb']['db'];
98 $results = $db->Execute($sql);
101 $err = $db->ErrorMsg();
104 if (!$results->EOF
) {
105 $retval = $results->fields
['federaltaxid'];
110 // if we generated an error, create an error return response
112 return $this->_handleError($err);
115 // otherwise, we create the right response
116 // with the state name
117 return new xmlrpcresp(new xmlrpcval($retval,"string"));
125 $obj= $m->getparam(0);
126 $key = $obj->getval();
128 $sql = "SELECT * FROM users where id = '" . $key . "'";
130 $db = $GLOBALS['adodb']['db'];
131 $results = $db->Execute($sql);
134 $err = $db->ErrorMsg();
137 if (!$results->EOF
) {
138 $retval = $results->fields
['upin'];
143 // if we generated an error, create an error return response
145 return $this->_handleError($err);
148 // otherwise, we create the right response
149 // with the state name
150 return new xmlrpcresp(new xmlrpcval($retval,"string"));
158 $obj= $m->getparam(0);
159 $key = $obj->getval();
161 $sql = "SELECT * FROM users where id = '" . $key . "'";
163 $db = $GLOBALS['adodb']['db'];
164 $results = $db->Execute($sql);
167 $err = $db->ErrorMsg();
170 if (!$results->EOF
) {
171 $retval = $results->fields
['npi'];
176 // if we generated an error, create an error return response
178 return $this->_handleError($err);
181 // otherwise, we create the right response
182 // with the state name
183 return new xmlrpcresp(new xmlrpcval($retval,"string"));
188 function firstname($m) {
192 $obj= $m->getparam(0);
193 $key = $obj->getval();
195 $sql = "SELECT * FROM users where id = '" . $key . "'";
197 $db = $GLOBALS['adodb']['db'];
198 $results = $db->Execute($sql);
201 $err = $db->ErrorMsg();
204 if (!$results->EOF
) {
205 $retval = $results->fields
['fname'];
210 // if we generated an error, create an error return response
212 return $this->_handleError($err);
215 // otherwise, we create the right response
216 // with the state name
217 return new xmlrpcresp(new xmlrpcval($retval,"string"));
221 function middlename($m) {
225 $obj= $m->getparam(0);
226 $key = $obj->getval();
228 $sql = "SELECT * FROM users where id = '" . $key . "'";
230 $db = $GLOBALS['adodb']['db'];
231 $results = $db->Execute($sql);
234 $err = $db->ErrorMsg();
237 if (!$results->EOF
) {
238 $retval = $results->fields
['federaltaxid'];
243 // if we generated an error, create an error return response
245 return $this->_handleError($err);
248 // otherwise, we create the right response
249 // with the state name
250 return new xmlrpcresp(new xmlrpcval($pkey));
254 function lastname($m) {
258 $obj= $m->getparam(0);
259 $key = $obj->getval();
261 $sql = "SELECT * FROM users where id = '" . $key . "'";
263 $db = $GLOBALS['adodb']['db'];
264 $results = $db->Execute($sql);
267 $err = $db->ErrorMsg();
270 if (!$results->EOF
) {
271 $retval = $results->fields
['lname'];
276 // if we generated an error, create an error return response
278 return $this->_handleError($err);
281 // otherwise, we create the right response
282 // with the state name
283 return new xmlrpcresp(new xmlrpcval($retval,"string"));
287 function streetaddress($m) {
291 $obj= $m->getparam(0);
292 $key = $obj->getval();
294 $sql = "SELECT * FROM users where id = '" . $key . "'";
296 $db = $GLOBALS['adodb']['db'];
297 $results = $db->Execute($sql);
300 $err = $db->ErrorMsg();
303 if (!$results->EOF
) {
304 $retval = $results->fields
['facility'];
308 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
310 $db = $GLOBALS['adodb']['db'];
311 $results = $db->Execute($sql);
314 $err = $db->ErrorMsg();
317 if (!$results->EOF
) {
318 $retval = $results->fields
['street'];
323 // if we generated an error, create an error return response
325 return $this->_handleError($err);
328 // otherwise, we create the right response
329 // with the state name
330 return new xmlrpcresp(new xmlrpcval($retval,"string"));
339 $obj= $m->getparam(0);
340 $key = $obj->getval();
342 $sql = "SELECT * FROM users where id = '" . $key . "'";
344 $db = $GLOBALS['adodb']['db'];
345 $results = $db->Execute($sql);
348 $err = $db->ErrorMsg();
351 if (!$results->EOF
) {
352 $retval = $results->fields
['facility'];
356 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
358 $db = $GLOBALS['adodb']['db'];
359 $results = $db->Execute($sql);
362 $err = $db->ErrorMsg();
365 if (!$results->EOF
) {
366 $retval = $results->fields
['city'];
370 // if we generated an error, create an error return response
372 return $this->_handleError($err);
375 // otherwise, we create the right response
376 // with the state name
377 return new xmlrpcresp(new xmlrpcval($pkey));
385 $obj= $m->getparam(0);
386 $key = $obj->getval();
388 $sql = "SELECT * FROM users where id = '" . $key . "'";
390 $db = $GLOBALS['adodb']['db'];
391 $results = $db->Execute($sql);
394 $err = $db->ErrorMsg();
397 if (!$results->EOF
) {
398 $retval = $results->fields
['facility'];
402 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
404 $db = $GLOBALS['adodb']['db'];
405 $results = $db->Execute($sql);
408 $err = $db->ErrorMsg();
411 if (!$results->EOF
) {
412 $retval = $results->fields
['state'];
416 // if we generated an error, create an error return response
418 return $this->_handleError($err);
421 // otherwise, we create the right response
422 // with the state name
423 return new xmlrpcresp(new xmlrpcval($retval,"string"));
427 function zipcode($m) {
431 $obj= $m->getparam(0);
432 $key = $obj->getval();
434 $sql = "SELECT * FROM users where id = '" . $key . "'";
436 $db = $GLOBALS['adodb']['db'];
437 $results = $db->Execute($sql);
440 $err = $db->ErrorMsg();
443 if (!$results->EOF
) {
444 $retval = $results->fields
['facility'];
448 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
450 $db = $GLOBALS['adodb']['db'];
451 $results = $db->Execute($sql);
454 $err = $db->ErrorMsg();
457 if (!$results->EOF
) {
458 $retval = $results->fields
['postal_code'];
462 // if we generated an error, create an error return response
464 return $this->_handleError($err);
467 // otherwise, we create the right response
468 // with the state name
469 return new xmlrpcresp(new xmlrpcval($retval,"string"));
472 function phonecountry($m) {
478 // if we generated an error, create an error return response
480 return $this->_handleError($err);
483 // otherwise, we create the right response
484 // with the state name
485 return new xmlrpcresp(new xmlrpcval($pkey));
489 function phoneextension($m) {
493 //unimplmented by OpenEMR
496 // if we generated an error, create an error return response
498 return $this->_handleError($err);
501 // otherwise, we create the right response
502 // with the state name
503 return new xmlrpcresp(new xmlrpcval($pkey));
507 function phonearea($m) {
511 $obj= $m->getparam(0);
512 $key = $obj->getval();
514 $sql = "SELECT * FROM users where id = '" . $key . "'";
516 $db = $GLOBALS['adodb']['db'];
517 $results = $db->Execute($sql);
520 $err = $db->ErrorMsg();
523 if (!$results->EOF
) {
524 $retval = $results->fields
['facility'];
528 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
530 $db = $GLOBALS['adodb']['db'];
531 $results = $db->Execute($sql);
534 $err = $db->ErrorMsg();
537 if (!$results->EOF
) {
538 $retval = $results->fields
['phone'];
542 $phone_parts = array();
543 // preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
544 preg_match("/(\d\d\d)\D*(\d\d\d)\D*(\d\d\d\d)/",$retval,$phone_parts);
545 $retval = $phone_parts[1];
547 // if we generated an error, create an error return response
549 return $this->_handleError($err);
552 // otherwise, we create the right response
553 // with the state name
554 return new xmlrpcresp(new xmlrpcval($retval,"string"));
558 function phonenumber($m) {
562 $obj= $m->getparam(0);
563 $key = $obj->getval();
565 $sql = "SELECT * FROM users where id = '" . $key . "'";
567 $db = $GLOBALS['adodb']['db'];
568 $results = $db->Execute($sql);
571 $err = $db->ErrorMsg();
574 if (!$results->EOF
) {
575 $retval = $results->fields
['facility'];
579 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
581 $db = $GLOBALS['adodb']['db'];
582 $results = $db->Execute($sql);
585 $err = $db->ErrorMsg();
588 if (!$results->EOF
) {
589 $retval = $results->fields
['phone'];
593 $phone_parts = array();
594 // preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
595 preg_match("/(\d\d\d)\D*(\d\d\d)\D*(\d\d\d\d)/",$retval,$phone_parts);
596 $retval = $phone_parts[2] . "-" . $phone_parts[3] ;
598 // if we generated an error, create an error return response
600 return $this->_handleError($err);
603 // otherwise, we create the right response
604 // with the state name
605 return new xmlrpcresp(new xmlrpcval($retval,"string"));
613 //'FreeB.FBProvider.SocialSecurityNumber' => \&FreeB_FBProvider_SocialSecurityNumber,
614 //'FreeB.FBProvider.TIN' => \&FreeB_FBProvider_TIN,
615 //'FreeB.FBProvider.IPN' => \&FreeB_FBProvider_IPN,
616 //'FreeB.FBProvider.NPI' => \&FreeB_FBProvider_NPI,
617 //'FreeB.FBProvider.FirstName' => \&FreeB_FBProvider_FirstName,
618 //'FreeB.FBProvider.MiddleName' => \&FreeB_FBProvider_MiddleName,
619 //'FreeB.FBProvider.LastName' => \&FreeB_FBProvider_LastName,
620 //'FreeB.FBProvider.StreetAddress' => \&FreeB_FBProvider_StreetAddress,
621 //'FreeB.FBProvider.City' => \&FreeB_FBProvider_City,
622 //'FreeB.FBProvider.State' => \&FreeB_FBProvider_State,
623 //'FreeB.FBProvider.Zipcode' => \&FreeB_FBProvider_Zipcode,
624 //'FreeB.FBProvider.PhoneCountry' => \&FreeB_FBProvider_PhoneCountry,
625 //'FreeB.FBProvider.PhoneExtension' => \&FreeB_FBProvider_PhoneExtension,
626 //'FreeB.FBProvider.PhoneNumber' => \&FreeB_FBProvider_PhoneNumber,
627 //'FreeB.FBProvider.PhoneArea' => \&FreeB_FBProvider_PhoneArea,