/** * Counts all many-to-many associated CheckingAccountLookups * @return int */ public function CountCheckingAccountLookups() { if (is_null($this->intId)) { return 0; } return CheckingAccountLookup::CountByPerson($this->intId); }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, CheckingAccountLookup::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 = CheckingAccountLookup::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 CheckingAccountLookup, given the clauses above $this->DataSource = CheckingAccountLookup::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 CheckingAccountLookupMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing CheckingAccountLookup object creation - defaults to CreateOrEdit * @return CheckingAccountLookupMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objCheckingAccountLookup = CheckingAccountLookup::Load($intId); // CheckingAccountLookup was found -- return it! if ($objCheckingAccountLookup) { return new CheckingAccountLookupMetaControl($objParentObject, $objCheckingAccountLookup); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a CheckingAccountLookup 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 CheckingAccountLookupMetaControl($objParentObject, new CheckingAccountLookup()); }
/** * Refresh this MetaControl with Data from the local StewardshipContribution object. * @param boolean $blnReload reload StewardshipContribution from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objStewardshipContribution->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objStewardshipContribution->Id; } } if ($this->lstPerson) { $this->lstPerson->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null); } $objPersonArray = Person::LoadAll(); if ($objPersonArray) { foreach ($objPersonArray as $objPerson) { $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id); if ($this->objStewardshipContribution->Person && $this->objStewardshipContribution->Person->Id == $objPerson->Id) { $objListItem->Selected = true; } $this->lstPerson->AddItem($objListItem); } } } if ($this->lblPersonId) { $this->lblPersonId->Text = $this->objStewardshipContribution->Person ? $this->objStewardshipContribution->Person->__toString() : null; } if ($this->lstStewardshipContributionType) { $this->lstStewardshipContributionType->SelectedValue = $this->objStewardshipContribution->StewardshipContributionTypeId; } if ($this->lblStewardshipContributionTypeId) { $this->lblStewardshipContributionTypeId->Text = $this->objStewardshipContribution->StewardshipContributionTypeId ? StewardshipContributionType::$NameArray[$this->objStewardshipContribution->StewardshipContributionTypeId] : null; } if ($this->lstStewardshipBatch) { $this->lstStewardshipBatch->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstStewardshipBatch->AddItem(QApplication::Translate('- Select One -'), null); } $objStewardshipBatchArray = StewardshipBatch::LoadAll(); if ($objStewardshipBatchArray) { foreach ($objStewardshipBatchArray as $objStewardshipBatch) { $objListItem = new QListItem($objStewardshipBatch->__toString(), $objStewardshipBatch->Id); if ($this->objStewardshipContribution->StewardshipBatch && $this->objStewardshipContribution->StewardshipBatch->Id == $objStewardshipBatch->Id) { $objListItem->Selected = true; } $this->lstStewardshipBatch->AddItem($objListItem); } } } if ($this->lblStewardshipBatchId) { $this->lblStewardshipBatchId->Text = $this->objStewardshipContribution->StewardshipBatch ? $this->objStewardshipContribution->StewardshipBatch->__toString() : null; } if ($this->lstStewardshipStack) { $this->lstStewardshipStack->RemoveAllItems(); $this->lstStewardshipStack->AddItem(QApplication::Translate('- Select One -'), null); $objStewardshipStackArray = StewardshipStack::LoadAll(); if ($objStewardshipStackArray) { foreach ($objStewardshipStackArray as $objStewardshipStack) { $objListItem = new QListItem($objStewardshipStack->__toString(), $objStewardshipStack->Id); if ($this->objStewardshipContribution->StewardshipStack && $this->objStewardshipContribution->StewardshipStack->Id == $objStewardshipStack->Id) { $objListItem->Selected = true; } $this->lstStewardshipStack->AddItem($objListItem); } } } if ($this->lblStewardshipStackId) { $this->lblStewardshipStackId->Text = $this->objStewardshipContribution->StewardshipStack ? $this->objStewardshipContribution->StewardshipStack->__toString() : null; } if ($this->lstCheckingAccountLookup) { $this->lstCheckingAccountLookup->RemoveAllItems(); $this->lstCheckingAccountLookup->AddItem(QApplication::Translate('- Select One -'), null); $objCheckingAccountLookupArray = CheckingAccountLookup::LoadAll(); if ($objCheckingAccountLookupArray) { foreach ($objCheckingAccountLookupArray as $objCheckingAccountLookup) { $objListItem = new QListItem($objCheckingAccountLookup->__toString(), $objCheckingAccountLookup->Id); if ($this->objStewardshipContribution->CheckingAccountLookup && $this->objStewardshipContribution->CheckingAccountLookup->Id == $objCheckingAccountLookup->Id) { $objListItem->Selected = true; } $this->lstCheckingAccountLookup->AddItem($objListItem); } } } if ($this->lblCheckingAccountLookupId) { $this->lblCheckingAccountLookupId->Text = $this->objStewardshipContribution->CheckingAccountLookup ? $this->objStewardshipContribution->CheckingAccountLookup->__toString() : null; } if ($this->txtTotalAmount) { $this->txtTotalAmount->Text = $this->objStewardshipContribution->TotalAmount; } if ($this->lblTotalAmount) { $this->lblTotalAmount->Text = $this->objStewardshipContribution->TotalAmount; } if ($this->calDateEntered) { $this->calDateEntered->DateTime = $this->objStewardshipContribution->DateEntered; } if ($this->lblDateEntered) { $this->lblDateEntered->Text = sprintf($this->objStewardshipContribution->DateEntered) ? $this->objStewardshipContribution->__toString($this->strDateEnteredDateTimeFormat) : null; } if ($this->calDateCleared) { $this->calDateCleared->DateTime = $this->objStewardshipContribution->DateCleared; } if ($this->lblDateCleared) { $this->lblDateCleared->Text = sprintf($this->objStewardshipContribution->DateCleared) ? $this->objStewardshipContribution->__toString($this->strDateClearedDateTimeFormat) : null; } if ($this->calDateCredited) { $this->calDateCredited->DateTime = $this->objStewardshipContribution->DateCredited; } if ($this->lblDateCredited) { $this->lblDateCredited->Text = sprintf($this->objStewardshipContribution->DateCredited) ? $this->objStewardshipContribution->__toString($this->strDateCreditedDateTimeFormat) : null; } if ($this->txtCheckNumber) { $this->txtCheckNumber->Text = $this->objStewardshipContribution->CheckNumber; } if ($this->lblCheckNumber) { $this->lblCheckNumber->Text = $this->objStewardshipContribution->CheckNumber; } if ($this->txtAuthorizationNumber) { $this->txtAuthorizationNumber->Text = $this->objStewardshipContribution->AuthorizationNumber; } if ($this->lblAuthorizationNumber) { $this->lblAuthorizationNumber->Text = $this->objStewardshipContribution->AuthorizationNumber; } if ($this->txtAlternateSource) { $this->txtAlternateSource->Text = $this->objStewardshipContribution->AlternateSource; } if ($this->lblAlternateSource) { $this->lblAlternateSource->Text = $this->objStewardshipContribution->AlternateSource; } if ($this->chkNonDeductibleFlag) { $this->chkNonDeductibleFlag->Checked = $this->objStewardshipContribution->NonDeductibleFlag; } if ($this->lblNonDeductibleFlag) { $this->lblNonDeductibleFlag->Text = $this->objStewardshipContribution->NonDeductibleFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->txtNote) { $this->txtNote->Text = $this->objStewardshipContribution->Note; } if ($this->lblNote) { $this->lblNote->Text = $this->objStewardshipContribution->Note; } if ($this->lstCreatedByLogin) { $this->lstCreatedByLogin->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstCreatedByLogin->AddItem(QApplication::Translate('- Select One -'), null); } $objCreatedByLoginArray = Login::LoadAll(); if ($objCreatedByLoginArray) { foreach ($objCreatedByLoginArray as $objCreatedByLogin) { $objListItem = new QListItem($objCreatedByLogin->__toString(), $objCreatedByLogin->Id); if ($this->objStewardshipContribution->CreatedByLogin && $this->objStewardshipContribution->CreatedByLogin->Id == $objCreatedByLogin->Id) { $objListItem->Selected = true; } $this->lstCreatedByLogin->AddItem($objListItem); } } } if ($this->lblCreatedByLoginId) { $this->lblCreatedByLoginId->Text = $this->objStewardshipContribution->CreatedByLogin ? $this->objStewardshipContribution->CreatedByLogin->__toString() : null; } if ($this->chkUnpostedFlag) { $this->chkUnpostedFlag->Checked = $this->objStewardshipContribution->UnpostedFlag; } if ($this->lblUnpostedFlag) { $this->lblUnpostedFlag->Text = $this->objStewardshipContribution->UnpostedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->lstCreditCardPayment) { $this->lstCreditCardPayment->RemoveAllItems(); $this->lstCreditCardPayment->AddItem(QApplication::Translate('- Select One -'), null); $objCreditCardPaymentArray = CreditCardPayment::LoadAll(); if ($objCreditCardPaymentArray) { foreach ($objCreditCardPaymentArray as $objCreditCardPayment) { $objListItem = new QListItem($objCreditCardPayment->__toString(), $objCreditCardPayment->Id); if ($objCreditCardPayment->StewardshipContributionId == $this->objStewardshipContribution->Id) { $objListItem->Selected = true; } $this->lstCreditCardPayment->AddItem($objListItem); } } } if ($this->lblCreditCardPayment) { $this->lblCreditCardPayment->Text = $this->objStewardshipContribution->CreditCardPayment ? $this->objStewardshipContribution->CreditCardPayment->__toString() : null; } }
protected function lstCheckingAccountLookups_Update() { if ($this->lstCheckingAccountLookups) { $this->objPerson->UnassociateAllCheckingAccountLookups(); $objSelectedListItems = $this->lstCheckingAccountLookups->SelectedItems; if ($objSelectedListItems) { foreach ($objSelectedListItems as $objListItem) { $this->objPerson->AssociateCheckingAccountLookup(CheckingAccountLookup::Load($objListItem->Value)); } } } }
public static function CreateFromCheckImage(Login $objLogin, StewardshipStack $objStack, $strCheckImageFileHash) { $objContribution = new StewardshipContribution(); $objContribution->CreatedByLogin = $objLogin; $objContribution->UnpostedFlag = true; $objContribution->StewardshipContributionTypeId = StewardshipContributionType::Check; $objContribution->StewardshipBatchId = $objStack->StewardshipBatchId; $objContribution->StewardshipStack = $objStack; $objContribution->DateEntered = QDateTime::Now(); $objContribution->DateCredited = new QDateTime($objStack->StewardshipBatch->DateCredited); $objContribution->strCheckImageFileHash = $strCheckImageFileHash; $arrTiffData = exif_read_data($objContribution->TempPath); if (array_key_exists('ImageDescription', $arrTiffData)) { $arrCheckingData = self::ParseCheckingInformation($arrTiffData['ImageDescription']); if ($arrCheckingData) { if (intval($arrCheckingData[2])) { $objContribution->CheckNumber = intval($arrCheckingData[2]); } $objCheckingAccountLookup = CheckingAccountLookup::LoadByTransitAndAccount($arrCheckingData[0], $arrCheckingData[1]); if ($objCheckingAccountLookup) { $objContribution->CheckingAccountLookup = $objCheckingAccountLookup; $objPersonArray = $objCheckingAccountLookup->GetPersonArray(); if (!count($objPersonArray)) { $objContribution->objPossiblePeopleArray = null; } else { if (count($objPersonArray) == 1) { $objContribution->Person = $objPersonArray[0]; } else { $objContribution->objPossiblePeopleArray = $objPersonArray; } } } else { $objContribution->objUnsavedCheckingAccountLookup = CheckingAccountLookup::CreateUnsavedForTransitAndAccount($arrCheckingData[0], $arrCheckingData[1]); } } } return $objContribution; }
public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) { if ($objObject->objPerson) { $objObject->objPerson = Person::GetSoapObjectFromObject($objObject->objPerson, false); } else { if (!$blnBindRelatedObjects) { $objObject->intPersonId = null; } } if ($objObject->objStewardshipBatch) { $objObject->objStewardshipBatch = StewardshipBatch::GetSoapObjectFromObject($objObject->objStewardshipBatch, false); } else { if (!$blnBindRelatedObjects) { $objObject->intStewardshipBatchId = null; } } if ($objObject->objStewardshipStack) { $objObject->objStewardshipStack = StewardshipStack::GetSoapObjectFromObject($objObject->objStewardshipStack, false); } else { if (!$blnBindRelatedObjects) { $objObject->intStewardshipStackId = null; } } if ($objObject->objCheckingAccountLookup) { $objObject->objCheckingAccountLookup = CheckingAccountLookup::GetSoapObjectFromObject($objObject->objCheckingAccountLookup, false); } else { if (!$blnBindRelatedObjects) { $objObject->intCheckingAccountLookupId = null; } } if ($objObject->dttDateEntered) { $objObject->dttDateEntered = $objObject->dttDateEntered->__toString(QDateTime::FormatSoap); } if ($objObject->dttDateCleared) { $objObject->dttDateCleared = $objObject->dttDateCleared->__toString(QDateTime::FormatSoap); } if ($objObject->dttDateCredited) { $objObject->dttDateCredited = $objObject->dttDateCredited->__toString(QDateTime::FormatSoap); } if ($objObject->objCreatedByLogin) { $objObject->objCreatedByLogin = Login::GetSoapObjectFromObject($objObject->objCreatedByLogin, false); } else { if (!$blnBindRelatedObjects) { $objObject->intCreatedByLoginId = null; } } return $objObject; }