protected function SetupLocation() { // Lookup Object PK information from Query String (if applicable) // Set mode to Edit or New depending on what's found $intLocationId = QApplication::QueryString('intLocationId'); if ($intLocationId) { $this->objLocation = Location::Load($intLocationId); if (!$this->objLocation) { throw new Exception('Could not find a Location object with PK arguments: ' . $intLocationId); } $this->strTitleVerb = QApplication::Translate('Edit'); $this->blnEditMode = true; } else { $this->objLocation = new Location(); $this->strTitleVerb = QApplication::Translate('Create'); $this->blnEditMode = false; } }
<?php /* This script allows to add new location 'Archived' (location_id=6) * in the existing database */ require_once '../includes/prepend.inc.php'; QApplication::Authenticate(); $objDatabase = Location::GetDatabase(); // Load the Location Object by location_id=6 $objLocation = Location::Load(6); // If the location exist or already updated if ($objLocation && $objLocation->ShortDescription != 'Archived') { $objDatabase->NonQuery("SET FOREIGN_KEY_CHECKS = 0;"); // Update location_id=6 to 'Archived' $strQuery = sprintf("UPDATE `location`\n SET `short_description`='Archived', `created_by`=NULL, `modified_by`=NULL, `creation_date`=NULL, `modified_date`=NULL, `long_description`=NULL\n WHERE `location_id`='6';"); $objDatabase->NonQuery($strQuery); // Save existing location with new location_id $strQuery = sprintf("INSERT INTO `location` VALUES\n (NULL, '{$objLocation->ShortDescription}', '{$objLocation->LongDescription}', '{$objLocation->CreatedBy}', '" . $objLocation->CreationDate->PHPDate('Y-m-d H:i:s') . "', '{$objLocation->ModifiedBy}', '{$objLocation->ModifiedDate}');"); // Save and reload old location $objDatabase->NonQuery($strQuery); $objNewLocation = Location::LoadByShortDescription($objLocation->ShortDescription); // Get new location_id $objNewLocationId = $objNewLocation->LocationId; // Update all foreign keys and links // Added `modified_date`=`modified_date` to avoid the attribute "ON UPDATE CURRENT_TIMESTAMP" $strQuery = sprintf("UPDATE `asset`\n SET `location_id`='%s', `modified_date`=`modified_date`\n WHERE `location_id`='6';", $objNewLocationId); $objDatabase->NonQuery($strQuery); $strQuery = sprintf("UPDATE `audit_scan`\n SET `location_id`='%s'\n WHERE `location_id`='6';", $objNewLocationId); $objDatabase->NonQuery($strQuery); $strQuery = sprintf("UPDATE `inventory_location`\n SET `location_id`='%s', `modified_date`=`modified_date`\n WHERE `location_id`='6';", $objNewLocationId); $objDatabase->NonQuery($strQuery);
/** * Reload this Location 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 Location object.'); } // Reload the Object $objReloaded = Location::Load($this->intLocationId); // Update $this's local variables to match $this->strShortDescription = $objReloaded->strShortDescription; $this->strLongDescription = $objReloaded->strLongDescription; $this->blnEnabledFlag = $objReloaded->blnEnabledFlag; $this->blnAssetFlag = $objReloaded->blnAssetFlag; $this->blnInventoryFlag = $objReloaded->blnInventoryFlag; $this->CreatedBy = $objReloaded->CreatedBy; $this->dttCreationDate = $objReloaded->dttCreationDate; $this->ModifiedBy = $objReloaded->ModifiedBy; $this->strModifiedDate = $objReloaded->strModifiedDate; }
/** * 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 'AssetId': /** * Gets the value for intAssetId (Read-Only PK) * @return integer */ return $this->intAssetId; case 'AssetModelId': /** * Gets the value for intAssetModelId (Not Null) * @return integer */ return $this->intAssetModelId; case 'LocationId': /** * Gets the value for intLocationId * @return integer */ return $this->intLocationId; case 'AssetCode': /** * Gets the value for strAssetCode (Unique) * @return string */ return $this->strAssetCode; case 'ImagePath': /** * Gets the value for strImagePath * @return string */ return $this->strImagePath; case 'CheckedOutFlag': /** * Gets the value for blnCheckedOutFlag * @return boolean */ return $this->blnCheckedOutFlag; case 'ReservedFlag': /** * Gets the value for blnReservedFlag * @return boolean */ return $this->blnReservedFlag; 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 'AssetModel': /** * Gets the value for the AssetModel object referenced by intAssetModelId (Not Null) * @return AssetModel */ try { if (!$this->objAssetModel && !is_null($this->intAssetModelId)) { $this->objAssetModel = AssetModel::Load($this->intAssetModelId); } return $this->objAssetModel; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Location': /** * Gets the value for the Location object referenced by intLocationId * @return Location */ try { if (!$this->objLocation && !is_null($this->intLocationId)) { $this->objLocation = Location::Load($this->intLocationId); } return $this->objLocation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': /** * Gets the value for the UserAccount object referenced by intCreatedBy * @return UserAccount */ try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': /** * Gets the value for the UserAccount object referenced by intModifiedBy * @return UserAccount */ try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } 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 '_AssetTransaction': /** * Gets the value for the private _objAssetTransaction (Read-Only) * if set due to an expansion on the asset_transaction.asset_id reverse relationship * @return AssetTransaction */ return $this->_objAssetTransaction; case '_AssetTransactionArray': /** * Gets the value for the private _objAssetTransactionArray (Read-Only) * if set due to an ExpandAsArray on the asset_transaction.asset_id reverse relationship * @return AssetTransaction[] */ return (array) $this->_objAssetTransactionArray; case '_AssetTransactionAsNew': /** * Gets the value for the private _objAssetTransactionAsNew (Read-Only) * if set due to an expansion on the asset_transaction.new_asset_id reverse relationship * @return AssetTransaction */ return $this->_objAssetTransactionAsNew; case '_AssetTransactionAsNewArray': /** * Gets the value for the private _objAssetTransactionAsNewArray (Read-Only) * if set due to an ExpandAsArray on the asset_transaction.new_asset_id reverse relationship * @return AssetTransaction[] */ return (array) $this->_objAssetTransactionAsNewArray; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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 'InventoryLocationId': // Gets the value for intInventoryLocationId (Read-Only PK) // @return integer return $this->intInventoryLocationId; case 'InventoryModelId': // Gets the value for intInventoryModelId (Not Null) // @return integer return $this->intInventoryModelId; case 'LocationId': // Gets the value for intLocationId (Not Null) // @return integer return $this->intLocationId; case 'Quantity': // Gets the value for intQuantity (Not Null) // @return integer return $this->intQuantity; 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 'InventoryModel': // Gets the value for the InventoryModel object referenced by intInventoryModelId (Not Null) // @return InventoryModel try { if (!$this->objInventoryModel && !is_null($this->intInventoryModelId)) { $this->objInventoryModel = InventoryModel::Load($this->intInventoryModelId); } return $this->objInventoryModel; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Location': // Gets the value for the Location object referenced by intLocationId (Not Null) // @return Location try { if (!$this->objLocation && !is_null($this->intLocationId)) { $this->objLocation = Location::Load($this->intLocationId); } return $this->objLocation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } 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 '_InventoryTransaction': // Gets the value for the private _objInventoryTransaction (Read-Only) // if set due to an expansion on the inventory_transaction.inventory_location_id reverse relationship // @return InventoryTransaction return $this->_objInventoryTransaction; case '_InventoryTransactionArray': // Gets the value for the private _objInventoryTransactionArray (Read-Only) // if set due to an ExpandAsArray on the inventory_transaction.inventory_location_id reverse relationship // @return InventoryTransaction[] return (array) $this->_objInventoryTransactionArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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': // 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(); 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(); throw $objExc; } case 'DestinationLocation': // Gets the value for the Location object referenced by intDestinationLocationId // @return Location try { if (!$this->objDestinationLocation && !is_null($this->intDestinationLocationId)) { $this->objDestinationLocation = Location::Load($this->intDestinationLocationId); } return $this->objDestinationLocation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'NewAsset': // Gets the value for the Asset object referenced by intNewAssetId // @return Asset try { if (!$this->objNewAsset && !is_null($this->intNewAssetId)) { $this->objNewAsset = Asset::Load($this->intNewAssetId); } return $this->objNewAsset; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'AssetTransactionCheckout': // Gets the value for the AssetTransactionCheckout object that uniquely references this AssetTransaction // by objAssetTransactionCheckout (Unique) // @return AssetTransactionCheckout try { if ($this->objAssetTransactionCheckout === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objAssetTransactionCheckout) { $this->objAssetTransactionCheckout = AssetTransactionCheckout::LoadByAssetTransactionId($this->intAssetTransactionId); } return $this->objAssetTransactionCheckout; } 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 '_ChildAssetTransaction': // Gets the value for the private _objChildAssetTransaction (Read-Only) // if set due to an expansion on the asset_transaction.parent_asset_transaction_id reverse relationship // @return AssetTransaction return $this->_objChildAssetTransaction; case '_ChildAssetTransactionArray': // Gets the value for the private _objChildAssetTransactionArray (Read-Only) // if set due to an ExpandAsArray on the asset_transaction.parent_asset_transaction_id reverse relationship // @return AssetTransaction[] return (array) $this->_objChildAssetTransactionArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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 'AuditScanId': // Gets the value for intAuditScanId (Read-Only PK) // @return integer return $this->intAuditScanId; case 'AuditId': // Gets the value for intAuditId (Not Null) // @return integer return $this->intAuditId; case 'LocationId': // Gets the value for intLocationId (Not Null) // @return integer return $this->intLocationId; case 'EntityId': // Gets the value for intEntityId // @return integer return $this->intEntityId; case 'Count': // Gets the value for intCount // @return integer return $this->intCount; case 'SystemCount': // Gets the value for intSystemCount // @return integer return $this->intSystemCount; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Audit': // Gets the value for the Audit object referenced by intAuditId (Not Null) // @return Audit try { if (!$this->objAudit && !is_null($this->intAuditId)) { $this->objAudit = Audit::Load($this->intAuditId); } return $this->objAudit; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Location': // Gets the value for the Location object referenced by intLocationId (Not Null) // @return Location try { if (!$this->objLocation && !is_null($this->intLocationId)) { $this->objLocation = Location::Load($this->intLocationId); } return $this->objLocation; } 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; } } }
/** * 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 'InventoryTransactionId': /** * Gets the value for intInventoryTransactionId (Read-Only PK) * @return integer */ return $this->intInventoryTransactionId; case 'InventoryLocationId': /** * Gets the value for intInventoryLocationId (Not Null) * @return integer */ return $this->intInventoryLocationId; case 'TransactionId': /** * Gets the value for intTransactionId (Not Null) * @return integer */ return $this->intTransactionId; case 'Quantity': /** * Gets the value for intQuantity (Not Null) * @return integer */ return $this->intQuantity; 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 '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; case 'LocalWarehouseStock': /** * Gets the value for Local_warehouse_stock * @return integer */ 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(); throw $objExc; } case 'DestinationLocation': /** * Gets the value for the Location object referenced by intDestinationLocationId * @return Location */ try { if (!$this->objDestinationLocation && !is_null($this->intDestinationLocationId)) { $this->objDestinationLocation = Location::Load($this->intDestinationLocationId); } return $this->objDestinationLocation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': /** * Gets the value for the UserAccount object referenced by intCreatedBy * @return UserAccount */ try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': /** * Gets the value for the UserAccount object referenced by intModifiedBy * @return UserAccount */ try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } 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) //////////////////////////// default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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': /** * 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(); 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(); throw $objExc; } case 'DestinationLocation': /** * Gets the value for the Location object referenced by intDestinationLocationId * @return Location */ try { if (!$this->objDestinationLocation && !is_null($this->intDestinationLocationId)) { $this->objDestinationLocation = Location::Load($this->intDestinationLocationId); } return $this->objDestinationLocation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'NewAsset': /** * Gets the value for the Asset object referenced by intNewAssetId * @return Asset */ try { if (!$this->objNewAsset && !is_null($this->intNewAssetId)) { $this->objNewAsset = Asset::Load($this->intNewAssetId); } return $this->objNewAsset; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': /** * Gets the value for the UserAccount object referenced by intCreatedBy * @return UserAccount */ try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': /** * Gets the value for the UserAccount object referenced by intModifiedBy * @return UserAccount */ try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } 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 '_ChildAssetTransaction': /** * Gets the value for the private _objChildAssetTransaction (Read-Only) * if set due to an expansion on the asset_transaction.parent_asset_transaction_id reverse relationship * @return AssetTransaction */ return $this->_objChildAssetTransaction; case '_ChildAssetTransactionArray': /** * Gets the value for the private _objChildAssetTransactionArray (Read-Only) * if set due to an ExpandAsArray on the asset_transaction.parent_asset_transaction_id reverse relationship * @return AssetTransaction[] */ return (array) $this->_objChildAssetTransactionArray; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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 LocationMetaControl * @param integer $intLocationId primary key value * @param QMetaControlCreateType $intCreateType rules governing Location object creation - defaults to CreateOrEdit * @return LocationMetaControl */ public static function Create($objParentObject, $intLocationId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intLocationId)) { $objLocation = Location::Load($intLocationId); // Location was found -- return it! if ($objLocation) { return new LocationMetaControl($objParentObject, $objLocation); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a Location object with PK arguments: ' . $intLocationId); } } // 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 LocationMetaControl($objParentObject, new Location()); }
/** * 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 'InventoryTransactionId': // Gets the value for intInventoryTransactionId (Read-Only PK) // @return integer return $this->intInventoryTransactionId; case 'InventoryLocationId': // Gets the value for intInventoryLocationId (Not Null) // @return integer return $this->intInventoryLocationId; case 'TransactionId': // Gets the value for intTransactionId (Not Null) // @return integer return $this->intTransactionId; case 'Quantity': // Gets the value for intQuantity (Not Null) // @return integer return $this->intQuantity; 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 '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 '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(); throw $objExc; } case 'DestinationLocation': // Gets the value for the Location object referenced by intDestinationLocationId // @return Location try { if (!$this->objDestinationLocation && !is_null($this->intDestinationLocationId)) { $this->objDestinationLocation = Location::Load($this->intDestinationLocationId); } return $this->objDestinationLocation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } 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; } } }
/** * 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 'AssetId': // Gets the value for intAssetId (Read-Only PK) // @return integer return $this->intAssetId; case 'ParentAssetId': // Gets the value for intParentAssetId // @return integer return $this->intParentAssetId; case 'AssetModelId': // Gets the value for intAssetModelId (Not Null) // @return integer return $this->intAssetModelId; case 'LocationId': // Gets the value for intLocationId // @return integer return $this->intLocationId; case 'AssetCode': // Gets the value for strAssetCode (Unique) // @return string return $this->strAssetCode; case 'ImagePath': // Gets the value for strImagePath // @return string return $this->strImagePath; case 'CheckedOutFlag': // Gets the value for blnCheckedOutFlag // @return boolean return $this->blnCheckedOutFlag; case 'ReservedFlag': // Gets the value for blnReservedFlag // @return boolean return $this->blnReservedFlag; case 'LinkedFlag': // Gets the value for blnLinkedFlag // @return boolean return $this->blnLinkedFlag; case 'ArchivedFlag': // Gets the value for blnArchivedFlag // @return boolean return $this->blnArchivedFlag; 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; case 'DepreciationFlag': // Gets the value for blnDepreciationFlag // @return boolean return $this->blnDepreciationFlag; case 'PurchaseDate': // Gets the value for dttPurchaseDate // @return QDateTime return $this->dttPurchaseDate; case 'PurchaseCost': // Gets the value for fltPurchaseCost // @return double return $this->fltPurchaseCost; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'ParentAsset': // Gets the value for the Asset object referenced by intParentAssetId // @return Asset try { if (!$this->objParentAsset && !is_null($this->intParentAssetId)) { $this->objParentAsset = Asset::Load($this->intParentAssetId); } return $this->objParentAsset; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'AssetModel': // Gets the value for the AssetModel object referenced by intAssetModelId (Not Null) // @return AssetModel try { if (!$this->objAssetModel && !is_null($this->intAssetModelId)) { $this->objAssetModel = AssetModel::Load($this->intAssetModelId); } return $this->objAssetModel; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Location': // Gets the value for the Location object referenced by intLocationId // @return Location try { if (!$this->objLocation && !is_null($this->intLocationId)) { $this->objLocation = Location::Load($this->intLocationId); } return $this->objLocation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'AssetCustomFieldHelper': // Gets the value for the AssetCustomFieldHelper object that uniquely references this Asset // by objAssetCustomFieldHelper (Unique) // @return AssetCustomFieldHelper try { if ($this->objAssetCustomFieldHelper === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objAssetCustomFieldHelper) { $this->objAssetCustomFieldHelper = AssetCustomFieldHelper::LoadByAssetId($this->intAssetId); } return $this->objAssetCustomFieldHelper; } 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 '_ChildAsset': // Gets the value for the private _objChildAsset (Read-Only) // if set due to an expansion on the asset.parent_asset_id reverse relationship // @return Asset return $this->_objChildAsset; case '_ChildAssetArray': // Gets the value for the private _objChildAssetArray (Read-Only) // if set due to an ExpandAsArray on the asset.parent_asset_id reverse relationship // @return Asset[] return (array) $this->_objChildAssetArray; case '_AssetTransaction': // Gets the value for the private _objAssetTransaction (Read-Only) // if set due to an expansion on the asset_transaction.asset_id reverse relationship // @return AssetTransaction return $this->_objAssetTransaction; case '_AssetTransactionArray': // Gets the value for the private _objAssetTransactionArray (Read-Only) // if set due to an ExpandAsArray on the asset_transaction.asset_id reverse relationship // @return AssetTransaction[] return (array) $this->_objAssetTransactionArray; case '_AssetTransactionAsNew': // Gets the value for the private _objAssetTransactionAsNew (Read-Only) // if set due to an expansion on the asset_transaction.new_asset_id reverse relationship // @return AssetTransaction return $this->_objAssetTransactionAsNew; case '_AssetTransactionAsNewArray': // Gets the value for the private _objAssetTransactionAsNewArray (Read-Only) // if set due to an ExpandAsArray on the asset_transaction.new_asset_id reverse relationship // @return AssetTransaction[] return (array) $this->_objAssetTransactionAsNewArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
public function btnEdit_Click($strFormId, $strControlId, $strParameter) { $strParameterArray = explode(',', $strParameter); $objLocation = Location::Load($strParameterArray[0]); $objEditPanel = new LocationEditPanel($this, $this->strCloseEditPanelMethod, $objLocation); $strMethodName = $this->strSetEditPanelMethod; $this->objForm->{$strMethodName}($objEditPanel); }