protected function SetupTransactionType() { // Lookup Object PK information from Query String (if applicable) // Set mode to Edit or New depending on what's found $intTransactionTypeId = QApplication::QueryString('intTransactionTypeId'); if ($intTransactionTypeId) { $this->objTransactionType = TransactionType::Load($intTransactionTypeId); if (!$this->objTransactionType) { throw new Exception('Could not find a TransactionType object with PK arguments: ' . $intTransactionTypeId); } $this->strTitleVerb = QApplication::Translate('Edit'); $this->blnEditMode = true; } else { $this->objTransactionType = new TransactionType(); $this->strTitleVerb = QApplication::Translate('Create'); $this->blnEditMode = false; } }
/** * 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 TransactionTypeMetaControl * @param integer $intTransactionTypeId primary key value * @param QMetaControlCreateType $intCreateType rules governing TransactionType object creation - defaults to CreateOrEdit * @return TransactionTypeMetaControl */ public static function Create($objParentObject, $intTransactionTypeId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intTransactionTypeId)) { $objTransactionType = TransactionType::Load($intTransactionTypeId); // TransactionType was found -- return it! if ($objTransactionType) { return new TransactionTypeMetaControl($objParentObject, $objTransactionType); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a TransactionType object with PK arguments: ' . $intTransactionTypeId); } } // 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 TransactionTypeMetaControl($objParentObject, new TransactionType()); }
/** * 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 'RoleTransactionTypeAuthorizationId': // Gets the value for intRoleTransactionTypeAuthorizationId (Read-Only PK) // @return integer return $this->intRoleTransactionTypeAuthorizationId; case 'RoleId': // Gets the value for intRoleId (Not Null) // @return integer return $this->intRoleId; case 'TransactionTypeId': // Gets the value for intTransactionTypeId (Not Null) // @return integer return $this->intTransactionTypeId; case 'AuthorizationLevelId': // Gets the value for intAuthorizationLevelId (Not Null) // @return integer return $this->intAuthorizationLevelId; 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 'Role': // Gets the value for the Role object referenced by intRoleId (Not Null) // @return Role try { if (!$this->objRole && !is_null($this->intRoleId)) { $this->objRole = Role::Load($this->intRoleId); } return $this->objRole; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'TransactionType': // Gets the value for the TransactionType object referenced by intTransactionTypeId (Not Null) // @return TransactionType try { if (!$this->objTransactionType && !is_null($this->intTransactionTypeId)) { $this->objTransactionType = TransactionType::Load($this->intTransactionTypeId); } return $this->objTransactionType; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'AuthorizationLevel': // Gets the value for the AuthorizationLevel object referenced by intAuthorizationLevelId (Not Null) // @return AuthorizationLevel try { if (!$this->objAuthorizationLevel && !is_null($this->intAuthorizationLevelId)) { $this->objAuthorizationLevel = AuthorizationLevel::Load($this->intAuthorizationLevelId); } return $this->objAuthorizationLevel; } 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 'TransactionId': // Gets the value for intTransactionId (Read-Only PK) // @return integer return $this->intTransactionId; case 'EntityQtypeId': // Gets the value for intEntityQtypeId (Not Null) // @return integer return $this->intEntityQtypeId; case 'TransactionTypeId': // Gets the value for intTransactionTypeId (Not Null) // @return integer return $this->intTransactionTypeId; case 'Note': // Gets the value for strNote // @return string return $this->strNote; 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 'TransactionType': // Gets the value for the TransactionType object referenced by intTransactionTypeId (Not Null) // @return TransactionType try { if (!$this->objTransactionType && !is_null($this->intTransactionTypeId)) { $this->objTransactionType = TransactionType::Load($this->intTransactionTypeId); } return $this->objTransactionType; } 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 'Receipt': // Gets the value for the Receipt object that uniquely references this Transaction // by objReceipt (Unique) // @return Receipt try { if ($this->objReceipt === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objReceipt) { $this->objReceipt = Receipt::LoadByTransactionId($this->intTransactionId); } return $this->objReceipt; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Shipment': // Gets the value for the Shipment object that uniquely references this Transaction // by objShipment (Unique) // @return Shipment try { if ($this->objShipment === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objShipment) { $this->objShipment = Shipment::LoadByTransactionId($this->intTransactionId); } 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 '_AssetTransaction': // Gets the value for the private _objAssetTransaction (Read-Only) // if set due to an expansion on the asset_transaction.transaction_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.transaction_id reverse relationship // @return AssetTransaction[] return (array) $this->_objAssetTransactionArray; case '_InventoryTransaction': // Gets the value for the private _objInventoryTransaction (Read-Only) // if set due to an expansion on the inventory_transaction.transaction_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.transaction_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 'ShortcutId': // Gets the value for intShortcutId (Read-Only PK) // @return integer return $this->intShortcutId; case 'ModuleId': // Gets the value for intModuleId (Not Null) // @return integer return $this->intModuleId; case 'AuthorizationId': // Gets the value for intAuthorizationId // @return integer return $this->intAuthorizationId; case 'TransactionTypeId': // Gets the value for intTransactionTypeId // @return integer return $this->intTransactionTypeId; case 'ShortDescription': // Gets the value for strShortDescription (Not Null) // @return string return $this->strShortDescription; case 'Link': // Gets the value for strLink (Not Null) // @return string return $this->strLink; case 'ImagePath': // Gets the value for strImagePath // @return string return $this->strImagePath; case 'EntityQtypeId': // Gets the value for intEntityQtypeId (Not Null) // @return integer return $this->intEntityQtypeId; case 'CreateFlag': // Gets the value for blnCreateFlag (Not Null) // @return boolean return $this->blnCreateFlag; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Module': // Gets the value for the Module object referenced by intModuleId (Not Null) // @return Module try { if (!$this->objModule && !is_null($this->intModuleId)) { $this->objModule = Module::Load($this->intModuleId); } return $this->objModule; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Authorization': // Gets the value for the Authorization object referenced by intAuthorizationId // @return Authorization try { if (!$this->objAuthorization && !is_null($this->intAuthorizationId)) { $this->objAuthorization = Authorization::Load($this->intAuthorizationId); } return $this->objAuthorization; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'TransactionType': // Gets the value for the TransactionType object referenced by intTransactionTypeId // @return TransactionType try { if (!$this->objTransactionType && !is_null($this->intTransactionTypeId)) { $this->objTransactionType = TransactionType::Load($this->intTransactionTypeId); } return $this->objTransactionType; } 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; } } }
public function btnEdit_Click($strFormId, $strControlId, $strParameter) { $strParameterArray = explode(',', $strParameter); $objTransactionType = TransactionType::Load($strParameterArray[0]); $objEditPanel = new TransactionTypeEditPanel($this, $this->strCloseEditPanelMethod, $objTransactionType); $strMethodName = $this->strSetEditPanelMethod; $this->objForm->{$strMethodName}($objEditPanel); }
/** * Reload this TransactionType 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 TransactionType object.'); } // Reload the Object $objReloaded = TransactionType::Load($this->intTransactionTypeId); // Update $this's local variables to match $this->strShortDescription = $objReloaded->strShortDescription; $this->blnAssetFlag = $objReloaded->blnAssetFlag; $this->blnInventoryFlag = $objReloaded->blnInventoryFlag; }