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 Address
extends ORDataObject
28 * Constructor sets all Address attributes to their default value
30 function __construct($id = "", $foreign_id = "")
33 $this->foreign_id
= $foreign_id;
34 $this->_table
= "addresses";
40 $this->plus_four
= "";
41 $this->country
= "USA";
46 static function factory_address($foreign_id = "")
48 if (empty($foreign_id)) {
49 $foreign_id= "like '%'";
51 $foreign_id= " = '" . add_escape_custom(strval($foreign_id)) . "'";
55 $sql = "SELECT id FROM " . $a->_table
. " WHERE foreign_id " .$foreign_id ;
56 //echo $sql . "<bR />";
57 $results = sqlQ($sql);
59 $row = sqlFetchArray($results);
61 $a = new Address($row['id']);
67 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);
92 function set_foreign_id($fid)
94 $this->foreign_id
= $fid;
96 function get_foreign_id()
98 return $this->foreign_id
;
100 function set_line1($line1)
102 $this->line1
= $line1;
108 function set_line2($line2)
110 $this->line2
= $line2;
116 function get_lines_display()
118 $string .= $this->get_line1();
119 $string .= " " . $this->get_line2();
122 function set_city($city)
130 function set_state($state)
132 $this->state
= strtoupper($state);
138 function set_zip($zip)
146 function set_plus_four($plus_four)
148 $this->plus_four
= $plus_four;
150 function get_plus_four()
152 return $this->plus_four
;
154 function set_country($country)
156 $this->country
= $country;
158 function get_country()
160 return $this->country
;
162 function persist($fid = "")
165 $this->foreign_id
= $fid;
172 $a = new Address("0");
174 echo $a->toString(true);*/