Example #1
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'Label':
             $strToReturn = $this->blnCurrentFlag ? 'Current ' : 'Previous ';
             $strToReturn .= AddressType::$NameArray[$this->intAddressTypeId];
             return $strToReturn;
         case 'ShortName':
             return $this->Address1;
         case 'DisplayHtml':
             if ($this->Address3) {
                 $strToReturn = QApplication::HtmlEntities($this->Address3) . '<br/>';
             } else {
                 $strToReturn = null;
             }
             $strToReturn .= QApplication::HtmlEntities($this->Address1) . '<br/>';
             if ($this->Address2) {
                 $strToReturn .= QApplication::HtmlEntities($this->Address2) . '<br/>';
             }
             $strToReturn .= QApplication::HtmlEntities($this->City . ', ' . $this->State . '  ' . $this->ZipCode);
             foreach ($this->GetPhoneArray() as $objPhone) {
                 $strToReturn .= '<br/>' . $objPhone->Number;
             }
             return $strToReturn;
         case 'AddressShortLine':
             $strToReturn = null;
             if ($this->Address1) {
                 $strToReturn .= $this->strAddress1;
                 if ($this->strAddress2) {
                     $strToReturn .= ', ' . $this->strAddress2;
                 }
             }
             if ($this->strCity) {
                 if ($strToReturn) {
                     $strToReturn .= ', ';
                 }
                 $strToReturn .= $this->strCity;
             }
             return $strToReturn;
         case 'AddressFullLine':
             $strToReturn = null;
             if ($this->Address1) {
                 $strToReturn .= $this->strAddress1;
                 if ($this->strAddress2) {
                     $strToReturn .= ', ' . $this->strAddress2;
                 }
             }
             if ($this->strCity) {
                 if ($strToReturn) {
                     $strToReturn .= ', ';
                 }
                 $strToReturn .= sprintf('%s, %s %s', $this->strCity, $this->strState, $this->strZipCode);
             }
             return $strToReturn;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Example #2
0
 public function Save($blnForceInsert = false, $blnForceUpdate = false)
 {
     if (!$this->__blnRestored || $blnForceInsert) {
         $this->CreatedBy = QApplication::$objUserAccount->UserAccountId;
         $this->CreationDate = new QDateTime(QDateTime::Now);
     } else {
         $this->ModifiedBy = QApplication::$objUserAccount->UserAccountId;
     }
     parent::Save($blnForceInsert, $blnForceUpdate);
 }