예제 #1
0
파일: recurringInfo.php 프로젝트: alcf/chms
 public function btnAdd_Click()
 {
     //Save or create all necessary objects
     // Create RecurringDonation
     if (!$this->isEdit) {
         $this->objRecurringDonation = new RecurringDonation();
         $this->objRecurringDonation->PersonId = QApplication::$PublicLogin->Person->Id;
         $this->objRecurringDonation->ConfirmationEmail = QApplication::$PublicLogin->Person->PrimaryEmail->Address;
     }
     $this->objRecurringDonation->Amount = $this->GetAmount();
     $this->objRecurringDonation->Save();
     //Create RecurringPayment object - and associate with RecurringDonation.
     if (!$this->isEdit) {
         $objRecurringPayment = new RecurringPayments();
     } else {
         $objRecurringPayment = RecurringPayments::Load($this->objRecurringDonation->RecurringPaymentId);
     }
     QCryptography::$Key = CRYPTO_KEY;
     $objCrypto = new QCryptography(null, false);
     $objRecurringPayment->Address1 = $objCrypto->Encrypt(trim($this->pnlPayment->txtAddress1->Text));
     $objRecurringPayment->Address2 = $objCrypto->Encrypt(trim($this->pnlPayment->txtAddress2->Text));
     $objRecurringPayment->City = $objCrypto->Encrypt(trim($this->pnlPayment->txtCity->Text));
     $objRecurringPayment->State = trim($this->pnlPayment->lstState->SelectedValue);
     $objRecurringPayment->Zip = $objCrypto->Encrypt(trim($this->pnlPayment->txtZipCode->Text));
     $objRecurringPayment->ExpirationDate = sprintf('%02d%02d', $this->pnlPayment->lstCcExpMonth->SelectedValue, substr($this->pnlPayment->lstCcExpYear->SelectedValue, 2));
     //$objCrypto->Encrypt(sprintf('%02d%02d', $this->pnlPayment->lstCcExpMonth->SelectedValue, substr($this->pnlPayment->lstCcExpYear->SelectedValue, 2)));
     $objRecurringPayment->SecurityCode = $objCrypto->Encrypt($this->pnlPayment->txtCcCsc->Text);
     $objRecurringPayment->CreditCardTypeId = $this->pnlPayment->lstCcType->SelectedValue;
     $objRecurringPayment->CardHolderName = $objCrypto->Encrypt(sprintf('%s %s', $this->pnlPayment->txtFirstName->Text, $this->pnlPayment->txtLastName->Text));
     $objRecurringPayment->AccountNumber = $objCrypto->Encrypt($this->pnlPayment->txtCcNumber->Text);
     $objRecurringPayment->AuthorizeFlag = $this->chkAgreement->Checked;
     $objRecurringPayment->StartDate = $this->dtxStartDate->DateTime;
     $objRecurringPayment->EndDate = $this->dtxEndDate->DateTime;
     $objRecurringPayment->Amount = $this->GetAmount();
     $objRecurringPayment->PaymentPeriodId = $this->lstPaymentPeriod->SelectedValue;
     $objRecurringPayment->Name = $this->txtPaymentName->Text;
     $intRecurringPaymentId = $objRecurringPayment->Save();
     if (!$this->isEdit) {
         $this->objRecurringDonation->RecurringPaymentId = $intRecurringPaymentId;
         $this->objRecurringDonation->Save();
     }
     // Create RecurringDonationItems - And associate with RecurringDonation
     foreach ($this->objDonationItemArray as $objDonationItem) {
         if ($objDonationItem->Amount) {
             $objOnlineDonationLineItem = clone $objDonationItem;
             $objOnlineDonationLineItem->RecurringDonationId = $this->objRecurringDonation->Id;
             $objOnlineDonationLineItem->DonationFlag = true;
             $objOnlineDonationLineItem->Save();
         }
     }
     QApplication::Redirect('/give/recurring.php');
 }
