protected function Form_Create() { $this->objOnlineDonation = OnlineDonation::Load(QApplication::PathInfo(0)); if (!$this->objOnlineDonation) { QApplication::Redirect('/give/'); } if ($this->objOnlineDonation->Hash != QApplication::PathInfo(1)) { QApplication::Redirect('/give/'); } // Create the Short-Circuit Registratino form IF: // The person donating does not yet have a record AND // we still have the email-to-send in Session if (array_key_exists('onlineDonationEmailAddress' . $this->objOnlineDonation->Id, $_SESSION) && !$this->objOnlineDonation->Person->PublicLogin) { $this->txtUsername = new QTextBox($this); $this->txtUsername->Name = 'Username'; $this->txtUsername->Required = true; $this->txtUsername->MaxLength = PublicLogin::UsernameMaxLength; $this->txtPassword = new QTextBox($this); $this->txtPassword->Name = 'Select a Password'; $this->txtPassword->Required = true; $this->txtPassword->TextMode = QTextMode::Password; $this->txtPassword->Instructions = 'At least 6 characters long'; $this->txtConfirmPassword = new QTextBox($this); $this->txtConfirmPassword->Name = 'Confirm Password'; $this->txtConfirmPassword->Instructions = 'Must match above'; $this->txtConfirmPassword->Required = true; $this->txtConfirmPassword->TextMode = QTextMode::Password; $this->lstQuestion = new QListBox($this); $this->lstQuestion->Name = '"Forgot Password" Question'; $this->lstQuestion->AddItem('- Select One -', null); $this->lstQuestion->AddItem('What city were you born in?', 'What city were you born in?'); $this->lstQuestion->AddItem('What is the name of your elementary school?', 'What is the name of your elementary school?'); $this->lstQuestion->AddItem('What street did you grow up on?', 'What street did you grow up on?'); $this->lstQuestion->AddItem('What is the name of your pet?', 'What is the name of your pet?'); $this->lstQuestion->AddItem('What was the make and model of your first car?', 'What was the make and model of your first car?'); $this->lstQuestion->AddItem('- Other... -', false); $this->lstQuestion->Required = true; $this->lstQuestion->AddAction(new QChangeEvent(), new QAjaxAction('lstQuestion_Refresh')); $this->txtQuestion = new QTextBox($this); $this->txtAnswer = new QTextBox($this); $this->txtAnswer->Name = 'Your Answer'; $this->txtAnswer->Required = true; $this->lstQuestion_Refresh(); $this->btnRegister = new QButton($this); $this->btnRegister->Text = 'Register'; $this->btnRegister->CssClass = 'primary'; $this->btnRegister->CausesValidation = true; $this->btnRegister->AddAction(new QClickEvent(), new QAjaxAction('btnRegister_Click')); $this->btnCancel = new QLinkButton($this); $this->btnCancel->Text = 'No Thanks'; $this->btnCancel->CssClass = 'cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QJavaScriptAction('myAlcf.toggleShortCircuitReg(false);')); $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction()); } }
public function dtgPaymentHistory_Bind() { if ($this->objRecurringDonation) { $objOnlineDonationArray = OnlineDonation::LoadArrayByPersonId($this->objRecurringDonation->PersonId); $objConditions = QQ::All(); $objClauses = array(); $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::OnlineDonation()->IsRecurringFlag, true)); $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::OnlineDonation()->RecurringPaymentId, $this->objRecurringDonation->RecurringPaymentId)); $this->dtgPaymentHistory->DataSource = OnlineDonation::QueryArray($objConditions); } else { $this->dtgPaymentHistory->DataSource = null; } }
/** * Deletes all associated OnlineDonations * @return void */ public function DeleteAllOnlineDonations() { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateOnlineDonation on this unsaved Person.'); } // Get the Database Object for this Class $objDatabase = Person::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (OnlineDonation::LoadArrayByPersonId($this->intId) as $objOnlineDonation) { $objOnlineDonation->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `online_donation` WHERE `person_id` = ' . $objDatabase->SqlVariable($this->intId) . ' '); }
/** * Called back from PaymentPanel to perform final tasks after we know * the payment has been submitted successfully. */ public function PaymentPanel_Success(OnlineDonation $objPaymentObject) { $strEmailAddress = trim(strtolower($this->txtEmail->Text)); // If there is a "address in waiting" for this OnlineDonation // Then it was a newly-created Person object // Let's create the household for this person if ($objPaymentObject->Address) { $objPerson = $objPaymentObject->Person; $objHousehold = Household::CreateHousehold($objPerson); $objAddress = $objPaymentObject->Address; $objAddress->AddressTypeId = AddressType::Home; $objAddress->CurrentFlag = true; $objAddress->Household = $objHousehold; $objAddress->Save(); $objHousehold->SetAsCurrentAddress($objAddress); // Add Email Address if ($strEmailAddress) { $objEmail = new Email(); $objEmail->Address = $strEmailAddress; $objEmail->Person = $objPerson; $objEmail->Save(); $objEmail->SetAsPrimary(); } } if (QApplication::$PublicLogin) { $objPaymentObject->SendConfirmationEmail(); } else { if ($strEmailAddress) { $objPaymentObject->SendConfirmationEmail($strEmailAddress); $_SESSION['onlineDonationEmailAddress' . $objPaymentObject->Id] = $strEmailAddress; } else { $_SESSION['onlineDonationEmailAddress' . $objPaymentObject->Id] = null; unset($_SESSION['onlineDonationEmailAddress' . $objPaymentObject->Id]); } } QApplication::Redirect($objPaymentObject->ConfirmationUrl); }
/** * 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 = OnlineDonation::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 OnlineDonation, given the clauses above $this->DataSource = OnlineDonation::QueryArray($objCondition, $objClauses); }
/** * 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 OnlineDonationMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing OnlineDonation object creation - defaults to CreateOrEdit * @return OnlineDonationMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objOnlineDonation = OnlineDonation::Load($intId); // OnlineDonation was found -- return it! if ($objOnlineDonation) { return new OnlineDonationMetaControl($objParentObject, $objOnlineDonation); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a OnlineDonation 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 OnlineDonationMetaControl($objParentObject, new OnlineDonation()); }
/** * 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 'CreditCardStatusTypeId': // Gets the value for intCreditCardStatusTypeId (Not Null) // @return integer return $this->intCreditCardStatusTypeId; case 'CreditCardTypeId': // Gets the value for intCreditCardTypeId (Not Null) // @return integer return $this->intCreditCardTypeId; case 'CreditCardLastFour': // Gets the value for strCreditCardLastFour (Not Null) // @return string return $this->strCreditCardLastFour; case 'TransactionCode': // Gets the value for strTransactionCode (Unique) // @return string return $this->strTransactionCode; case 'AuthorizationCode': // Gets the value for strAuthorizationCode // @return string return $this->strAuthorizationCode; case 'AddressMatchCode': // Gets the value for strAddressMatchCode // @return string return $this->strAddressMatchCode; case 'DateAuthorized': // Gets the value for dttDateAuthorized // @return QDateTime return $this->dttDateAuthorized; case 'DateCaptured': // Gets the value for dttDateCaptured // @return QDateTime return $this->dttDateCaptured; case 'AmountCharged': // Gets the value for fltAmountCharged // @return double return $this->fltAmountCharged; case 'AmountFee': // Gets the value for fltAmountFee // @return double return $this->fltAmountFee; case 'AmountCleared': // Gets the value for fltAmountCleared // @return double return $this->fltAmountCleared; case 'PaypalBatchId': // Gets the value for intPaypalBatchId // @return integer return $this->intPaypalBatchId; case 'UnlinkedFlag': // Gets the value for blnUnlinkedFlag // @return boolean return $this->blnUnlinkedFlag; case 'StewardshipContributionId': // Gets the value for intStewardshipContributionId (Unique) // @return integer return $this->intStewardshipContributionId; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'PaypalBatch': // Gets the value for the PaypalBatch object referenced by intPaypalBatchId // @return PaypalBatch try { if (!$this->objPaypalBatch && !is_null($this->intPaypalBatchId)) { $this->objPaypalBatch = PaypalBatch::Load($this->intPaypalBatchId); } return $this->objPaypalBatch; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'StewardshipContribution': // Gets the value for the StewardshipContribution object referenced by intStewardshipContributionId (Unique) // @return StewardshipContribution try { if (!$this->objStewardshipContribution && !is_null($this->intStewardshipContributionId)) { $this->objStewardshipContribution = StewardshipContribution::Load($this->intStewardshipContributionId); } return $this->objStewardshipContribution; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'OnlineDonation': // Gets the value for the OnlineDonation object that uniquely references this CreditCardPayment // by objOnlineDonation (Unique) // @return OnlineDonation try { if ($this->objOnlineDonation === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objOnlineDonation) { $this->objOnlineDonation = OnlineDonation::LoadByCreditCardPaymentId($this->intId); } return $this->objOnlineDonation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'SignupPayment': // Gets the value for the SignupPayment object that uniquely references this CreditCardPayment // by objSignupPayment (Unique) // @return SignupPayment try { if ($this->objSignupPayment === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objSignupPayment) { $this->objSignupPayment = SignupPayment::LoadByCreditCardPaymentId($this->intId); } return $this->objSignupPayment; } 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 '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Refresh this MetaControl with Data from the local OnlineDonationLineItem object. * @param boolean $blnReload reload OnlineDonationLineItem from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objOnlineDonationLineItem->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objOnlineDonationLineItem->Id; } } if ($this->lstOnlineDonation) { $this->lstOnlineDonation->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstOnlineDonation->AddItem(QApplication::Translate('- Select One -'), null); } $objOnlineDonationArray = OnlineDonation::LoadAll(); if ($objOnlineDonationArray) { foreach ($objOnlineDonationArray as $objOnlineDonation) { $objListItem = new QListItem($objOnlineDonation->__toString(), $objOnlineDonation->Id); if ($this->objOnlineDonationLineItem->OnlineDonation && $this->objOnlineDonationLineItem->OnlineDonation->Id == $objOnlineDonation->Id) { $objListItem->Selected = true; } $this->lstOnlineDonation->AddItem($objListItem); } } } if ($this->lblOnlineDonationId) { $this->lblOnlineDonationId->Text = $this->objOnlineDonationLineItem->OnlineDonation ? $this->objOnlineDonationLineItem->OnlineDonation->__toString() : null; } if ($this->txtAmount) { $this->txtAmount->Text = $this->objOnlineDonationLineItem->Amount; } if ($this->lblAmount) { $this->lblAmount->Text = $this->objOnlineDonationLineItem->Amount; } if ($this->chkDonationFlag) { $this->chkDonationFlag->Checked = $this->objOnlineDonationLineItem->DonationFlag; } if ($this->lblDonationFlag) { $this->lblDonationFlag->Text = $this->objOnlineDonationLineItem->DonationFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->lstStewardshipFund) { $this->lstStewardshipFund->RemoveAllItems(); $this->lstStewardshipFund->AddItem(QApplication::Translate('- Select One -'), null); $objStewardshipFundArray = StewardshipFund::LoadAll(); if ($objStewardshipFundArray) { foreach ($objStewardshipFundArray as $objStewardshipFund) { $objListItem = new QListItem($objStewardshipFund->__toString(), $objStewardshipFund->Id); if ($this->objOnlineDonationLineItem->StewardshipFund && $this->objOnlineDonationLineItem->StewardshipFund->Id == $objStewardshipFund->Id) { $objListItem->Selected = true; } $this->lstStewardshipFund->AddItem($objListItem); } } } if ($this->lblStewardshipFundId) { $this->lblStewardshipFundId->Text = $this->objOnlineDonationLineItem->StewardshipFund ? $this->objOnlineDonationLineItem->StewardshipFund->__toString() : null; } if ($this->txtOther) { $this->txtOther->Text = $this->objOnlineDonationLineItem->Other; } if ($this->lblOther) { $this->lblOther->Text = $this->objOnlineDonationLineItem->Other; } }
// monthly $timePeriod = 30 * 24 * 60 * 60; break; case 4: // quarterly $timePeriod = 4 * 30 * 24 * 60 * 60; break; } print sprintf("today is: %s\n", date('Y-m-d', time())); $checkTime = strtotime($startDate); while ($checkTime < strtotime($objRecurringPayment->EndDate)) { if (date('Y-m-d', $checkTime) == date('Y-m-d', time())) { print "TODAYS THE DAY. MAKE A PAYMENT!\n"; /**************/ // Create the Payment Object $objPaymentObject = new OnlineDonation(); $objAddressValidator = new AddressValidator($objCrypto->Decrypt($objRecurringPayment->Address1), $objCrypto->Decrypt($objRecurringPayment->Address2), $objCrypto->Decrypt($objRecurringPayment->City), $objRecurringPayment->State, $objCrypto->Decrypt($objRecurringPayment->Zip)); $objAddressValidator->ValidateAddress(); $objAddress = $objAddressValidator->CreateAddressRecord(); $namearray = explode(' ', $objCrypto->Decrypt($objRecurringPayment->CardHolderName)); $objPaymentObject->AttachPersonWithInformation($namearray[0], $namearray[1], $objAddress); $objPaymentObject->IsRecurringFlag = true; $objPaymentObject->RecurringPaymentId = $objRecurringPayment->Id; $mixReturn = CreditCardPayment::PerformAuthorization($objPaymentObject, null, $namearray[0], $namearray[1], $objAddress, $objRecurringPayment->Amount, $objCrypto->Decrypt($objRecurringPayment->AccountNumber), $objRecurringPayment->ExpirationDate, $objCrypto->Decrypt($objRecurringPayment->SecurityCode), $objRecurringPayment->CreditCardTypeId); // Success? if ($mixReturn instanceof CreditCardPayment) { print "Successful scheduling of payment.\n"; $objPaymentObject->Status = true; $intDonationId = $objPaymentObject->Save(); $strPaymentItems = ''; $objDonationItems = RecurringDonationItems::LoadArrayByRecurringDonationId($objRecurringPayment->RecurringDonationAsRecurringPayment->Id);
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, OnlineDonation::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
/** * This will save this object's CreditCardPayment instance, * updating only the fields which have had a control created for it. */ public function SaveCreditCardPayment() { try { // Update any fields for controls that have been created if ($this->lstCreditCardStatusType) { $this->objCreditCardPayment->CreditCardStatusTypeId = $this->lstCreditCardStatusType->SelectedValue; } if ($this->lstCreditCardType) { $this->objCreditCardPayment->CreditCardTypeId = $this->lstCreditCardType->SelectedValue; } if ($this->txtCreditCardLastFour) { $this->objCreditCardPayment->CreditCardLastFour = $this->txtCreditCardLastFour->Text; } if ($this->txtTransactionCode) { $this->objCreditCardPayment->TransactionCode = $this->txtTransactionCode->Text; } if ($this->txtAuthorizationCode) { $this->objCreditCardPayment->AuthorizationCode = $this->txtAuthorizationCode->Text; } if ($this->txtAddressMatchCode) { $this->objCreditCardPayment->AddressMatchCode = $this->txtAddressMatchCode->Text; } if ($this->calDateAuthorized) { $this->objCreditCardPayment->DateAuthorized = $this->calDateAuthorized->DateTime; } if ($this->calDateCaptured) { $this->objCreditCardPayment->DateCaptured = $this->calDateCaptured->DateTime; } if ($this->txtAmountCharged) { $this->objCreditCardPayment->AmountCharged = $this->txtAmountCharged->Text; } if ($this->txtAmountFee) { $this->objCreditCardPayment->AmountFee = $this->txtAmountFee->Text; } if ($this->txtAmountCleared) { $this->objCreditCardPayment->AmountCleared = $this->txtAmountCleared->Text; } if ($this->lstPaypalBatch) { $this->objCreditCardPayment->PaypalBatchId = $this->lstPaypalBatch->SelectedValue; } if ($this->chkUnlinkedFlag) { $this->objCreditCardPayment->UnlinkedFlag = $this->chkUnlinkedFlag->Checked; } if ($this->lstStewardshipContribution) { $this->objCreditCardPayment->StewardshipContributionId = $this->lstStewardshipContribution->SelectedValue; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstOnlineDonation) { $this->objCreditCardPayment->OnlineDonation = OnlineDonation::Load($this->lstOnlineDonation->SelectedValue); } if ($this->lstSignupPayment) { $this->objCreditCardPayment->SignupPayment = SignupPayment::Load($this->lstSignupPayment->SelectedValue); } // Save the CreditCardPayment object $this->objCreditCardPayment->Save(); // Finally, update any ManyToManyReferences (if any) } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) { if ($objObject->objOnlineDonation) { $objObject->objOnlineDonation = OnlineDonation::GetSoapObjectFromObject($objObject->objOnlineDonation, false); } else { if (!$blnBindRelatedObjects) { $objObject->intOnlineDonationId = null; } } if ($objObject->objStewardshipFund) { $objObject->objStewardshipFund = StewardshipFund::GetSoapObjectFromObject($objObject->objStewardshipFund, false); } else { if (!$blnBindRelatedObjects) { $objObject->intStewardshipFundId = null; } } return $objObject; }