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
29 * Constructor sets all Company attributes to their default value
31 function __construct($id = "", $foreign_id = "")
35 $this->foreign_id
= $foreign_id;
36 $this->_table
= "companies";
42 $this->plus_four
= "";
43 $this->country
= "USA";
48 function factory_company($foreign_id = "")
52 if (empty($foreign_id)) {
53 $foreign_id_sql = " like '%'";
55 $foreign_id_sql = " = ?";
56 $sqlArray[] = strval($foreign_id);
60 $sql = "SELECT id FROM " . escape_table_name($a->_table
) . " WHERE foreign_id " . $foreign_id_sql;
61 //echo $sql . "<bR />";
62 $results = sqlQ($sql, $sqlArray);
64 $row = sqlFetchArray($results);
66 $a = new Address($row['id']);
72 function toString($html = false)
75 . "ID: " . $this->id
."\n"
76 . "FID: " . $this->foreign_id
."\n"
79 .$this->city
. ", " . strtoupper($this->state
) . " " . $this->zip
. "-" . $this->plus_four
. "\n"
80 .$this->country
. "\n";
83 return nl2br($string);
97 function set_name($name)
105 function set_foreign_id($fid)
107 $this->foreign_id
= $fid;
109 function get_foreign_id()
111 return $this->foreign_id
;
113 function set_line1($line1)
115 $this->line1
= $line1;
121 function set_line2($line2)
123 $this->line2
= $line2;
129 function set_city($city)
137 function set_state($state)
139 $this->state
= $state;
145 function set_zip($zip)
153 function set_plus_four($plus_four)
155 $this->plus_four
= $plus_four;
157 function get_plus_four()
159 return $this->plus_four
;
161 function set_country($country)
163 $this->country
= $country;
165 function get_country()
167 return $this->country
;
169 function persist($fid = "")
172 $this->foreign_id
= $fid;