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 **************************************************************************/
11 require_once("ORDataObject.class.php");
16 class Company
extends ORDataObject
{
29 * Constructor sets all Company attributes to their default value
31 function company($id = "", $foreign_id = "") {
34 $this->foreign_id
= $foreign_id;
35 $this->_table
= "companies";
41 $this->plus_four
= "";
42 $this->country
= "USA";
49 function factory_company($foreign_id = "") {
50 if (empty($foreign_id)) {
51 $foreign_id= "like '%'";
54 $foreign_id= " = '" . mysql_real_escape_string(strval($foreign_id)) . "'";
57 $sql = "SELECT id FROM " . $a->_table
. " WHERE foreign_id " .$foreign_id ;
58 //echo $sql . "<bR />";
59 $results = sqlQ($sql);
61 $row = mysql_fetch_array($results);
63 $a = new Address($row['id']);
69 function toString($html = false) {
71 . "ID: " . $this->id
."\n"
72 . "FID: " . $this->foreign_id
."\n"
75 .$this->city
. ", " . strtoupper($this->state
) . " " . $this->zip
. "-" . $this->plus_four
. "\n"
76 .$this->country
. "\n";
79 return nl2br($string);
86 function set_id($id) {
92 function set_name($name) {
98 function set_foreign_id($fid) {
99 $this->foreign_id
= $fid;
101 function get_foreign_id() {
102 return $this->foreign_id
;
104 function set_line1($line1) {
105 $this->line1
= $line1;
107 function get_line1() {
110 function set_line2($line2) {
111 $this->line2
= $line2;
113 function get_line2() {
116 function set_city($city) {
119 function get_city() {
122 function set_state($state) {
123 $this->state
= $state;
125 function get_state() {
128 function set_zip($zip) {
134 function set_plus_four($plus_four) {
135 $this->plus_four
= $plus_four;
137 function get_plus_four() {
138 return $this->plus_four
;
140 function set_country($country) {
141 $this->country
= $country;
143 function get_country() {
144 return $this->country
;
146 function persist($fid ="") {
148 $this->foreign_id
= $fid;