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("firstname", array( "name" => "FreeB.FBProvider.FirstName",
18 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
20 $this->_addFunc("middlename", array( "name" => "FreeB.FBProvider.MiddleName",
21 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
23 $this->_addFunc("lastname", array( "name" => "FreeB.FBProvider.LastName",
24 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
26 $this->_addFunc("streetaddress", array( "name" => "FreeB.FBProvider.StreetAddress",
27 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
29 $this->_addFunc("city", array( "name" => "FreeB.FBProvider.City",
30 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
32 $this->_addFunc("state", array( "name" => "FreeB.FBProvider.State",
33 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
35 $this->_addFunc("zipcode", array( "name" => "FreeB.FBProvider.Zipcode",
36 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
38 $this->_addFunc("phonecountry", array( "name" => "FreeB.FBProvider.PhoneCountry",
39 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
41 $this->_addFunc("phoneextension", array( "name" => "FreeB.FBProvider.PhoneExtension",
42 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
44 $this->_addFunc("phonearea", array( "name" => "FreeB.FBProvider.PhoneArea",
45 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
47 $this->_addFunc("phonenumber", array( "name" => "FreeB.FBProvider.PhoneNumber",
48 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
52 function socialsecuritynumber($m) {
56 $obj= $m->getparam(0);
57 $key = $obj->getval();
59 $sql = "SELECT * FROM users where id = '" . $key . "'";
61 $db = $GLOBALS['adodb']['db'];
62 $results = $db->Execute($sql);
65 $err = $db->ErrorMsg();
69 $retval = $results->fields
['federaltaxid'];
73 // if we generated an error, create an error return response
75 return $this->_handleError($err);
78 // otherwise, we create the right response
79 // with the state name
80 return new xmlrpcresp(new xmlrpcval($retval,"string"));
88 $obj= $m->getparam(0);
89 $key = $obj->getval();
91 $sql = "SELECT * FROM users where id = '" . $key . "'";
93 $db = $GLOBALS['adodb']['db'];
94 $results = $db->Execute($sql);
97 $err = $db->ErrorMsg();
100 if (!$results->EOF
) {
101 $retval = $results->fields
['federaltaxid'];
106 // if we generated an error, create an error return response
108 return $this->_handleError($err);
111 // otherwise, we create the right response
112 // with the state name
113 return new xmlrpcresp(new xmlrpcval($retval,"string"));
121 $obj= $m->getparam(0);
122 $key = $obj->getval();
124 $sql = "SELECT * FROM users where id = '" . $key . "'";
126 $db = $GLOBALS['adodb']['db'];
127 $results = $db->Execute($sql);
130 $err = $db->ErrorMsg();
133 if (!$results->EOF
) {
134 $retval = $results->fields
['upin'];
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($retval,"string"));
150 function firstname($m) {
154 $obj= $m->getparam(0);
155 $key = $obj->getval();
157 $sql = "SELECT * FROM users where id = '" . $key . "'";
159 $db = $GLOBALS['adodb']['db'];
160 $results = $db->Execute($sql);
163 $err = $db->ErrorMsg();
166 if (!$results->EOF
) {
167 $retval = $results->fields
['fname'];
172 // if we generated an error, create an error return response
174 return $this->_handleError($err);
177 // otherwise, we create the right response
178 // with the state name
179 return new xmlrpcresp(new xmlrpcval($retval,"string"));
183 function middlename($m) {
187 $obj= $m->getparam(0);
188 $key = $obj->getval();
190 $sql = "SELECT * FROM users where id = '" . $key . "'";
192 $db = $GLOBALS['adodb']['db'];
193 $results = $db->Execute($sql);
196 $err = $db->ErrorMsg();
199 if (!$results->EOF
) {
200 $retval = $results->fields
['federaltaxid'];
205 // if we generated an error, create an error return response
207 return $this->_handleError($err);
210 // otherwise, we create the right response
211 // with the state name
212 return new xmlrpcresp(new xmlrpcval($pkey));
216 function lastname($m) {
220 $obj= $m->getparam(0);
221 $key = $obj->getval();
223 $sql = "SELECT * FROM users where id = '" . $key . "'";
225 $db = $GLOBALS['adodb']['db'];
226 $results = $db->Execute($sql);
229 $err = $db->ErrorMsg();
232 if (!$results->EOF
) {
233 $retval = $results->fields
['lname'];
238 // if we generated an error, create an error return response
240 return $this->_handleError($err);
243 // otherwise, we create the right response
244 // with the state name
245 return new xmlrpcresp(new xmlrpcval($retval,"string"));
249 function streetaddress($m) {
253 $obj= $m->getparam(0);
254 $key = $obj->getval();
256 $sql = "SELECT * FROM users where id = '" . $key . "'";
258 $db = $GLOBALS['adodb']['db'];
259 $results = $db->Execute($sql);
262 $err = $db->ErrorMsg();
265 if (!$results->EOF
) {
266 $retval = $results->fields
['facility'];
270 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
272 $db = $GLOBALS['adodb']['db'];
273 $results = $db->Execute($sql);
276 $err = $db->ErrorMsg();
279 if (!$results->EOF
) {
280 $retval = $results->fields
['street'];
285 // if we generated an error, create an error return response
287 return $this->_handleError($err);
290 // otherwise, we create the right response
291 // with the state name
292 return new xmlrpcresp(new xmlrpcval($retval,"string"));
301 $obj= $m->getparam(0);
302 $key = $obj->getval();
304 $sql = "SELECT * FROM users where id = '" . $key . "'";
306 $db = $GLOBALS['adodb']['db'];
307 $results = $db->Execute($sql);
310 $err = $db->ErrorMsg();
313 if (!$results->EOF
) {
314 $retval = $results->fields
['facility'];
318 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
320 $db = $GLOBALS['adodb']['db'];
321 $results = $db->Execute($sql);
324 $err = $db->ErrorMsg();
327 if (!$results->EOF
) {
328 $retval = $results->fields
['city'];
332 // if we generated an error, create an error return response
334 return $this->_handleError($err);
337 // otherwise, we create the right response
338 // with the state name
339 return new xmlrpcresp(new xmlrpcval($pkey));
347 $obj= $m->getparam(0);
348 $key = $obj->getval();
350 $sql = "SELECT * FROM users where id = '" . $key . "'";
352 $db = $GLOBALS['adodb']['db'];
353 $results = $db->Execute($sql);
356 $err = $db->ErrorMsg();
359 if (!$results->EOF
) {
360 $retval = $results->fields
['facility'];
364 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
366 $db = $GLOBALS['adodb']['db'];
367 $results = $db->Execute($sql);
370 $err = $db->ErrorMsg();
373 if (!$results->EOF
) {
374 $retval = $results->fields
['state'];
378 // if we generated an error, create an error return response
380 return $this->_handleError($err);
383 // otherwise, we create the right response
384 // with the state name
385 return new xmlrpcresp(new xmlrpcval($retval,"string"));
389 function zipcode($m) {
393 $obj= $m->getparam(0);
394 $key = $obj->getval();
396 $sql = "SELECT * FROM users where id = '" . $key . "'";
398 $db = $GLOBALS['adodb']['db'];
399 $results = $db->Execute($sql);
402 $err = $db->ErrorMsg();
405 if (!$results->EOF
) {
406 $retval = $results->fields
['facility'];
410 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
412 $db = $GLOBALS['adodb']['db'];
413 $results = $db->Execute($sql);
416 $err = $db->ErrorMsg();
419 if (!$results->EOF
) {
420 $retval = $results->fields
['postal_code'];
424 // if we generated an error, create an error return response
426 return $this->_handleError($err);
429 // otherwise, we create the right response
430 // with the state name
431 return new xmlrpcresp(new xmlrpcval($retval,"string"));
434 function phonecountry($m) {
440 // if we generated an error, create an error return response
442 return $this->_handleError($err);
445 // otherwise, we create the right response
446 // with the state name
447 return new xmlrpcresp(new xmlrpcval($pkey));
451 function phoneextension($m) {
455 //unimplmented by OpenEMR
458 // if we generated an error, create an error return response
460 return $this->_handleError($err);
463 // otherwise, we create the right response
464 // with the state name
465 return new xmlrpcresp(new xmlrpcval($pkey));
469 function phonearea($m) {
473 $obj= $m->getparam(0);
474 $key = $obj->getval();
476 $sql = "SELECT * FROM users where id = '" . $key . "'";
478 $db = $GLOBALS['adodb']['db'];
479 $results = $db->Execute($sql);
482 $err = $db->ErrorMsg();
485 if (!$results->EOF
) {
486 $retval = $results->fields
['facility'];
490 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
492 $db = $GLOBALS['adodb']['db'];
493 $results = $db->Execute($sql);
496 $err = $db->ErrorMsg();
499 if (!$results->EOF
) {
500 $retval = $results->fields
['phone'];
504 $phone_parts = array();
505 preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
506 $retval = $phone_parts[1];
508 // if we generated an error, create an error return response
510 return $this->_handleError($err);
513 // otherwise, we create the right response
514 // with the state name
515 return new xmlrpcresp(new xmlrpcval($retval,"string"));
519 function phonenumber($m) {
523 $obj= $m->getparam(0);
524 $key = $obj->getval();
526 $sql = "SELECT * FROM users where id = '" . $key . "'";
528 $db = $GLOBALS['adodb']['db'];
529 $results = $db->Execute($sql);
532 $err = $db->ErrorMsg();
535 if (!$results->EOF
) {
536 $retval = $results->fields
['facility'];
540 $sql = "SELECT * FROM facility where name = '" . $retval ."'";
542 $db = $GLOBALS['adodb']['db'];
543 $results = $db->Execute($sql);
546 $err = $db->ErrorMsg();
549 if (!$results->EOF
) {
550 $retval = $results->fields
['phone'];
554 $phone_parts = array();
555 preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
556 $retval = $phone_parts[2] . "-" . $phone_parts[3] ;
558 // if we generated an error, create an error return response
560 return $this->_handleError($err);
563 // otherwise, we create the right response
564 // with the state name
565 return new xmlrpcresp(new xmlrpcval($retval,"string"));
571 //'FreeB.FBProvider.SocialSecurityNumber' => \&FreeB_FBProvider_SocialSecurityNumber,
572 //'FreeB.FBProvider.TIN' => \&FreeB_FBProvider_TIN,
573 //'FreeB.FBProvider.IPN' => \&FreeB_FBProvider_IPN,
574 //'FreeB.FBProvider.FirstName' => \&FreeB_FBProvider_FirstName,
575 //'FreeB.FBProvider.MiddleName' => \&FreeB_FBProvider_MiddleName,
576 //'FreeB.FBProvider.LastName' => \&FreeB_FBProvider_LastName,
577 //'FreeB.FBProvider.StreetAddress' => \&FreeB_FBProvider_StreetAddress,
578 //'FreeB.FBProvider.City' => \&FreeB_FBProvider_City,
579 //'FreeB.FBProvider.State' => \&FreeB_FBProvider_State,
580 //'FreeB.FBProvider.Zipcode' => \&FreeB_FBProvider_Zipcode,
581 //'FreeB.FBProvider.PhoneCountry' => \&FreeB_FBProvider_PhoneCountry,
582 //'FreeB.FBProvider.PhoneExtension' => \&FreeB_FBProvider_PhoneExtension,
583 //'FreeB.FBProvider.PhoneNumber' => \&FreeB_FBProvider_PhoneNumber,
584 //'FreeB.FBProvider.PhoneArea' => \&FreeB_FBProvider_PhoneArea,