2 /************************************************************************
3 address.php - Copyright duhlman
5 /usr/share/apps/umbrello/headings/heading.php
7 This file was generated on %date% at %time%
8 The original location of this file is /home/duhlman/uml-generated-code/prescription.php
9 **************************************************************************/
15 class Company
extends ORDataObject
{
28 * Constructor sets all Company attributes to their default value
30 function __construct($id = "", $foreign_id = "") {
33 $this->foreign_id
= $foreign_id;
34 $this->_table
= "companies";
40 $this->plus_four
= "";
41 $this->country
= "USA";
48 function factory_company($foreign_id = "") {
49 if (empty($foreign_id)) {
50 $foreign_id= "like '%'";
53 $foreign_id= " = '" . add_escape_custom(strval($foreign_id)) . "'";
56 $sql = "SELECT id FROM " . $a->_table
. " WHERE foreign_id " .$foreign_id ;
57 //echo $sql . "<bR />";
58 $results = sqlQ($sql);
60 $row = sqlFetchArray($results);
62 $a = new Address($row['id']);
68 function toString($html = false) {
70 . "ID: " . $this->id
."\n"
71 . "FID: " . $this->foreign_id
."\n"
74 .$this->city
. ", " . strtoupper($this->state
) . " " . $this->zip
. "-" . $this->plus_four
. "\n"
75 .$this->country
. "\n";
78 return nl2br($string);
85 function set_id($id) {
91 function set_name($name) {
97 function set_foreign_id($fid) {
98 $this->foreign_id
= $fid;
100 function get_foreign_id() {
101 return $this->foreign_id
;
103 function set_line1($line1) {
104 $this->line1
= $line1;
106 function get_line1() {
109 function set_line2($line2) {
110 $this->line2
= $line2;
112 function get_line2() {
115 function set_city($city) {
118 function get_city() {
121 function set_state($state) {
122 $this->state
= $state;
124 function get_state() {
127 function set_zip($zip) {
133 function set_plus_four($plus_four) {
134 $this->plus_four
= $plus_four;
136 function get_plus_four() {
137 return $this->plus_four
;
139 function set_country($country) {
140 $this->country
= $country;
142 function get_country() {
143 return $this->country
;
145 function persist($fid ="") {
147 $this->foreign_id
= $fid;