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
{
27 * Constructor sets all Address attributes to their default value
29 function __construct($id = "", $foreign_id = "") {
31 $this->foreign_id
= $foreign_id;
32 $this->_table
= "addresses";
38 $this->plus_four
= "";
39 $this->country
= "USA";
46 static function factory_address($foreign_id = "") {
47 if (empty($foreign_id)) {
48 $foreign_id= "like '%'";
51 $foreign_id= " = '" . add_escape_custom(strval($foreign_id)) . "'";
54 $sql = "SELECT id FROM " . $a->_table
. " WHERE foreign_id " .$foreign_id ;
55 //echo $sql . "<bR />";
56 $results = sqlQ($sql);
58 $row = sqlFetchArray($results);
60 $a = new Address($row['id']);
66 function toString($html = false) {
68 . "ID: " . $this->id
."\n"
69 . "FID: " . $this->foreign_id
."\n"
72 .$this->city
. ", " . strtoupper($this->state
) . " " . $this->zip
. "-" . $this->plus_four
. "\n"
73 .$this->country
. "\n";
76 return nl2br($string);
83 function set_id($id) {
89 function set_foreign_id($fid) {
90 $this->foreign_id
= $fid;
92 function get_foreign_id() {
93 return $this->foreign_id
;
95 function set_line1($line1) {
96 $this->line1
= $line1;
98 function get_line1() {
101 function set_line2($line2) {
102 $this->line2
= $line2;
104 function get_line2() {
107 function get_lines_display() {
108 $string .= $this->get_line1();
109 $string .= " " . $this->get_line2();
112 function set_city($city) {
115 function get_city() {
118 function set_state($state) {
119 $this->state
= strtoupper($state);
121 function get_state() {
124 function set_zip($zip) {
130 function set_plus_four($plus_four) {
131 $this->plus_four
= $plus_four;
133 function get_plus_four() {
134 return $this->plus_four
;
136 function set_country($country) {
137 $this->country
= $country;
139 function get_country() {
140 return $this->country
;
142 function persist($fid ="") {
144 $this->foreign_id
= $fid;
151 $a = new Address("0");
153 echo $a->toString(true);*/