예제 #2
0
 /**
  * Reload this RecurringPayments 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 RecurringPayments object.');
     }
     // Reload the Object
     $objReloaded = RecurringPayments::Load($this->intId);
     // Update $this's local variables to match
     $this->strName = $objReloaded->strName;
     $this->PaymentPeriodId = $objReloaded->PaymentPeriodId;
     $this->fltAmount = $objReloaded->fltAmount;
     $this->dttStartDate = $objReloaded->dttStartDate;
     $this->dttEndDate = $objReloaded->dttEndDate;
     $this->blnAuthorizeFlag = $objReloaded->blnAuthorizeFlag;
     $this->strCardHolderName = $objReloaded->strCardHolderName;
     $this->strAddress1 = $objReloaded->strAddress1;
     $this->strAddress2 = $objReloaded->strAddress2;
     $this->strCity = $objReloaded->strCity;
     $this->strState = $objReloaded->strState;
     $this->strZip = $objReloaded->strZip;
     $this->CreditCardTypeId = $objReloaded->CreditCardTypeId;
     $this->strAccountNumber = $objReloaded->strAccountNumber;
     $this->strExpirationDate = $objReloaded->strExpirationDate;
     $this->strSecurityCode = $objReloaded->strSecurityCode;
 }
예제 #3
0
 /**
  * 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 'RecurringPaymentId':
             // Gets the value for intRecurringPaymentId (Unique)
             // @return integer
             return $this->intRecurringPaymentId;
         case 'Amount':
             // Gets the value for fltAmount
             // @return double
             return $this->fltAmount;
         case 'ConfirmationEmail':
             // Gets the value for strConfirmationEmail
             // @return string
             return $this->strConfirmationEmail;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'RecurringPayment':
             // Gets the value for the RecurringPayments object referenced by intRecurringPaymentId (Unique)
             // @return RecurringPayments
             try {
                 if (!$this->objRecurringPayment && !is_null($this->intRecurringPaymentId)) {
                     $this->objRecurringPayment = RecurringPayments::Load($this->intRecurringPaymentId);
                 }
                 return $this->objRecurringPayment;
             } 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 '_RecurringDonationItems':
             // Gets the value for the private _objRecurringDonationItems (Read-Only)
             // if set due to an expansion on the recurring_donation_items.recurring_donation_id reverse relationship
             // @return RecurringDonationItems
             return $this->_objRecurringDonationItems;
         case '_RecurringDonationItemsArray':
             // Gets the value for the private _objRecurringDonationItemsArray (Read-Only)
             // if set due to an ExpandAsArray on the recurring_donation_items.recurring_donation_id reverse relationship
             // @return RecurringDonationItems[]
             return (array) $this->_objRecurringDonationItemsArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * 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 RecurringPaymentsMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing RecurringPayments object creation - defaults to CreateOrEdit
  * @return RecurringPaymentsMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objRecurringPayments = RecurringPayments::Load($intId);
         // RecurringPayments was found -- return it!
         if ($objRecurringPayments) {
             return new RecurringPaymentsMetaControl($objParentObject, $objRecurringPayments);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a RecurringPayments 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 RecurringPaymentsMetaControl($objParentObject, new RecurringPayments());
 }
예제 #5
0
 /**
  * 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 'ConfirmationEmail':
             // Gets the value for strConfirmationEmail
             // @return string
             return $this->strConfirmationEmail;
         case 'Amount':
             // Gets the value for fltAmount
             // @return double
             return $this->fltAmount;
         case 'CreditCardPaymentId':
             // Gets the value for intCreditCardPaymentId (Unique)
             // @return integer
             return $this->intCreditCardPaymentId;
         case 'IsRecurringFlag':
             // Gets the value for blnIsRecurringFlag
             // @return boolean
             return $this->blnIsRecurringFlag;
         case 'Status':
             // Gets the value for intStatus
             // @return integer
             return $this->intStatus;
         case 'RecurringPaymentId':
             // Gets the value for intRecurringPaymentId
             // @return integer
             return $this->intRecurringPaymentId;
             ///////////////////
             // 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 'CreditCardPayment':
             // Gets the value for the CreditCardPayment object referenced by intCreditCardPaymentId (Unique)
             // @return CreditCardPayment
             try {
                 if (!$this->objCreditCardPayment && !is_null($this->intCreditCardPaymentId)) {
                     $this->objCreditCardPayment = CreditCardPayment::Load($this->intCreditCardPaymentId);
                 }
                 return $this->objCreditCardPayment;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'RecurringPayment':
             // Gets the value for the RecurringPayments object referenced by intRecurringPaymentId
             // @return RecurringPayments
             try {
                 if (!$this->objRecurringPayment && !is_null($this->intRecurringPaymentId)) {
                     $this->objRecurringPayment = RecurringPayments::Load($this->intRecurringPaymentId);
                 }
                 return $this->objRecurringPayment;
             } 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 '_OnlineDonationLineItem':
             // Gets the value for the private _objOnlineDonationLineItem (Read-Only)
             // if set due to an expansion on the online_donation_line_item.online_donation_id reverse relationship
             // @return OnlineDonationLineItem
             return $this->_objOnlineDonationLineItem;
         case '_OnlineDonationLineItemArray':
             // Gets the value for the private _objOnlineDonationLineItemArray (Read-Only)
             // if set due to an ExpandAsArray on the online_donation_line_item.online_donation_id reverse relationship
             // @return OnlineDonationLineItem[]
             return (array) $this->_objOnlineDonationLineItemArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }