public function btnSave_Click($strFormId, $strControlId, $strParameter) { $objStackArray = array(); foreach ($this->objBatch->GetStewardshipStackArray() as $objStack) { $objStackArray[$objStack->StackNumber] = $objStack; } $fltTotalAmount = 0; foreach ($this->txtReportedTotals as $txtReportedTotal) { if ($txtReportedTotal->Visible) { $intStackNumber = intval($txtReportedTotal->ActionParameter); if ($fltAmount = trim($txtReportedTotal->Text)) { $fltTotalAmount += $fltAmount; } else { $fltAmount = null; } if (array_key_exists($intStackNumber, $objStackArray)) { $objStack = $objStackArray[$intStackNumber]; } else { $objStack = new StewardshipStack(); $objStack->StewardshipBatch = $this->objBatch; $objStack->StackNumber = $intStackNumber; } $objStack->ReportedTotalAmount = $fltAmount; $objStack->Save(); } } $this->mctStewardshipBatch->StewardshipBatch->ReportedTotalAmount = $fltTotalAmount; $this->mctStewardshipBatch->SaveStewardshipBatch(); // iterate through Stewardship contributions in the batch and set the date credited $objContributionArray = $this->objBatch->GetStewardshipContributionArray(); foreach ($objContributionArray as $objContribution) { $objContribution->DateCredited = $this->calDateCredited->DateTime; $objContribution->save(); } $this->objForm->pnlBatchTitle->Refresh(); $this->objForm->pnlStacks_Refresh(); return $this->ReturnTo('#1'); }
public static function GenerateStewardship() { $dttDate = new QDateTime('2004-01-05'); print 'Generating Stewardship... '; $objFundArray = StewardshipFund::QueryArray(QQ::NotEqual(QQN::StewardshipFund()->Id, 1)); while ($dttDate->IsEarlierThan(QDateTime::Now())) { print $strDate = '[' . $dttDate->ToString('YYYY-MMM-DD') . ']'; $intCheckCount = rand(10, 55); $arrStack = array(); for ($i = 0; $i < floor(($intCheckCount - 1) / 25) + 1; $i++) { $arrStack[] = null; } $objBatch = StewardshipBatch::Create(self::GenerateFromArray(self::$StewardshipUserArray), $arrStack, self::GenerateFromArray(array('Weekend T/O', 'Weekend Giving', 'Tithes and Offerings', 'Tithes & Offerings', null)), $dttDate, $dttDate); $intStackCount = $objBatch->CountStewardshipStacks(); $dttStart = new QDateTime($dttDate); $dttStart->SetTime(8, 0, 0); $dttEnd = new QDateTime($dttDate); $dttEnd->SetTime(16, 0, 0); for ($i = 0; $i < $intStackCount; $i++) { if ($i == $intStackCount - 1) { if ($intCheckCount % 25 == 0) { $intChecksInStackCount = 25; } else { $intChecksInStackCount = $intCheckCount % 25; } } else { $intChecksInStackCount = 25; } $objStack = StewardshipStack::LoadByStewardshipBatchIdStackNumber($objBatch->Id, $i + 1); for ($j = 0; $j < $intChecksInStackCount; $j++) { $objHousehold = self::GenerateFromArray(self::$HouseholdArray); $objHouseholdParticipant = self::GenerateFromArray($objHousehold->GetHouseholdParticipationArray()); $mixAmountArray = array(); if (rand(0, 50)) { $mixAmountArray[] = array(1, rand(1000, 150000) / 100); } else { $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100); } if (!rand(0, 20)) { $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100); } $objContribution = StewardshipContribution::Create($objBatch->CreatedByLogin, $objHouseholdParticipant->Person, $objStack, StewardshipContributionType::Check, rand(1000, 9999), $mixAmountArray, self::GenerateDateTime($dttStart, $dttEnd), null, null, null, false); if (rand(0, 5)) { $objContribution->SaveImageFile(__DEVTOOLS_CLI__ . '/datagen_file_assets/check.tif'); } } $objStack->RefreshActualTotalAmount(); } if ($intCheckCount != $objBatch->CountStewardshipContributions()) { print "\r\n" . 'MISCOUNT: ' . $objBatch->Id . "\r\n"; } $objBatch->RefreshActualTotalAmount(); $dttDate->Day += 7; print str_repeat(chr(8) . ' ' . chr(8), strlen($strDate)); } print "Done.\r\n"; }
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/'); } } }
/** * Creates a new stack for this batch * @param float $fltReportedTotalAmount optional * @return StewardshipStack */ public function CreateStack($fltReportedTotalAmount = null) { $objStack = new StewardshipStack(); $objStack->StewardshipBatch = $this; $objStack->StackNumber = $this->CountStewardshipStacks() + 1; $objStack->ReportedTotalAmount = $fltReportedTotalAmount; $objStack->ActualTotalAmount = 0; $objStack->Save(); return $objStack; }
print "\r\nWhat!? Household " . $objHousehold->Id . " has a marriage count of " . count($objMarriedPersonArray) . "!\r\n"; } } $objHousehold->Save(); } QDataGen::DisplayForEachTaskEnd('Refreshing Household data'); $objStewardshipCursor = StewardshipContribution::QueryCursor(QQ::All()); QDataGEn::DisplayForEachTaskStart('Refreshing Contributions', StewardshipContribution::CountAll()); while ($objContribution = StewardshipContribution::InstantiateCursor($objStewardshipCursor)) { QDataGen::DisplayForEachTaskNext('Refreshing Contributions'); $objContribution->RefreshTotalAmount(); } QDataGen::DisplayForEachTaskEnd('Refreshing Contributions'); $objStewardshipCursor = StewardshipStack::QueryCursor(QQ::All()); QDataGEn::DisplayForEachTaskStart('Refreshing Stacks', StewardshipStack::CountAll()); while ($objStack = StewardshipStack::InstantiateCursor($objStewardshipCursor)) { QDataGen::DisplayForEachTaskNext('Refreshing Stacks'); $objStack->RefreshActualTotalAmount(); } QDataGen::DisplayForEachTaskEnd('Refreshing Stacks'); $objStewardshipCursor = StewardshipBatch::QueryCursor(QQ::All()); QDataGEn::DisplayForEachTaskStart('Refreshing Batches', StewardshipBatch::CountAll()); while ($objBatch = StewardshipBatch::InstantiateCursor($objStewardshipCursor)) { QDataGen::DisplayForEachTaskNext('Refreshing Batches'); $objBatch->PostBalance(Login::Load(1)); } QDataGen::DisplayForEachTaskEnd('Refreshing Batches'); $objStewardshipCursor = StewardshipPledge::QueryCursor(QQ::All()); QDataGEn::DisplayForEachTaskStart('Refreshing Pledges', StewardshipPledge::CountAll()); while ($objPledge = StewardshipPledge::InstantiateCursor($objStewardshipCursor)) { QDataGen::DisplayForEachTaskNext('Refreshing Pledges');
/** * 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; } }
public function Form_ProcessHash() { // /stewardship/batch.php/X#Y/verb/Z // X = Batch ID // Y = Stack # (*NOT* Stack ID) // Cleanup and Tokenize UrlHash Contents $strUrlHash = trim(strtolower($this->strUrlHash)); $strUrlHashTokens = explode('/', $strUrlHash); // Get Values $intStackNumber = $strUrlHashTokens[0]; $strCommand = array_key_exists(1, $strUrlHashTokens) ? $strUrlHashTokens[1] : null; $strUrlHashArgument = array_key_exists(2, $strUrlHashTokens) ? $strUrlHashTokens[2] : null; $strUrlHashArgument2 = array_key_exists(3, $strUrlHashTokens) ? $strUrlHashTokens[3] : null; $strUrlHashArgument3 = array_key_exists(4, $strUrlHashTokens) ? $strUrlHashTokens[4] : null; // Did we switch the stack? if (!$this->objStack || $this->objStack->StackNumber != $intStackNumber) { // Save the "Old" Stack (if applicable) $objOldStack = null; if ($this->objStack) { $objOldStack = $this->objStack; } // Set the "New" stack (and validate!) if ($intStackNumber) { $this->objStack = StewardshipStack::LoadByStewardshipBatchIdStackNumber($this->objBatch->Id, $intStackNumber); if (!$this->objStack) { QApplication::Redirect('/stewardship/'); } } else { $this->objStack = null; } // Refresh teh DataGrid and Stack in the stacklist $this->dtgContributions_Refresh(); if ($this->objStack) { $this->pnlStack_Refresh($this->objStack); } if ($objOldStack) { $this->pnlStack_Refresh($objOldStack); } $this->pnlContent->CssClass = $this->objStack ? 'stewardshipContent' : null; } $this->pnlContent->RemoveChildControls(true); // Setup the Command if (!$strCommand) { $strCommand = 'view'; } $strClassName = sprintf('CpStewardship_%s', QString::ConvertToCamelCase($strCommand)); if (class_exists($strClassName, true)) { new $strClassName($this->pnlContent, 'content', $this->objBatch, $this->objStack, $strUrlHashArgument, $strUrlHashArgument2, $strUrlHashArgument3); QApplication::ExecuteJavaScript('ScrollToBottom();'); } else { QApplication::Redirect('#1'); } }
/** * Deletes all associated StewardshipStacks * @return void */ public function DeleteAllStewardshipStacks() { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateStewardshipStack on this unsaved StewardshipBatch.'); } // Get the Database Object for this Class $objDatabase = StewardshipBatch::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (StewardshipStack::LoadArrayByStewardshipBatchId($this->intId) as $objStewardshipStack) { $objStewardshipStack->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `stewardship_stack` WHERE `stewardship_batch_id` = ' . $objDatabase->SqlVariable($this->intId) . ' '); }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, StewardshipStack::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 = StewardshipStack::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 StewardshipStack, given the clauses above $this->DataSource = StewardshipStack::QueryArray($objCondition, $objClauses); }
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; }
/** * 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()); }