本文整理汇总了PHP中Transaction::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Transaction::Load方法的具体用法?PHP Transaction::Load怎么用?PHP Transaction::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction::Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetupTransaction
protected function SetupTransaction()
{
// Lookup Object PK information from Query String (if applicable)
// Set mode to Edit or New depending on what's found
$intTransactionId = QApplication::QueryString('intTransactionId');
if ($intTransactionId) {
$this->objTransaction = Transaction::Load($intTransactionId);
if (!$this->objTransaction) {
throw new Exception('Could not find a Transaction object with PK arguments: ' . $intTransactionId);
}
//$this->strTitleVerb = QApplication::Translate('Edit');
$this->blnEditMode = true;
} else {
$this->objTransaction = new Transaction();
//$this->strTitleVerb = QApplication::Translate('Create');
$this->blnEditMode = false;
}
}
示例2: __get
//.........这里部分代码省略.........
*/
return $this->intCreatedBy;
case 'CreationDate':
/**
* Gets the value for dttCreationDate
* @return QDateTime
*/
return $this->dttCreationDate;
case 'ModifiedBy':
/**
* Gets the value for intModifiedBy
* @return integer
*/
return $this->intModifiedBy;
case 'ModifiedDate':
/**
* Gets the value for strModifiedDate (Read-Only Timestamp)
* @return string
*/
return $this->strModifiedDate;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Transaction':
/**
* Gets the value for the Transaction object referenced by intTransactionId (Unique)
* @return Transaction
*/
try {
if (!$this->objTransaction && !is_null($this->intTransactionId)) {
$this->objTransaction = Transaction::Load($this->intTransactionId);
}
return $this->objTransaction;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'FromCompany':
/**
* Gets the value for the Company object referenced by intFromCompanyId (Not Null)
* @return Company
*/
try {
if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) {
$this->objFromCompany = Company::Load($this->intFromCompanyId);
}
return $this->objFromCompany;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'FromContact':
/**
* Gets the value for the Contact object referenced by intFromContactId (Not Null)
* @return Contact
*/
try {
if (!$this->objFromContact && !is_null($this->intFromContactId)) {
$this->objFromContact = Contact::Load($this->intFromContactId);
}
return $this->objFromContact;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
示例3: UpdateShipmentFields
protected function UpdateShipmentFields()
{
if (!$this->blnEditMode) {
//$this->objShipment->TransactionId = $this->objTransaction->TransactionId;
$this->objShipment->Transaction = $this->objTransaction;
}
if ($this->blnEditMode) {
if (!$this->objTransaction) {
$this->objTransaction = Transaction::Load($this->objShipment->TransactionId);
}
$this->objShipment->Transaction = $this->objTransaction;
$this->objShipment->ShipmentNumber = $this->lblShipmentNumber->Text;
} elseif (QApplication::$TracmorSettings->CustomShipmentNumbers) {
$this->objShipment->ShipmentNumber = $this->txtShipmentNumber->Text;
} else {
$this->objShipment->ShipmentNumber = Shipment::LoadNewShipmentNumber();
}
$this->objShipment->ToContactId = $this->lstToContact->SelectedValue;
$this->objShipment->FromCompanyId = $this->lstFromCompany->SelectedValue;
$this->objShipment->FromContactId = $this->lstFromContact->SelectedValue;
$this->objShipment->ShipDate = $this->calShipDate->DateTime;
$this->objShipment->FromAddressId = $this->lstFromAddress->SelectedValue;
$this->objShipment->ToCompanyId = $this->lstToCompany->SelectedValue;
$this->objShipment->ToAddressId = $this->lstToAddress->SelectedValue;
$this->objShipment->CourierId = $this->lstCourier->SelectedValue;
//if (!$this->lstCourier->SelectedValue) {
$this->objShipment->TrackingNumber = $this->txtTrackingNumber->Text;
//}
// Reload the Assets and inventory locations so that they don't trigger an OLE if completing the shipment without reloading after adding an asset or inventory.
if ($this->objAssetTransactionArray) {
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
$objAssetTransaction->Asset = Asset::Load($objAssetTransaction->AssetId);
}
}
if ($this->objInventoryTransactionArray) {
foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
$objInventoryTransaction->InventoryLocation = InventoryLocation::Load($objInventoryTransaction->InventoryLocationId);
}
}
}
示例4: btnMassDeleteConfirm_Click
protected function btnMassDeleteConfirm_Click()
{
if (count($this->arrToDelete) > 0) {
foreach ($this->arrToDelete as $shipment) {
$objTransaction = Transaction::Load($shipment->TransactionId);
$objTransaction->Delete();
}
$this->arrToDelete = array();
}
$this->dlgMassDelete->HideDialogBox();
QApplication::Redirect('');
}
示例5: __get
/**
* 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 'AssetTransactionId':
// Gets the value for intAssetTransactionId (Read-Only PK)
// @return integer
return $this->intAssetTransactionId;
case 'AssetId':
// Gets the value for intAssetId (Not Null)
// @return integer
return $this->intAssetId;
case 'TransactionId':
// Gets the value for intTransactionId (Not Null)
// @return integer
return $this->intTransactionId;
case 'ParentAssetTransactionId':
// Gets the value for intParentAssetTransactionId
// @return integer
return $this->intParentAssetTransactionId;
case 'SourceLocationId':
// Gets the value for intSourceLocationId
// @return integer
return $this->intSourceLocationId;
case 'DestinationLocationId':
// Gets the value for intDestinationLocationId
// @return integer
return $this->intDestinationLocationId;
case 'NewAssetFlag':
// Gets the value for blnNewAssetFlag
// @return boolean
return $this->blnNewAssetFlag;
case 'NewAssetId':
// Gets the value for intNewAssetId
// @return integer
return $this->intNewAssetId;
case 'ScheduleReceiptFlag':
// Gets the value for blnScheduleReceiptFlag
// @return boolean
return $this->blnScheduleReceiptFlag;
case 'ScheduleReceiptDueDate':
// Gets the value for dttScheduleReceiptDueDate
// @return QDateTime
return $this->dttScheduleReceiptDueDate;
case 'CreatedBy':
// Gets the value for intCreatedBy
// @return integer
return $this->intCreatedBy;
case 'CreationDate':
// Gets the value for dttCreationDate
// @return QDateTime
return $this->dttCreationDate;
case 'ModifiedBy':
// Gets the value for intModifiedBy
// @return integer
return $this->intModifiedBy;
case 'ModifiedDate':
// Gets the value for strModifiedDate (Read-Only Timestamp)
// @return string
return $this->strModifiedDate;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Asset':
// Gets the value for the Asset object referenced by intAssetId (Not Null)
// @return Asset
try {
if (!$this->objAsset && !is_null($this->intAssetId)) {
$this->objAsset = Asset::Load($this->intAssetId);
}
return $this->objAsset;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'Transaction':
// Gets the value for the Transaction object referenced by intTransactionId (Not Null)
// @return Transaction
try {
if (!$this->objTransaction && !is_null($this->intTransactionId)) {
$this->objTransaction = Transaction::Load($this->intTransactionId);
}
return $this->objTransaction;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'ParentAssetTransaction':
//.........这里部分代码省略.........
示例6: __get
/**
* 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 'ShipmentId':
// Gets the value for intShipmentId (Read-Only PK)
// @return integer
return $this->intShipmentId;
case 'ShipmentNumber':
// Gets the value for strShipmentNumber (Unique)
// @return string
return $this->strShipmentNumber;
case 'TransactionId':
// Gets the value for intTransactionId (Unique)
// @return integer
return $this->intTransactionId;
case 'FromCompanyId':
// Gets the value for intFromCompanyId (Not Null)
// @return integer
return $this->intFromCompanyId;
case 'FromContactId':
// Gets the value for intFromContactId (Not Null)
// @return integer
return $this->intFromContactId;
case 'FromAddressId':
// Gets the value for intFromAddressId (Not Null)
// @return integer
return $this->intFromAddressId;
case 'ToCompanyId':
// Gets the value for intToCompanyId (Not Null)
// @return integer
return $this->intToCompanyId;
case 'ToContactId':
// Gets the value for intToContactId (Not Null)
// @return integer
return $this->intToContactId;
case 'ToAddressId':
// Gets the value for intToAddressId (Not Null)
// @return integer
return $this->intToAddressId;
case 'CourierId':
// Gets the value for intCourierId
// @return integer
return $this->intCourierId;
case 'TrackingNumber':
// Gets the value for strTrackingNumber
// @return string
return $this->strTrackingNumber;
case 'ShipDate':
// Gets the value for dttShipDate (Not Null)
// @return QDateTime
return $this->dttShipDate;
case 'ShippedFlag':
// Gets the value for blnShippedFlag
// @return boolean
return $this->blnShippedFlag;
case 'CreatedBy':
// Gets the value for intCreatedBy
// @return integer
return $this->intCreatedBy;
case 'CreationDate':
// Gets the value for dttCreationDate
// @return QDateTime
return $this->dttCreationDate;
case 'ModifiedBy':
// Gets the value for intModifiedBy
// @return integer
return $this->intModifiedBy;
case 'ModifiedDate':
// Gets the value for strModifiedDate (Read-Only Timestamp)
// @return string
return $this->strModifiedDate;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Transaction':
// Gets the value for the Transaction object referenced by intTransactionId (Unique)
// @return Transaction
try {
if (!$this->objTransaction && !is_null($this->intTransactionId)) {
$this->objTransaction = Transaction::Load($this->intTransactionId);
}
return $this->objTransaction;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'FromCompany':
//.........这里部分代码省略.........
示例7: btnEdit_Click
public function btnEdit_Click($strFormId, $strControlId, $strParameter)
{
$strParameterArray = explode(',', $strParameter);
$objTransaction = Transaction::Load($strParameterArray[0]);
$objEditPanel = new TransactionEditPanel($this, $this->strCloseEditPanelMethod, $objTransaction);
$strMethodName = $this->strSetEditPanelMethod;
$this->objForm->{$strMethodName}($objEditPanel);
}
示例8: __get
//.........这里部分代码省略.........
*/
return $this->intCreatedBy;
case 'CreationDate':
/**
* Gets the value for dttCreationDate
* @return QDateTime
*/
return $this->dttCreationDate;
case 'ModifiedBy':
/**
* Gets the value for intModifiedBy
* @return integer
*/
return $this->intModifiedBy;
case 'ModifiedDate':
/**
* Gets the value for strModifiedDate (Read-Only Timestamp)
* @return string
*/
return $this->strModifiedDate;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Asset':
/**
* Gets the value for the Asset object referenced by intAssetId (Not Null)
* @return Asset
*/
try {
if (!$this->objAsset && !is_null($this->intAssetId)) {
$this->objAsset = Asset::Load($this->intAssetId);
}
return $this->objAsset;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'Transaction':
/**
* Gets the value for the Transaction object referenced by intTransactionId (Not Null)
* @return Transaction
*/
try {
if (!$this->objTransaction && !is_null($this->intTransactionId)) {
$this->objTransaction = Transaction::Load($this->intTransactionId);
}
return $this->objTransaction;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'ParentAssetTransaction':
/**
* Gets the value for the AssetTransaction object referenced by intParentAssetTransactionId
* @return AssetTransaction
*/
try {
if (!$this->objParentAssetTransaction && !is_null($this->intParentAssetTransactionId)) {
$this->objParentAssetTransaction = AssetTransaction::Load($this->intParentAssetTransactionId);
}
return $this->objParentAssetTransaction;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
示例9: __get
//.........这里部分代码省略.........
*/
return $this->intLocalWarehouseStock;
case 'BadProductsWarehouseStock':
/**
* Gets the value for bad_products_warehouse_stock
* @return integer
*/
return $this->intBadProductsWarehouseStock;
case 'SampleWarehouseStock':
/**
* Gets the value for sample_warehouse_stock
* @return integer
*/
return $this->intSampleWarehouseStock;
case 'RepairWarehouseStock':
/**
* Gets the value for repair_warehouse_stock
* @return integer
*/
return $this->intRepairWarehouseStock;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'InventoryLocation':
/**
* Gets the value for the InventoryLocation object referenced by intInventoryLocationId (Not Null)
* @return InventoryLocation
*/
try {
if (!$this->objInventoryLocation && !is_null($this->intInventoryLocationId)) {
$this->objInventoryLocation = InventoryLocation::Load($this->intInventoryLocationId);
}
return $this->objInventoryLocation;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'Transaction':
/**
* Gets the value for the Transaction object referenced by intTransactionId (Not Null)
* @return Transaction
*/
try {
if (!$this->objTransaction && !is_null($this->intTransactionId)) {
$this->objTransaction = Transaction::Load($this->intTransactionId);
}
return $this->objTransaction;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'SourceLocation':
/**
* Gets the value for the Location object referenced by intSourceLocationId
* @return Location
*/
try {
if (!$this->objSourceLocation && !is_null($this->intSourceLocationId)) {
$this->objSourceLocation = Location::Load($this->intSourceLocationId);
}
return $this->objSourceLocation;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
示例10: btnApply_Click
public function btnApply_Click($strFormId, $strControlId, $strParameter)
{
$this->clearWarnings();
$blnError = false;
// Get an instance of the database
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
if (count($this->arrCustomFields) > 0) {
$customFieldIdArray = array();
// preparing data to edit
foreach ($this->arrCustomFields as $field) {
if ($this->arrCheckboxes[$field['input']->strControlId]->Checked) {
if ($field['input'] instanceof QTextBox && $field['input']->Required && $field['input']->Text == null || $field['input'] instanceof QListBox && $field['input']->Required && $field['input']->SelectedValue == null) {
$blnError = true;
$field['input']->Warning = "Required.";
} else {
$this->arrCustomFieldsToEdit[] = $field;
$customFieldIdArray[] = (int) str_replace('cf', '', $field['input']->strControlId);
}
}
}
}
// Apply checked main_table fields
$set = array(sprintf('`modified_by`= %s', QApplication::$objUserAccount->UserAccountId));
if ($this->chkToCompany->Checked) {
if ($this->lstToContact->SelectedValue) {
$set[] = sprintf('`to_contact_id`="%s"', $this->lstToContact->SelectedValue);
} else {
$this->lstToContact->Warning = 'Contact name must be chosen';
$blnError = true;
}
if ($this->lstToAddress->SelectedValue) {
$set[] = sprintf('`to_address_id`="%s"', $this->lstToAddress->SelectedValue);
} else {
$this->lstToAddress->Warning = 'Address name must be chosen';
$blnError = true;
}
}
if ($this->chkFromCompany->Checked) {
if ($this->lstFromCompany->SelectedValue) {
$set[] = sprintf('`from_company_id`="%s"', $this->lstFromCompany->SelectedValue);
} else {
$this->lstFromCompany->Warning = 'Company name must be chosen';
$blnError = true;
}
if ($this->lstFromContact->SelectedValue) {
$set[] = sprintf('`from_contact_id`="%s"', $this->lstFromContact->SelectedValue);
} else {
$this->lstFromContact->Warning = 'Contact name must be chosen';
$blnError = true;
}
}
if ($this->chkDateReceived->Checked && $this->calDateReceived->DateTime) {
// Check all receipts are completed
if (Receipt::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Receipt()->ReceivedFlag, 0), QQ::In(QQN::Receipt()->ReceiptId, $this->arrReceiptToEdit))) > 0) {
$this->calDateReceived->Warning = 'Can be set only for completed receipts';
$blnError = true;
} else {
$set[] = sprintf('`receipt_date`="%s"', $this->calDateReceived->DateTime->__toString('YYYY-MM-DD'));
}
}
if ($this->chkDateDue->Checked && $this->calDateDue->DateTime) {
$set[] = sprintf('`due_date`="%s"', $this->calDateDue->DateTime->__toString('YYYY-MM-DD'));
}
if (!$blnError) {
try {
// Modifying transactions
foreach ($this->arrReceiptToEdit as $intReceiptId) {
$objTransaction = Transaction::Load(Receipt::Load($intReceiptId)->Transaction->TransactionId);
$objTransaction->ModifiedBy = QApplication::$objUserAccount->UserAccountId;
if ($this->chkNote->Checked) {
$objTransaction->Note = $this->txtNote->Text;
}
$objTransaction->Save();
}
if (count($this->arrCustomFieldsToEdit) > 0) {
// Save the values from all of the custom field controls to save the asset
foreach ($this->arrReceiptToEdit as $intReceiptId) {
$objCustomFieldsArray = CustomField::LoadObjCustomFieldArray(EntityQtype::Receipt, false);
$selectedCustomFieldsArray = array();
foreach ($objCustomFieldsArray as $objCustomField) {
if (in_array($objCustomField->CustomFieldId, $customFieldIdArray)) {
$selectedCustomFieldsArray[] = $objCustomField;
}
}
CustomField::SaveControls($selectedCustomFieldsArray, true, $this->arrCustomFieldsToEdit, $intReceiptId, EntityQtype::Receipt);
}
$this->arrCustomFieldsToEdit = array();
}
// Update Transaction
// Update main table
$strQuery = sprintf("UPDATE `receipt`\n SET " . implode(",", $set) . "\n WHERE `receipt_id` IN (%s)", implode(",", $this->arrReceiptToEdit));
$objDatabase->NonQuery($strQuery);
$objDatabase->TransactionCommit();
QApplication::Redirect('');
} catch (QMySqliDatabaseException $objExc) {
$objDatabase->TransactionRollback();
throw new QDatabaseException();
}
//.........这里部分代码省略.........
示例11: receiptDelete
public function receiptDelete(Receipt $receipt)
{
$objAssetTransactionArray = AssetTransaction::LoadArrayByTransactionId($receipt->TransactionId);
$objInventoryTransactionArray = InventoryTransaction::LoadArrayByTransactionId($receipt->TransactionId);
// Take out the inventory from the TBR InventoryLocation
if ($objInventoryTransactionArray) {
foreach ($objInventoryTransactionArray as $objInventoryTransaction) {
$objInventoryTransaction->InventoryLocation->Quantity -= $objInventoryTransaction->Quantity;
$objInventoryTransaction->InventoryLocation->Save();
}
}
// Delete any assets that were created while scheduling this receipt
if ($objAssetTransactionArray) {
foreach ($objAssetTransactionArray as $objAssetTransaction) {
if ($objAssetTransaction->NewAssetFlag) {
$objAssetTransaction->Asset->Delete();
}
}
}
// Load the Transaction
$objTransaction = Transaction::Load($receipt->TransactionId);
// Delete the Transaction Object and let it MySQL CASCADE down to asset_transaction, inventory_transaction, and receipt
$objTransaction->Delete();
}
示例12: Create
/**
* 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 TransactionMetaControl
* @param integer $intTransactionId primary key value
* @param QMetaControlCreateType $intCreateType rules governing Transaction object creation - defaults to CreateOrEdit
* @return TransactionMetaControl
*/
public static function Create($objParentObject, $intTransactionId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
{
// Attempt to Load from PK Arguments
if (strlen($intTransactionId)) {
$objTransaction = Transaction::Load($intTransactionId);
// Transaction was found -- return it!
if ($objTransaction) {
return new TransactionMetaControl($objParentObject, $objTransaction);
} else {
if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
throw new QCallerException('Could not find a Transaction object with PK arguments: ' . $intTransactionId);
}
}
// 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 TransactionMetaControl($objParentObject, new Transaction());
}
示例13: btnApply_Click
public function btnApply_Click($strFormId, $strControlId, $strParameter)
{
$this->clearWarnings();
$blnError = false;
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
// Check "Contact To", "Contact From", "Coutrier" wasn't changed for shipped items
if (Shipment::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Shipment()->ShippedFlag, 1), QQ::In(QQN::Shipment()->ShipmentId, $this->arrShipmentToEdit))) > 0 && ($this->chkToCompany->Checked || $this->chkFromCompany->Checked || $this->chkCourier->Checked)) {
$this->lblWarning->Text = '"To Company", "From Company", "Courier" shouldn\'t be changed for already
Shipped items';
$blnError = true;
}
if (!$blnError) {
// Apply checked main_table fields
$set = array(sprintf('`modified_by`= %s', QApplication::$objUserAccount->UserAccountId));
if ($this->chkToCompany->Checked) {
if ($this->lstToCompany->SelectedValue) {
$set[] = sprintf('`to_company_id`="%s"', $this->lstToCompany->SelectedValue);
} else {
$this->lstToCompany->Warning = 'Company name must be chosen';
$blnError = true;
}
if ($this->lstToContact->SelectedValue) {
$set[] = sprintf('`to_contact_id`="%s"', $this->lstToContact->SelectedValue);
} else {
$this->lstToContact->Warning = 'Contact name must be chosen';
$blnError = true;
}
if ($this->lstToAddress->SelectedValue) {
$set[] = sprintf('`to_address_id`="%s"', $this->lstToAddress->SelectedValue);
} else {
$this->lstToContact->Warning = 'Address name must be chosen';
$blnError = true;
}
}
if ($this->chkFromCompany->Checked) {
if ($this->lstFromCompany->SelectedValue) {
$set[] = sprintf('`from_company_id`="%s"', $this->lstFromCompany->SelectedValue);
} else {
$this->lstFromCompany->Warning = 'Company name must be chosen';
$blnError = true;
}
if ($this->lstFromContact->SelectedValue) {
$set[] = sprintf('`from_contact_id`="%s"', $this->lstFromContact->SelectedValue);
} else {
$this->lstFromContact->Warning = 'Contact name must be chosen';
$blnError = true;
}
if ($this->lstFromAddress->SelectedValue) {
$set[] = sprintf('`from_address_id`="%s"', $this->lstFromAddress->SelectedValue);
} else {
$this->lstFromAddress->Warning = 'Address name must be chosen';
$blnError = true;
}
}
if ($this->chkCourier->Checked) {
$set[] = sprintf('`courier_id`="%s"', $this->lstCourier->SelectedValue);
}
if ($this->chkShipDate->Checked && $this->calShipDate->DateTime) {
$set[] = sprintf('`ship_date`="%s"', $this->calShipDate->DateTime->__toString('YYYY-MM-DD'));
}
}
if (count($this->arrCustomFields) > 0) {
$customFieldIdArray = array();
foreach ($this->arrCustomFields as $field) {
if ($this->arrCheckboxes[$field['input']->strControlId]->Checked) {
if ($field['input'] instanceof QTextBox && $field['input']->Required && $field['input']->Text == null || $field['input'] instanceof QListBox && $field['input']->Required && $field['input']->SelectedValue == null) {
$blnError = true;
$field['input']->Warning = "Required.";
} else {
$this->arrCustomFieldsToEdit[] = $field;
$customFieldIdArray[] = (int) str_replace('cf', '', $field['input']->strControlId);
}
}
}
}
// Apdate main table
if (!$blnError) {
try {
// Edit Transactions
foreach ($this->arrShipmentToEdit as $intShipmetId) {
$objTransaction = Transaction::Load(Shipment::Load($intShipmetId)->Transaction->TransactionId);
$objTransaction->ModifiedBy = QApplication::$objUserAccount->UserAccountId;
if ($this->chkNote->Checked) {
$objTransaction->Note = $this->txtNote->Text;
}
$objTransaction->Save();
}
if (count($this->arrCustomFieldsToEdit) > 0) {
// preparing data to edit
// Save the values from all of the custom field controls to save the asset
foreach ($this->arrShipmentToEdit as $intShipmentId) {
$objCustomFieldsArray = CustomField::LoadObjCustomFieldArray(EntityQtype::Shipment, false);
$selectedCustomFieldsArray = array();
foreach ($objCustomFieldsArray as $objCustomField) {
if (in_array($objCustomField->CustomFieldId, $customFieldIdArray)) {
$selectedCustomFieldsArray[] = $objCustomField;
}
}
//.........这里部分代码省略.........
示例14: __get
//.........这里部分代码省略.........
*/
return $this->intCreatedBy;
case 'CreationDate':
/**
* Gets the value for dttCreationDate
* @return QDateTime
*/
return $this->dttCreationDate;
case 'ModifiedBy':
/**
* Gets the value for intModifiedBy
* @return integer
*/
return $this->intModifiedBy;
case 'ModifiedDate':
/**
* Gets the value for strModifiedDate (Read-Only Timestamp)
* @return string
*/
return $this->strModifiedDate;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Transaction':
/**
* Gets the value for the Transaction object referenced by intTransactionId (Unique)
* @return Transaction
*/
try {
if (!$this->objTransaction && !is_null($this->intTransactionId)) {
$this->objTransaction = Transaction::Load($this->intTransactionId);
}
return $this->objTransaction;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'FromCompany':
/**
* Gets the value for the Company object referenced by intFromCompanyId (Not Null)
* @return Company
*/
try {
if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) {
$this->objFromCompany = Company::Load($this->intFromCompanyId);
}
return $this->objFromCompany;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'FromContact':
/**
* Gets the value for the Contact object referenced by intFromContactId (Not Null)
* @return Contact
*/
try {
if (!$this->objFromContact && !is_null($this->intFromContactId)) {
$this->objFromContact = Contact::Load($this->intFromContactId);
}
return $this->objFromContact;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
示例15: Reload
/**
* Reload this Transaction 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 Transaction object.');
}
// Reload the Object
$objReloaded = Transaction::Load($this->intTransactionId);
// Update $this's local variables to match
$this->EntityQtypeId = $objReloaded->EntityQtypeId;
$this->TransactionTypeId = $objReloaded->TransactionTypeId;
$this->strNote = $objReloaded->strNote;
$this->CreatedBy = $objReloaded->CreatedBy;
$this->dttCreationDate = $objReloaded->dttCreationDate;
$this->ModifiedBy = $objReloaded->ModifiedBy;
$this->strModifiedDate = $objReloaded->strModifiedDate;
}