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 Address
extends ORDataObject
{
28 * Constructor sets all Address attributes to their default value
30 function Address($id = "", $foreign_id = "") {
32 $this->foreign_id
= $foreign_id;
33 $this->_table
= "addresses";
39 $this->plus_four
= "";
40 $this->country
= "USA";
47 function factory_address($foreign_id = "") {
48 if (empty($foreign_id)) {
49 $foreign_id= "like '%'";
52 $foreign_id= " = '" . mysql_real_escape_string(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 = mysql_fetch_array($results);
61 $a = new Address($row['id']);
67 function toString($html = false) {
69 . "ID: " . $this->id
."\n"
70 . "FID: " . $this->foreign_id
."\n"
73 .$this->city
. ", " . strtoupper($this->state
) . " " . $this->zip
. "-" . $this->plus_four
. "\n"
74 .$this->country
. "\n";
77 return nl2br($string);
84 function set_id($id) {
90 function set_foreign_id($fid) {
91 $this->foreign_id
= $fid;
93 function get_foreign_id() {
94 return $this->foreign_id
;
96 function set_line1($line1) {
97 $this->line1
= $line1;
99 function get_line1() {
102 function set_line2($line2) {
103 $this->line2
= $line2;
105 function get_line2() {
108 function get_lines_display() {
109 $string .= $this->get_line1();
110 $string .= " " . $this->get_line2();
113 function set_city($city) {
116 function get_city() {
119 function set_state($state) {
120 $this->state
= strtoupper($state);
122 function get_state() {
125 function set_zip($zip) {
131 function set_plus_four($plus_four) {
132 $this->plus_four
= $plus_four;
134 function get_plus_four() {
135 return $this->plus_four
;
137 function set_country($country) {
138 $this->country
= $country;
140 function get_country() {
141 return $this->country
;
143 function persist($fid ="") {
145 $this->foreign_id
= $fid;
152 $a = new Address("0");
154 echo $a->toString(true);*/