예제 #1
0
파일: new.php 프로젝트: alcf/chms
 protected function RedirectBack($blnSave = false)
 {
     // From StewradshipSelectPersonDialogBox.class.php:
     //
     // New.php should take the StackId as the first PathInfo
     // PathInfo(1) should be either "new", "check", or the Id of the Contribution
     // PathInfo(2) should be the check hash (if applicable)
     if (null != QApplication::PathInfo(0) && null != QApplication::PathInfo(1)) {
         if ($objStack = StewardshipStack::Load(QApplication::PathInfo(0))) {
             switch (strtolower(trim(QApplication::PathInfo(1)))) {
                 case 'new':
                     QApplication::Redirect(sprintf('/stewardship/batch.php/%s#%s/edit_contribution/new/0/%s', $objStack->StewardshipBatchId, $objStack->StackNumber, $blnSave ? $this->mctPerson->Person->Id : null));
                     break;
                 case 'check':
                     QApplication::Redirect(sprintf('/stewardship/batch.php/%s#%s/edit_contribution/0/%s/%s', $objStack->StewardshipBatchId, $objStack->StackNumber, QApplication::PathInfo(2), $blnSave ? $this->mctPerson->Person->Id : null));
                     break;
                 default:
                     QApplication::Redirect(sprintf('/stewardship/batch.php/%s#%s/edit_contribution/%s/0/%s', $objStack->StewardshipBatchId, $objStack->StackNumber, QApplication::PathInfo(1), $blnSave ? $this->mctPerson->Person->Id : null));
                     break;
             }
         }
     } else {
         if ($blnSave) {
             QApplication::Redirect($this->mctPerson->Person->LinkUrl);
         } else {
             QApplication::Redirect('/individuals/');
         }
     }
 }
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'Id':
             // Gets the value for intId (Read-Only PK)
             // @return integer
             return $this->intId;
         case 'PersonId':
             // Gets the value for intPersonId (Not Null)
             // @return integer
             return $this->intPersonId;
         case 'StewardshipContributionTypeId':
             // Gets the value for intStewardshipContributionTypeId (Not Null)
             // @return integer
             return $this->intStewardshipContributionTypeId;
         case 'StewardshipBatchId':
             // Gets the value for intStewardshipBatchId (Not Null)
             // @return integer
             return $this->intStewardshipBatchId;
         case 'StewardshipStackId':
             // Gets the value for intStewardshipStackId
             // @return integer
             return $this->intStewardshipStackId;
         case 'CheckingAccountLookupId':
             // Gets the value for intCheckingAccountLookupId
             // @return integer
             return $this->intCheckingAccountLookupId;
         case 'TotalAmount':
             // Gets the value for fltTotalAmount
             // @return double
             return $this->fltTotalAmount;
         case 'DateEntered':
             // Gets the value for dttDateEntered (Not Null)
             // @return QDateTime
             return $this->dttDateEntered;
         case 'DateCleared':
             // Gets the value for dttDateCleared
             // @return QDateTime
             return $this->dttDateCleared;
         case 'DateCredited':
             // Gets the value for dttDateCredited (Not Null)
             // @return QDateTime
             return $this->dttDateCredited;
         case 'CheckNumber':
             // Gets the value for strCheckNumber
             // @return string
             return $this->strCheckNumber;
         case 'AuthorizationNumber':
             // Gets the value for strAuthorizationNumber
             // @return string
             return $this->strAuthorizationNumber;
         case 'AlternateSource':
             // Gets the value for strAlternateSource
             // @return string
             return $this->strAlternateSource;
         case 'NonDeductibleFlag':
             // Gets the value for blnNonDeductibleFlag
             // @return boolean
             return $this->blnNonDeductibleFlag;
         case 'Note':
             // Gets the value for strNote
             // @return string
             return $this->strNote;
         case 'CreatedByLoginId':
             // Gets the value for intCreatedByLoginId (Not Null)
             // @return integer
             return $this->intCreatedByLoginId;
         case 'UnpostedFlag':
             // Gets the value for blnUnpostedFlag
             // @return boolean
             return $this->blnUnpostedFlag;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Person':
             // Gets the value for the Person object referenced by intPersonId (Not Null)
             // @return Person
             try {
                 if (!$this->objPerson && !is_null($this->intPersonId)) {
                     $this->objPerson = Person::Load($this->intPersonId);
                 }
                 return $this->objPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'StewardshipBatch':
             // Gets the value for the StewardshipBatch object referenced by intStewardshipBatchId (Not Null)
             // @return StewardshipBatch
             try {
                 if (!$this->objStewardshipBatch && !is_null($this->intStewardshipBatchId)) {
                     $this->objStewardshipBatch = StewardshipBatch::Load($this->intStewardshipBatchId);
                 }
                 return $this->objStewardshipBatch;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'StewardshipStack':
             // Gets the value for the StewardshipStack object referenced by intStewardshipStackId
             // @return StewardshipStack
             try {
                 if (!$this->objStewardshipStack && !is_null($this->intStewardshipStackId)) {
                     $this->objStewardshipStack = StewardshipStack::Load($this->intStewardshipStackId);
                 }
                 return $this->objStewardshipStack;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CheckingAccountLookup':
             // Gets the value for the CheckingAccountLookup object referenced by intCheckingAccountLookupId
             // @return CheckingAccountLookup
             try {
                 if (!$this->objCheckingAccountLookup && !is_null($this->intCheckingAccountLookupId)) {
                     $this->objCheckingAccountLookup = CheckingAccountLookup::Load($this->intCheckingAccountLookupId);
                 }
                 return $this->objCheckingAccountLookup;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByLogin':
             // Gets the value for the Login object referenced by intCreatedByLoginId (Not Null)
             // @return Login
             try {
                 if (!$this->objCreatedByLogin && !is_null($this->intCreatedByLoginId)) {
                     $this->objCreatedByLogin = Login::Load($this->intCreatedByLoginId);
                 }
                 return $this->objCreatedByLogin;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreditCardPayment':
             // Gets the value for the CreditCardPayment object that uniquely references this StewardshipContribution
             // by objCreditCardPayment (Unique)
             // @return CreditCardPayment
             try {
                 if ($this->objCreditCardPayment === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objCreditCardPayment) {
                     $this->objCreditCardPayment = CreditCardPayment::LoadByStewardshipContributionId($this->intId);
                 }
                 return $this->objCreditCardPayment;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '_StewardshipContributionAmount':
             // Gets the value for the private _objStewardshipContributionAmount (Read-Only)
             // if set due to an expansion on the stewardship_contribution_amount.stewardship_contribution_id reverse relationship
             // @return StewardshipContributionAmount
             return $this->_objStewardshipContributionAmount;
         case '_StewardshipContributionAmountArray':
             // Gets the value for the private _objStewardshipContributionAmountArray (Read-Only)
             // if set due to an ExpandAsArray on the stewardship_contribution_amount.stewardship_contribution_id reverse relationship
             // @return StewardshipContributionAmount[]
             return (array) $this->_objStewardshipContributionAmountArray;
         case '_StewardshipPostLineItem':
             // Gets the value for the private _objStewardshipPostLineItem (Read-Only)
             // if set due to an expansion on the stewardship_post_line_item.stewardship_contribution_id reverse relationship
             // @return StewardshipPostLineItem
             return $this->_objStewardshipPostLineItem;
         case '_StewardshipPostLineItemArray':
             // Gets the value for the private _objStewardshipPostLineItemArray (Read-Only)
             // if set due to an ExpandAsArray on the stewardship_post_line_item.stewardship_contribution_id reverse relationship
             // @return StewardshipPostLineItem[]
             return (array) $this->_objStewardshipPostLineItemArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
예제 #3
0
 /**
  * Reload this StewardshipStack from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved StewardshipStack object.');
     }
     // Reload the Object
     $objReloaded = StewardshipStack::Load($this->intId);
     // Update $this's local variables to match
     $this->StewardshipBatchId = $objReloaded->StewardshipBatchId;
     $this->intStackNumber = $objReloaded->intStackNumber;
     $this->intItemCount = $objReloaded->intItemCount;
     $this->fltReportedTotalAmount = $objReloaded->fltReportedTotalAmount;
     $this->fltActualTotalAmount = $objReloaded->fltActualTotalAmount;
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this StewardshipStackMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing StewardshipStack object creation - defaults to CreateOrEdit
  * @return StewardshipStackMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objStewardshipStack = StewardshipStack::Load($intId);
         // StewardshipStack was found -- return it!
         if ($objStewardshipStack) {
             return new StewardshipStackMetaControl($objParentObject, $objStewardshipStack);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a StewardshipStack object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new StewardshipStackMetaControl($objParentObject, new StewardshipStack());
 }