2 require_once("DataObjectBase.class.php");
3 require_once("xmlrpc.inc");
5 class ClearingHouse
Extends DataObjectBase
{
7 function ClearingHouse() {
8 $this->_addFunc("name", array( "name" => "FreeB.FBClearingHouse.Name",
9 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCSTRING
),
11 $this->_addFunc("streetaddress", array( "name" => "FreeB.FBClearingHouse.StreetAddress",
12 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
14 $this->_addFunc("city", array( "name" => "FreeB.FBClearingHouse.City",
15 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
17 $this->_addFunc("state", array( "name" => "FreeB.FBClearingHouse.State",
18 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
20 $this->_addFunc("zipcode", array( "name" => "FreeB.FBClearingHouse.Zipcode",
21 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
23 $this->_addFunc("phonecountry", array( "name" => "FreeB.FBClearingHouse.PhoneCountry",
24 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
26 $this->_addFunc("phoneextension", array( "name" => "FreeB.FBClearingHouse.PhoneExtension",
27 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
29 $this->_addFunc("phonearea", array( "name" => "FreeB.FBClearingHouse.PhoneArea",
30 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
32 $this->_addFunc("phonenumber", array( "name" => "FreeB.FBClearingHouse.PhoneNumber",
33 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
35 $this->_addFunc("etin", array( "name" => "FreeB.FBClearingHouse.ETIN",
36 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCSTRING
),
38 $this->_addFunc("x12gsreceiverid", array( "name" => "FreeB.FBClearingHouse.X12GSReceiverID",
39 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCSTRING
),
41 $this->_addFunc("x12gssenderid", array( "name" => "FreeB.FBClearingHouse.X12GSSenderID",
42 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCSTRING
),
44 $this->_addFunc("x12gsversionstring", array( "name" => "FreeB.FBClearingHouse.X12GSVersionString",
45 "sig" => array(XMLRPCSTRING
, XMLRPCINT
),
54 //val zero is deprecated and is the facility identifier
55 //val two should be the procedure key, or put another way an id in the billing able
56 //trim due to ugly perl string cast hack
57 $obj= $m->getparam(1);
58 $key = trim($obj->getval());
60 $db = $GLOBALS['adodb']['db'];
62 $sql = "SELECT x.name FROM billing as b LEFT JOIN x12_partners as x on x.id = b.x12_partner_id where b.id= " .$db->qstr($key) ;
65 $results = $db->Execute($sql);
69 $err = $db->ErrorMsg();
73 $retval = $results->fields
['name'];
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));
88 function streetaddress($m) {
92 $obj= $m->getparam(0);
93 $key = $obj->getval();
95 $sql = "SELECT * FROM facility where billing_location = '1'";
97 $db = $GLOBALS['adodb']['db'];
98 $results = $db->Execute($sql);
101 $err = $db->ErrorMsg();
104 if (!$results->EOF
) {
105 $retval = $results->fields
['street'];
108 // if we generated an error, create an error return response
110 return $this->_handleError($err);
113 // otherwise, we create the right response
114 // with the state name
115 return new xmlrpcresp(new xmlrpcval($retval));
124 $obj= $m->getparam(0);
125 $key = $obj->getval();
127 $sql = "SELECT * FROM facility where billing_location = '1'";
129 $db = $GLOBALS['adodb']['db'];
130 $results = $db->Execute($sql);
133 $err = $db->ErrorMsg();
136 if (!$results->EOF
) {
137 $retval = $results->fields
['city'];
141 // if we generated an error, create an error return response
143 return $this->_handleError($err);
146 // otherwise, we create the right response
147 // with the state name
148 return new xmlrpcresp(new xmlrpcval($retval));
155 $obj= $m->getparam(0);
156 $key = $obj->getval();
158 $sql = "SELECT * FROM facility where billing_location = '1'";
160 $db = $GLOBALS['adodb']['db'];
161 $results = $db->Execute($sql);
164 $err = $db->ErrorMsg();
167 if (!$results->EOF
) {
168 $retval = $results->fields
['state'];
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));
183 function zipcode($m) {
187 $obj= $m->getparam(0);
188 $key = $obj->getval();
190 $sql = "SELECT * FROM facility where billing_location = '1'";
192 $db = $GLOBALS['adodb']['db'];
193 $results = $db->Execute($sql);
196 $err = $db->ErrorMsg();
199 if (!$results->EOF
) {
200 $retval = $results->fields
['postal_code'];
204 // if we generated an error, create an error return response
206 return $this->_handleError($err);
209 // otherwise, we create the right response
210 // with the state name
211 return new xmlrpcresp(new xmlrpcval($retval));
214 function phonecountry($m) {
220 // if we generated an error, create an error return response
222 return $this->_handleError($err);
225 // otherwise, we create the right response
226 // with the state name
227 return new xmlrpcresp(new xmlrpcval($pkey));
231 function phoneextension($m) {
237 // if we generated an error, create an error return response
239 return $this->_handleError($err);
242 // otherwise, we create the right response
243 // with the state name
244 return new xmlrpcresp(new xmlrpcval($pkey));
248 function phonearea($m) {
252 $obj= $m->getparam(0);
253 $key = $obj->getval();
255 $sql = "SELECT * FROM facility where billing_location = '1'";
257 $db = $GLOBALS['adodb']['db'];
258 $results = $db->Execute($sql);
261 $err = $db->ErrorMsg();
264 if (!$results->EOF
) {
265 $retval = $results->fields
['phone'];
269 $phone_parts = array();
270 preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
271 $retval = $phone_parts[1];
273 // if we generated an error, create an error return response
275 return $this->_handleError($err);
278 // otherwise, we create the right response
279 // with the state name
280 return new xmlrpcresp(new xmlrpcval($retval));
283 function phonenumber($m) {
287 $obj= $m->getparam(0);
288 $key = $obj->getval();
290 $sql = "SELECT * FROM facility where billing_location = '1'";
292 $db = $GLOBALS['adodb']['db'];
293 $results = $db->Execute($sql);
296 $err = $db->ErrorMsg();
299 if (!$results->EOF
) {
300 $retval = $results->fields
['phone'];
304 $phone_parts = array();
305 preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
306 $retval = $phone_parts[2] . "-" . $phone_parts[3];
308 // if we generated an error, create an error return response
310 return $this->_handleError($err);
313 // otherwise, we create the right response
314 // with the state name
315 return new xmlrpcresp(new xmlrpcval($retval));
322 //val zero is deprecated and is the facility identifier
323 //val two should be the procedure key, or put another way an id in the billing able
324 //trim due to ugly perl string cast hack
325 $obj= $m->getparam(1);
326 $key = trim($obj->getval());
328 $db = $GLOBALS['adodb']['db'];
330 $sql = "SELECT x.id_number FROM billing as b LEFT JOIN x12_partners as x on x.id = b.x12_partner_id where b.id= " .$db->qstr($key) ;
333 $results = $db->Execute($sql);
337 $err = $db->ErrorMsg();
340 if (!$results->EOF
) {
341 $retval = $results->fields
['id_number'];
345 // if we generated an error, create an error return response
347 return $this->_handleError($err);
350 // otherwise, we create the right response
351 // with the state name
352 return new xmlrpcresp(new xmlrpcval($retval));
355 function x12gsreceiverid($m) {
359 //val zero is deprecated and is the facility identifier
360 //val two should be the procedure key, or put another way an id in the billing able
361 //trim due to ugly perl string cast hack
362 $obj= $m->getparam(1);
363 $key = trim($obj->getval());
365 $db = $GLOBALS['adodb']['db'];
367 $sql = "SELECT x.x12_receiver_id FROM billing as b LEFT JOIN x12_partners as x on x.id = b.x12_partner_id where b.id= " .$db->qstr($key) ;
370 $results = $db->Execute($sql);
374 $err = $db->ErrorMsg();
377 if (!$results->EOF
) {
378 $retval = $results->fields
['x12_receiver_id'];
382 while (strlen($retval) < 15) {
386 // if we generated an error, create an error return response
388 return $this->_handleError($err);
391 // otherwise, we create the right response
392 // with the state name
393 return new xmlrpcresp(new xmlrpcval($retval));
397 function x12gssenderid($m) {
401 //val zero is deprecated and is the facility identifier
402 //val two should be the procedure key, or put another way an id in the billing able
403 //trim due to ugly perl string cast hack
404 $obj= $m->getparam(1);
405 $key = trim($obj->getval());
407 $db = $GLOBALS['adodb']['db'];
409 $sql = "SELECT x.x12_sender_id FROM billing as b LEFT JOIN x12_partners as x on x.id = b.x12_partner_id where b.id= " .$db->qstr($key) ;
412 $results = $db->Execute($sql);
416 $err = $db->ErrorMsg();
419 if (!$results->EOF
) {
420 $retval = $results->fields
['x12_sender_id'];
424 while (strlen($retval) < 15) {
427 // if we generated an error, create an error return response
429 return $this->_handleError($err);
432 // otherwise, we create the right response
433 // with the state name
434 return new xmlrpcresp(new xmlrpcval($retval));
439 function x12gsversionstring($m) {
443 //val zero is deprecated and is the facility identifier
444 $obj= $m->getparam(0);
445 $key = $obj->getval();
447 $db = $GLOBALS['adodb']['db'];
449 $sql = "SELECT x.x12_version FROM billing AS b LEFT JOIN x12_partners as x ON x.id = b.x12_partner_id WHERE b.id= ".$db->qstr($key);
452 $results = $db->Execute($sql);
456 $err = $db->ErrorMsg();
459 if (!$results->EOF
) {
460 $retval = $results->fields
['x12_version'];
463 // if we generated an error, create an error return response
465 return $this->_handleError($err);
468 // otherwise, we create the right response
469 // with the state name
470 return new xmlrpcresp(new xmlrpcval($retval));
476 //'FreeB.FBClearingHouse.Name' => \&FreeB_FBClearingHouse_Name,
477 //'FreeB.FBClearingHouse.StreetAddress' => \&FreeB_FBClearingHouse_StreetAddress,
478 //'FreeB.FBClearingHouse.City' => \&FreeB_FBClearingHouse_City,
479 //'FreeB.FBClearingHouse.State' => \&FreeB_FBClearingHouse_State,
480 //'FreeB.FBClearingHouse.Zipcode' => \&FreeB_FBClearingHouse_Zipcode,
481 //'FreeB.FBClearingHouse.PhoneCountry' => \&FreeB_FBClearingHouse_PhoneCountry,
482 //'FreeB.FBClearingHouse.PhoneExtension' => \&FreeB_FBClearingHouse_PhoneExtension,
483 //'FreeB.FBClearingHouse.PhoneArea' => \&FreeB_FBClearingHouse_PhoneArea,
484 //'FreeB.FBClearingHouse.PhoneNumber' => \&FreeB_FBClearingHouse_PhoneNumber,
485 //'FreeB.FBClearingHouse.ETIN' => \&FreeB_FBClearingHouse_ETIN,
486 //'FreeB.FBClearingHouse.X12GSReceiverID' => \&FreeB_FBClearingHouse_X12GSReceiverID,
487 //'FreeB.FBClearingHouse.X12GSSenderID' => \&FreeB_FBClearingHouse_X12GSSenderID,