improvements to test suite to allow it to run from a clean repository
[openemr.git] / library / classes / X12Partner.class.php
blobaafe5cd38277884fd3fa4e7d0275bb571af64af0
1 <?php
2 require_once("ORDataObject.class.php");
4 /**
5 * class X12Partner
7 */
9 class X12Partner extends ORDataObject{
11 var $id;
12 var $name;
13 var $id_number;
14 var $x12_sender_id; // ISA06
15 var $x12_receiver_id; // ISA08
16 var $x12_isa05; // Sender Interchange ID Qualifier. ZZ = mutually defined, 01 = Duns, etc.
17 var $x12_isa07; // Receiver Interchange ID Qualifier.
18 var $x12_isa14; // Acknowledgment Requested. 0 = No, 1 = Yes.
19 var $x12_isa15; // Usage Indicator. T = testing, P = production.
20 var $x12_gs02; // Application Sender's Code. Default to ISA06.
21 var $x12_per06; // The submitter's EDI Access Number, if any.
22 var $x12_version;
23 var $processing_format;
24 var $processing_format_array;
26 /**
27 * Constructor sets all Insurance attributes to their default value
30 function X12Partner ($id = "", $prefix = "") {
31 parent::ORDataObject();
32 $this->id = $id;
33 $this->_table = "x12_partners";
34 $this->processing_format_array = $this->_load_enum("processing_format",false);
35 $this->processing_format = $this->processing_format_array[0];
36 //most recent x12 version mandated by HIPAA and CMS
37 $this->x12_version = "004010X098A1";
38 $this->x12_isa05 = "ZZ";
39 $this->x12_isa07 = "ZZ";
40 $this->x12_isa14 = "0";
41 if ($id != "") {
42 $this->populate();
46 function x12_partner_factory() {
47 $partners = array();
48 $x = new X12Partner();
49 $sql = "SELECT id FROM " . $x->_table . " order by name";
50 $result = $x->_db->Execute($sql);
51 while($result && !$result->EOF) {
52 $partners[] = new X12Partner($result->fields['id']);
53 $result->MoveNext();
55 return $partners;
58 function get_id() {
59 return $this->id;
62 function set_id($id) {
63 if (is_numeric($id)) {
64 $this->id = $id;
68 function get_name() {
69 return $this->name;
72 function set_name($string) {
73 $this->name = $string;
76 function get_id_number() {
77 return $this->id_number;
80 function set_id_number($string) {
81 $this->id_number = $string;
84 function get_x12_sender_id() {
85 return $this->x12_sender_id;
88 function set_x12_sender_id($string) {
89 $this->x12_sender_id = $string;
92 function get_x12_receiver_id() {
93 return $this->x12_receiver_id;
96 function set_x12_receiver_id($string) {
97 $this->x12_receiver_id = $string;
100 function get_x12_version() {
101 return $this->x12_version;
104 function set_x12_version($string) {
105 $this->x12_version = $string;
108 function get_x12_isa05() {
109 return $this->x12_isa05;
112 function set_x12_isa05($string) {
113 $this->x12_isa05 = $string;
116 function get_x12_isa07() {
117 return $this->x12_isa07;
120 function set_x12_isa07($string) {
121 $this->x12_isa07 = $string;
124 function get_x12_isa14() {
125 return $this->x12_isa14;
128 function set_x12_isa14($string) {
129 $this->x12_isa14 = $string;
132 function get_x12_isa15() {
133 return $this->x12_isa15;
136 function set_x12_isa15($string) {
137 $this->x12_isa15 = $string;
140 function get_x12_gs02() {
141 return $this->x12_gs02;
144 function set_x12_gs02($string) {
145 $this->x12_gs02 = $string;
148 function get_x12_per06() {
149 return $this->x12_per06;
152 function set_x12_per06($string) {
153 $this->x12_per06 = $string;
156 function get_processing_format() {
157 //this is enum so it can be string or int
158 if (!is_numeric($this->processing_format)) {
159 $ta = $this->processing_format_array;
160 return $ta[$this->processing_format];
162 return $this->processing_format;
165 function get_processing_format_array() {
166 //flip it because normally it is an id to name lookup, for templates it needs to be a name to id lookup
167 return array_flip($this->processing_format_array);
170 function set_processing_format($string) {
171 $this->processing_format = $string;
174 function get_x12_isa14_array() {
175 return array(
176 '0' => 'No',
177 '1' => 'Yes',
181 function get_x12_isa15_array() {
182 return array(
183 'T' => 'Testing',
184 'P' => 'Production',
188 function get_idqual_array() {
189 return array(
190 '01' => 'Duns (Dun & Bradstreet)',
191 '14' => 'Duns Plus Suffix',
192 '20' => 'Health Industry Number (HIN)',
193 '27' => 'Carrier ID from HCFA',
194 '28' => 'Fiscal Intermediary ID from HCFA',
195 '29' => 'Medicare ID from HCFA',
196 '30' => 'U.S. Federal Tax ID Number',
197 '33' => 'NAIC Company Code',
198 'ZZ' => 'Mutually Defined',