本文整理汇总了PHP中Shipment::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Shipment::Load方法的具体用法?PHP Shipment::Load怎么用?PHP Shipment::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shipment
的用法示例。
在下文中一共展示了Shipment::Load方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetupShipment
protected function SetupShipment()
{
// Lookup Object PK information from Query String (if applicable)
// Set mode to Edit or New depending on what's found
$intShipmentId = QApplication::QueryString('intShipmentId');
if ($intShipmentId) {
$this->objShipment = Shipment::Load($intShipmentId);
if (!$this->objShipment) {
throw new Exception('Could not find a Shipment object with PK arguments: ' . $intShipmentId);
}
}
}
示例2: SetupShipment
protected function SetupShipment()
{
// Lookup Object PK information from Query String (if applicable)
// Set mode to Edit or New depending on what's found
$intShipmentId = QApplication::QueryString('intShipmentId');
if ($intShipmentId) {
$this->objShipment = Shipment::Load($intShipmentId);
if (!$this->objShipment) {
throw new Exception('Could not find a Shipment object with PK arguments: ' . $intShipmentId);
}
$this->strTitleVerb = QApplication::Translate('Edit');
$this->blnEditMode = true;
} else {
$this->objShipment = new Shipment();
$this->strTitleVerb = QApplication::Translate('Create');
$this->blnEditMode = false;
}
}
示例3: LoadArrayByShipmentId
/**
* Load an array of Item objects by ShipmentId
*
* @param string $intShipmentId
* @return Array
*/
public static function LoadArrayByShipmentId($intShipmentId, $strOrderBy = null, $strLimit = null, $objExpansionMap = null)
{
Item::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $objDatabase);
$objShipment = Shipment::Load($intShipmentId);
$strQuery = sprintf("\r\n\t\t\t\tSELECT \r\n\t\t\t\t\tasset_model.short_description AS short_description,\r\n\t\t\t\t\tasset.asset_code AS code,\r\n\t\t\t\t\t'1' AS quantity,\r\n\t\t\t\t\t(\r\n\t\t\t\t\tSELECT \r\n\t\t\t\t\t\treceipt.receipt_number \r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t\treceipt,\r\n\t\t\t\t\t\ttransaction,\r\n\t\t\t\t\t\tasset_transaction at\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\treceipt.transaction_id = transaction.transaction_id\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t\tat.transaction_id = transaction.transaction_id\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t\tat.parent_asset_transaction_id = asset_transaction.asset_transaction_id\t\t\t\t\t\r\n\t\t\t\t\t) AS receipt_number\r\n\t\t\t\tFROM \r\n\t\t\t\t\tasset_transaction \r\n\t\t\t\t\tLEFT JOIN asset ON asset_transaction.asset_id = asset.asset_id\r\n\t\t\t\t\tLEFT JOIN asset_model ON asset.asset_model_id = asset_model.asset_model_id\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tasset_transaction.transaction_id = %s\r\n\t\t\t\tUNION\r\n\t\t\t\tSELECT \r\n\t\t\t\t\tinventory_model.short_description AS short_description, \r\n\t\t\t\t\tinventory_model.inventory_model_code AS code, \r\n\t\t\t\t\tinventory_transaction.quantity AS quantity,\r\n\t\t\t\t\t'' AS receipt_number\r\n\t\t\t\tFROM \r\n\t\t\t\t\tinventory_transaction\r\n\t\t\t\t\tLEFT JOIN inventory_location ON inventory_transaction.inventory_location_id = inventory_location.inventory_location_id\r\n\t\t\t\t\tLEFT JOIN inventory_model ON inventory_location.inventory_model_id = inventory_model.inventory_model_id\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tinventory_transaction.transaction_id = %s\r\n\t\t\t", $objShipment->TransactionId, $objShipment->TransactionId);
$objDbResult = $objDatabase->Query($strQuery);
return Item::InstantiateDbResult($objDbResult);
}
示例4: UpdateTransactionFields
protected function UpdateTransactionFields()
{
$this->objTransaction->EntityQtypeId = $this->lstEntityQtype->SelectedValue;
$this->objTransaction->TransactionTypeId = $this->lstTransactionType->SelectedValue;
$this->objTransaction->Note = $this->txtNote->Text;
$this->objTransaction->CreatedBy = $this->lstCreatedByObject->SelectedValue;
$this->objTransaction->CreationDate = $this->calCreationDate->DateTime;
$this->objTransaction->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
$this->objTransaction->Receipt = Receipt::Load($this->lstReceipt->SelectedValue);
$this->objTransaction->Shipment = Shipment::Load($this->lstShipment->SelectedValue);
}
示例5: btnMassDelete_Click
protected function btnMassDelete_Click()
{
$items = $this->dtgShipment->getSelected('ShipmentId');
if (count($items) > 0) {
$this->lblWarning->Text = "";
$arrToSkip = array();
// Separating items able to be deleted
foreach ($items as $item) {
$shipmentToDelete = Shipment::Load($item);
if ($shipmentToDelete instanceof Shipment && !$shipmentToDelete->ShippedFlag) {
$this->arrToDelete[] = $shipmentToDelete;
// objects stored in array!
} else {
$arrToSkip[] = $shipmentToDelete->ShipmentNumber;
}
}
if (count($arrToSkip) > 0) {
if (count($arrToSkip) == 1) {
$toBe = 'is';
$ending = '';
} else {
$toBe = 'are';
$ending = 's';
}
$this->dlgMassDelete->Text = sprintf("There %s %s Shipment%s that %s not able to be deleted.\n Would you like to continue the deletion process,\n skipping these item%s?<br />", $toBe, count($arrToSkip), $ending, $toBe, $ending);
$this->dlgMassDelete->ShowDialogBox();
} else {
if (count($this->arrToDelete) > 0) {
try {
// Get an instance of the database
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
foreach ($this->arrToDelete as $shipment) {
$objTransaction = Transaction::Load($shipment->TransactionId);
$objTransaction->Delete();
}
$objDatabase->TransactionCommit();
$this->arrToDelete = array();
QApplication::Redirect('');
} catch (QMySqliDatabaseException $objExc) {
$objDatabase->TransactionRollback();
throw new QDatabaseException();
}
}
}
} else {
$this->lblWarning->Text = "You haven't chosen any Shipment to Delete";
}
}
示例6: btnEdit_Click
public function btnEdit_Click($strFormId, $strControlId, $strParameter)
{
$strParameterArray = explode(',', $strParameter);
$objShipment = Shipment::Load($strParameterArray[0]);
$objEditPanel = new ShipmentEditPanel($this, $this->strCloseEditPanelMethod, $objShipment);
$strMethodName = $this->strSetEditPanelMethod;
$this->objForm->{$strMethodName}($objEditPanel);
}
示例7: 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 ShipmentMetaControl
* @param integer $intShipmentId primary key value
* @param QMetaControlCreateType $intCreateType rules governing Shipment object creation - defaults to CreateOrEdit
* @return ShipmentMetaControl
*/
public static function Create($objParentObject, $intShipmentId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
{
// Attempt to Load from PK Arguments
if (strlen($intShipmentId)) {
$objShipment = Shipment::Load($intShipmentId);
// Shipment was found -- return it!
if ($objShipment) {
return new ShipmentMetaControl($objParentObject, $objShipment);
} else {
if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
throw new QCallerException('Could not find a Shipment object with PK arguments: ' . $intShipmentId);
}
}
// 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 ShipmentMetaControl($objParentObject, new Shipment());
}
示例8: Reload
/**
* Reload this Shipment 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 Shipment object.');
}
// Reload the Object
$objReloaded = Shipment::Load($this->intShipmentId);
// Update $this's local variables to match
$this->strShipmentNumber = $objReloaded->strShipmentNumber;
$this->TransactionId = $objReloaded->TransactionId;
$this->FromCompanyId = $objReloaded->FromCompanyId;
$this->FromContactId = $objReloaded->FromContactId;
$this->FromAddressId = $objReloaded->FromAddressId;
$this->ToCompanyId = $objReloaded->ToCompanyId;
$this->ToContactId = $objReloaded->ToContactId;
$this->ToAddressId = $objReloaded->ToAddressId;
$this->CourierId = $objReloaded->CourierId;
$this->strTrackingNumber = $objReloaded->strTrackingNumber;
$this->dttShipDate = $objReloaded->dttShipDate;
$this->blnShippedFlag = $objReloaded->blnShippedFlag;
$this->CreatedBy = $objReloaded->CreatedBy;
$this->dttCreationDate = $objReloaded->dttCreationDate;
$this->ModifiedBy = $objReloaded->ModifiedBy;
$this->strModifiedDate = $objReloaded->strModifiedDate;
}
示例9: __get
//.........这里部分代码省略.........
*/
return $this->strHoldAtLocationAddress;
case 'HoldAtLocationCity':
/**
* Gets the value for strHoldAtLocationCity
* @return string
*/
return $this->strHoldAtLocationCity;
case 'HoldAtLocationState':
/**
* Gets the value for intHoldAtLocationState
* @return integer
*/
return $this->intHoldAtLocationState;
case 'HoldAtLocationPostalCode':
/**
* Gets the value for strHoldAtLocationPostalCode
* @return string
*/
return $this->strHoldAtLocationPostalCode;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Shipment':
/**
* Gets the value for the Shipment object referenced by intShipmentId (Not Null)
* @return Shipment
*/
try {
if (!$this->objShipment && !is_null($this->intShipmentId)) {
$this->objShipment = Shipment::Load($this->intShipmentId);
}
return $this->objShipment;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'PackageType':
/**
* Gets the value for the PackageType object referenced by intPackageTypeId
* @return PackageType
*/
try {
if (!$this->objPackageType && !is_null($this->intPackageTypeId)) {
$this->objPackageType = PackageType::Load($this->intPackageTypeId);
}
return $this->objPackageType;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'ShippingAccount':
/**
* Gets the value for the ShippingAccount object referenced by intShippingAccountId
* @return ShippingAccount
*/
try {
if (!$this->objShippingAccount && !is_null($this->intShippingAccountId)) {
$this->objShippingAccount = ShippingAccount::Load($this->intShippingAccountId);
}
return $this->objShippingAccount;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
示例10: SaveTransaction
/**
* This will save this object's Transaction instance,
* updating only the fields which have had a control created for it.
*/
public function SaveTransaction()
{
try {
// Update any fields for controls that have been created
if ($this->lstEntityQtype) {
$this->objTransaction->EntityQtypeId = $this->lstEntityQtype->SelectedValue;
}
if ($this->lstTransactionType) {
$this->objTransaction->TransactionTypeId = $this->lstTransactionType->SelectedValue;
}
if ($this->txtNote) {
$this->objTransaction->Note = $this->txtNote->Text;
}
if ($this->lstCreatedByObject) {
$this->objTransaction->CreatedBy = $this->lstCreatedByObject->SelectedValue;
}
if ($this->calCreationDate) {
$this->objTransaction->CreationDate = $this->calCreationDate->DateTime;
}
if ($this->lstModifiedByObject) {
$this->objTransaction->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
}
// Update any UniqueReverseReferences (if any) for controls that have been created for it
if ($this->lstReceipt) {
$this->objTransaction->Receipt = Receipt::Load($this->lstReceipt->SelectedValue);
}
if ($this->lstShipment) {
$this->objTransaction->Shipment = Shipment::Load($this->lstShipment->SelectedValue);
}
// Save the Transaction object
$this->objTransaction->Save();
// Finally, update any ManyToManyReferences (if any)
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
示例11: 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;
}
}
//.........这里部分代码省略.........
示例12: __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 (PK)
// @return integer
return $this->intShipmentId;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Shipment':
// Gets the value for the Shipment object referenced by intShipmentId (PK)
// @return Shipment
try {
if (!$this->objShipment && !is_null($this->intShipmentId)) {
$this->objShipment = Shipment::Load($this->intShipmentId);
}
return $this->objShipment;
} 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;
}
}
}