Example #1
0
 public function RenderPaymentPeriod(RecurringDonation $objDonation)
 {
     return sprintf('%s', PaymentPeriod::Load($objDonation->RecurringPayment->PaymentPeriod->Name));
 }
Example #2
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objPaymentPeriod) {
         $objObject->objPaymentPeriod = PaymentPeriod::GetSoapObjectFromObject($objObject->objPaymentPeriod, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPaymentPeriodId = null;
         }
     }
     if ($objObject->dttStartDate) {
         $objObject->dttStartDate = $objObject->dttStartDate->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttEndDate) {
         $objObject->dttEndDate = $objObject->dttEndDate->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
 /**
  * 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 PaymentPeriodMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing PaymentPeriod object creation - defaults to CreateOrEdit
  * @return PaymentPeriodMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objPaymentPeriod = PaymentPeriod::Load($intId);
         // PaymentPeriod was found -- return it!
         if ($objPaymentPeriod) {
             return new PaymentPeriodMetaControl($objParentObject, $objPaymentPeriod);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a PaymentPeriod 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 PaymentPeriodMetaControl($objParentObject, new PaymentPeriod());
 }
 /**
  * Refresh this MetaControl with Data from the local RecurringPayments object.
  * @param boolean $blnReload reload RecurringPayments from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objRecurringPayments->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objRecurringPayments->Id;
         }
     }
     if ($this->txtName) {
         $this->txtName->Text = $this->objRecurringPayments->Name;
     }
     if ($this->lblName) {
         $this->lblName->Text = $this->objRecurringPayments->Name;
     }
     if ($this->lstPaymentPeriod) {
         $this->lstPaymentPeriod->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstPaymentPeriod->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objPaymentPeriodArray = PaymentPeriod::LoadAll();
         if ($objPaymentPeriodArray) {
             foreach ($objPaymentPeriodArray as $objPaymentPeriod) {
                 $objListItem = new QListItem($objPaymentPeriod->__toString(), $objPaymentPeriod->Id);
                 if ($this->objRecurringPayments->PaymentPeriod && $this->objRecurringPayments->PaymentPeriod->Id == $objPaymentPeriod->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPaymentPeriod->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPaymentPeriodId) {
         $this->lblPaymentPeriodId->Text = $this->objRecurringPayments->PaymentPeriod ? $this->objRecurringPayments->PaymentPeriod->__toString() : null;
     }
     if ($this->txtAmount) {
         $this->txtAmount->Text = $this->objRecurringPayments->Amount;
     }
     if ($this->lblAmount) {
         $this->lblAmount->Text = $this->objRecurringPayments->Amount;
     }
     if ($this->calStartDate) {
         $this->calStartDate->DateTime = $this->objRecurringPayments->StartDate;
     }
     if ($this->lblStartDate) {
         $this->lblStartDate->Text = sprintf($this->objRecurringPayments->StartDate) ? $this->objRecurringPayments->__toString($this->strStartDateDateTimeFormat) : null;
     }
     if ($this->calEndDate) {
         $this->calEndDate->DateTime = $this->objRecurringPayments->EndDate;
     }
     if ($this->lblEndDate) {
         $this->lblEndDate->Text = sprintf($this->objRecurringPayments->EndDate) ? $this->objRecurringPayments->__toString($this->strEndDateDateTimeFormat) : null;
     }
     if ($this->chkAuthorizeFlag) {
         $this->chkAuthorizeFlag->Checked = $this->objRecurringPayments->AuthorizeFlag;
     }
     if ($this->lblAuthorizeFlag) {
         $this->lblAuthorizeFlag->Text = $this->objRecurringPayments->AuthorizeFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->txtCardHolderName) {
         $this->txtCardHolderName->Text = $this->objRecurringPayments->CardHolderName;
     }
     if ($this->lblCardHolderName) {
         $this->lblCardHolderName->Text = $this->objRecurringPayments->CardHolderName;
     }
     if ($this->txtAddress1) {
         $this->txtAddress1->Text = $this->objRecurringPayments->Address1;
     }
     if ($this->lblAddress1) {
         $this->lblAddress1->Text = $this->objRecurringPayments->Address1;
     }
     if ($this->txtAddress2) {
         $this->txtAddress2->Text = $this->objRecurringPayments->Address2;
     }
     if ($this->lblAddress2) {
         $this->lblAddress2->Text = $this->objRecurringPayments->Address2;
     }
     if ($this->txtCity) {
         $this->txtCity->Text = $this->objRecurringPayments->City;
     }
     if ($this->lblCity) {
         $this->lblCity->Text = $this->objRecurringPayments->City;
     }
     if ($this->txtState) {
         $this->txtState->Text = $this->objRecurringPayments->State;
     }
     if ($this->lblState) {
         $this->lblState->Text = $this->objRecurringPayments->State;
     }
     if ($this->txtZip) {
         $this->txtZip->Text = $this->objRecurringPayments->Zip;
     }
     if ($this->lblZip) {
         $this->lblZip->Text = $this->objRecurringPayments->Zip;
     }
     if ($this->lstCreditCardType) {
         $this->lstCreditCardType->SelectedValue = $this->objRecurringPayments->CreditCardTypeId;
     }
     if ($this->lblCreditCardTypeId) {
         $this->lblCreditCardTypeId->Text = $this->objRecurringPayments->CreditCardTypeId ? CreditCardType::$NameArray[$this->objRecurringPayments->CreditCardTypeId] : null;
     }
     if ($this->txtAccountNumber) {
         $this->txtAccountNumber->Text = $this->objRecurringPayments->AccountNumber;
     }
     if ($this->lblAccountNumber) {
         $this->lblAccountNumber->Text = $this->objRecurringPayments->AccountNumber;
     }
     if ($this->txtExpirationDate) {
         $this->txtExpirationDate->Text = $this->objRecurringPayments->ExpirationDate;
     }
     if ($this->lblExpirationDate) {
         $this->lblExpirationDate->Text = $this->objRecurringPayments->ExpirationDate;
     }
     if ($this->txtSecurityCode) {
         $this->txtSecurityCode->Text = $this->objRecurringPayments->SecurityCode;
     }
     if ($this->lblSecurityCode) {
         $this->lblSecurityCode->Text = $this->objRecurringPayments->SecurityCode;
     }
     if ($this->lstRecurringDonationAsRecurringPayment) {
         $this->lstRecurringDonationAsRecurringPayment->RemoveAllItems();
         $this->lstRecurringDonationAsRecurringPayment->AddItem(QApplication::Translate('- Select One -'), null);
         $objRecurringDonationArray = RecurringDonation::LoadAll();
         if ($objRecurringDonationArray) {
             foreach ($objRecurringDonationArray as $objRecurringDonation) {
                 $objListItem = new QListItem($objRecurringDonation->__toString(), $objRecurringDonation->Id);
                 if ($objRecurringDonation->RecurringPaymentId == $this->objRecurringPayments->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstRecurringDonationAsRecurringPayment->AddItem($objListItem);
             }
         }
     }
     if ($this->lblRecurringDonationAsRecurringPayment) {
         $this->lblRecurringDonationAsRecurringPayment->Text = $this->objRecurringPayments->RecurringDonationAsRecurringPayment ? $this->objRecurringPayments->RecurringDonationAsRecurringPayment->__toString() : null;
     }
 }
Example #5
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, PaymentPeriod::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = PaymentPeriod::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from PaymentPeriod, given the clauses above
     $this->DataSource = PaymentPeriod::QueryArray($objCondition, $objClauses);
 }