/** * Authorizes any control to determine if the user has access * If not, it sets the objControl->Visible to false * * @param object $objEntity - any entity with a created_by column (asset, location, etc.) * @param object $objControl - the control which is being evaluated - any QControl where visible is a property * @param integer $intTransactionTypeId - the transaction_type_id */ public static function AuthorizeControlByRoleTransactionType($objEntity, $objControl, $intTransactionTypeId) { if ($objControl->Visible != false) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId(QApplication::$objUserAccount->RoleId, $intTransactionTypeId); if ($objRoleTransactionTypeAuthorization) { // None if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $objControl->Visible = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2 && !($objEntity->CreatedBy == QApplication::$objUserAccount->UserAccountId)) { $objControl->Visible = false; } } } }
public function btnAdd_Click($strFormId, $strControlId, $strParameter) { // Clear warnings from previous attempt $this->txtNewInventoryModelCode->Warning = ''; $blnError = false; // Assign the values from the user submitted form input $intNewInventoryLocationId = $this->lstSourceLocation->SelectedValue; $intTransactionQuantity = $this->txtQuantity->Text; // Create array of TransactionType (key) and AuthorizationLevel (value) by RoleId $objRoleTransactionTypeAuthorizationArray = RoleTransactionTypeAuthorization::LoadArrayByRoleId(QApplication::$objUserAccount->RoleId); $intAuthorizationLevelIdArray = array(); if ($objRoleTransactionTypeAuthorizationArray) { foreach ($objRoleTransactionTypeAuthorizationArray as $objRoleTransactionTypeAuthorization) { $intAuthorizationLevelIdArray[$objRoleTransactionTypeAuthorization->TransactionTypeId] = $objRoleTransactionTypeAuthorization->AuthorizationLevelId; } } // If transaction is a move or take out if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 5) { if ($intNewInventoryLocationId) { // Begin error checking if ($this->objInventoryLocationArray) { foreach ($this->objInventoryLocationArray as $objInventoryLocation) { if ($objInventoryLocation && $objInventoryLocation->InventoryLocationId == $intNewInventoryLocationId) { $blnError = true; $this->txtNewInventoryModelCode->Warning = "That Inventory has already been added."; } } } if (!$blnError) { $objNewInventoryLocation = InventoryLocation::LoadLocations($intNewInventoryLocationId); // This should not be possible because the list is populated with existing InventoryLocations if (!$objNewInventoryLocation instanceof InventoryLocation) { $this->txtNewInventoryModelCode->Warning = "That Inventory location does not exist."; $blnError = true; } elseif (!ctype_digit($intTransactionQuantity) || $intTransactionQuantity <= 0) { $this->txtQuantity->Warning = "That is not a valid quantity."; $blnError = true; } // Move if ($this->intTransactionTypeId == 1) { if ($objNewInventoryLocation->Quantity < $intTransactionQuantity) { $this->txtQuantity->Warning = "Quantity moved cannot exceed quantity available."; $blnError = true; } } elseif ($this->intTransactionTypeId == 5) { if ($objNewInventoryLocation->Quantity < $intTransactionQuantity) { $this->txtQuantity->Warning = "Quantity taken out cannot exceed quantity available."; $blnError = true; } } } } elseif ($this->intTransactionTypeId != 4) { $this->txtNewInventoryModelCode->Warning = "Please select a source location."; $blnError = true; } } elseif ($this->intTransactionTypeId == 4) { // Check for duplicate inventory code $strNewInventoryModelCode = $this->txtNewInventoryModelCode->Text; if (!($objNewInventoryModel = InventoryModel::LoadByInventoryModelCode($strNewInventoryModelCode))) { $blnError = true; $this->txtNewInventoryModelCode->Warning = "That is an invalid Inventory Code."; } elseif ($this->objInventoryLocationArray) { foreach ($this->objInventoryLocationArray as $objInventoryLocation) { if ($objInventoryLocation && $objInventoryLocation->InventoryModel->InventoryModelCode == $strNewInventoryModelCode) { $blnError = true; $this->txtNewInventoryModelCode->Warning = "That Inventory has already been added."; } } } if (!$blnError) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId(QApplication::$objUserAccount->RoleId, 4); if ($objRoleTransactionTypeAuthorization) { // If the user has 'None' privileges for this transaction if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $this->txtNewInventoryModelCode->Warning = "You do not have privileges for this transaction."; $blnError = true; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2 && $objNewInventoryModel->CreatedBy != QApplication::$objUserAccount->UserAccountId) { $this->txtNewInventoryModelCode->Warning = "You are not the owner of this inventory."; $blnError = true; } } } if (!$blnError) { // Create a new InventoryLocation for the time being // Before saving we will check to see if it already exists $objNewInventoryLocation = new InventoryLocation(); $objNewInventoryLocation->InventoryModelId = $objNewInventoryModel->InventoryModelId; $objNewInventoryLocation->Quantity = 0; // LocationID = 4 is 'New Inventory' Location $objNewInventoryLocation->LocationId = 4; } } if (!$blnError && isset($objNewInventoryModel) && !QApplication::AuthorizeEntityBoolean($objNewInventoryModel, 2)) { $blnError = true; $this->txtNewInventoryModelCode->Warning = "You do not have authorization to perform a transaction on this inventory model."; } if (!$blnError && $objNewInventoryLocation instanceof InventoryLocation) { $objNewInventoryLocation->intTransactionQuantity = $intTransactionQuantity; $this->objInventoryLocationArray[] = $objNewInventoryLocation; $this->txtNewInventoryModelCode->Text = null; $this->lstSourceLocation->SelectedIndex = 0; $this->txtQuantity->Text = null; if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 5) { $this->lstSourceLocation->Enabled = false; $this->txtQuantity->Enabled = false; } } }
protected function arrControls_Create() { if ($this->objModuleArray) { foreach ($this->objModuleArray as $objModule) { // Create Access List Controls $objAccessControl = new QListBox($this); $objAccessControl->ActionParameter = $objModule->ModuleId; $objAccessControl->Width = 100; $objAccessControl->CssClass = "greentext"; $objEnabledItem = new QListItem('Enabled', 1, false, null, 'CssClass="greentext"'); $objDisabledItem = new QListItem('Disabled', 0, false, null, 'CssClass="redtext"'); if ($this->blnEditMode) { $objRoleModule = RoleModule::LoadByRoleIdModuleId($this->objRole->RoleId, $objModule->ModuleId); if ($objRoleModule) { if ($objRoleModule->AccessFlag) { $objEnabledItem->Selected = true; $objDisabledItem->Selected = false; $objAccessControl->CssClass = "greentext"; } else { $objEnabledItem->Selected = false; $objDisabledItem->Selected = true; $objAccessControl->CssClass = "redtext"; } } } // Add Items to Access Control $objAccessControl->AddItem($objEnabledItem); $objAccessControl->AddItem($objDisabledItem); $objAccessControl->AddAction(new QChangeEvent(), new QAjaxAction('lstAccessControl_Select')); // Set the List Item objects to null because QCodo will maintain them in the formstate otherwise $objEnabledItem = null; $objDisabledItem = null; $this->arrControls[$objModule->ShortDescription]['access'] = $objAccessControl; $objAccessControl = null; if ($this->objAuthorizationArray) { foreach ($this->objAuthorizationArray as $objAuthorization) { // Create Authorization Controls foreach authorization type (view/edit/delete) // We could loop through AuthorizationLevels here, but no need to right now $objControl = new QListBox($this); $objControl->Width = 100; $objControl->ActionParameter = $objModule->ModuleId; $objAllItem = new QListItem('All', 1); $objOwnerItem = new QListItem('Owner', 2); $objNoneItem = new QListItem('None', 3); if ($this->blnEditMode && $objRoleModule) { $objControl->Enabled = $objRoleModule->AccessFlag ? true : false; $objRoleModuleAuthorization = RoleModuleAuthorization::LoadByRoleModuleIdAuthorizationId($objRoleModule->RoleModuleId, $objAuthorization->AuthorizationId); if ($objRoleModuleAuthorization) { // Select the Proper Authorization Level if ($objRoleModuleAuthorization->AuthorizationLevelId == 1) { $objAllItem->Selected = true; $objOwnerItem->Selected = false; $objNoneItem->Selected = false; } elseif ($objRoleModuleAuthorization->AuthorizationLevelId == 2) { $objAllItem->Selected = false; $objOwnerItem->Selected = true; $objNoneItem->Selected = false; } elseif ($objRoleModuleAuthorization->AuthorizationLevelId == 3) { $objAllItem->Selected = false; $objOwnerItem->Selected = false; $objNoneItem->Selected = true; } } // Add the RoleModuleAuthorization to an array so that it can be checked for Optimistic Locking Constraints when saving $this->objRoleModuleAuthorizationArray[$objRoleModule->RoleModuleId . '-' . $objAuthorization->AuthorizationId] = $objRoleModuleAuthorization; $objRoleModuleAuthorization = null; } else { $objAllItem->Selected = true; } $objControl->AddItem($objAllItem); $objControl->AddItem($objOwnerItem); // Do not include the 'None' List Item for View // If an administrator does not want to allow for viewing, they should disable access. This eliminates the problem of setting View: None, but Edit: All // The problem with View: Owner and Edit: All still exists if ($objAuthorization->AuthorizationId != 1) { $objControl->AddItem($objNoneItem); } $objAllItem = null; $objOwnerItem = null; $objNoneItem = null; // Assign the Controls array if ($objAuthorization->ShortDescription == 'edit') { $objControl->AddAction(new QChangeEvent(), new QAjaxAction('lstEdit_Change')); $arrEditControlIdModuleId[] = $objControl->ControlId . "-" . $objModule->ModuleId; //$this->lstEdit_Change($this->FormId, $objControl->ControlId, $objModule->ModuleId); } $this->arrControls[$objModule->ShortDescription][$objAuthorization->ShortDescription] = $objControl; $objControl = null; } } $objRoleModule = null; } } foreach ($arrEditControlIdModuleId as $strControlIdModuleId) { $arrExplode = explode("-", $strControlIdModuleId); $this->lstEdit_Change($this->FormId, $arrExplode[0], $arrExplode[1]); } // Create control for Move $objControl = new QListBox($this); $objControl->Width = 100; $objAllItem = new QListItem('All', 1); $objOwnerItem = new QListItem('Owner', 2); $objNoneItem = new QListItem('None', 3); $objControl->ActionParameter = 1; if ($this->blnEditMode) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId($this->objRole->RoleId, 1); if ($objRoleTransactionTypeAuthorization) { // Select the Proper Authorization Level if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 1) { $objAllItem->Selected = true; $objOwnerItem->Selected = false; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2) { $objAllItem->Selected = false; $objOwnerItem->Selected = true; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $objAllItem->Selected = false; $objOwnerItem->Selected = false; $objNoneItem->Selected = true; } } } $objControl->AddItem($objAllItem); $objControl->AddItem($objOwnerItem); $objControl->AddItem($objNoneItem); $this->arrControls['move'] = $objControl; // Create control for Check In/Out $objControl = new QListBox($this); $objControl->Width = 100; $objAllItem = new QListItem('All', 1); $objOwnerItem = new QListItem('Owner', 2); $objNoneItem = new QListItem('None', 3); $objControl->ActionParameter = 2; if ($this->blnEditMode) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId($this->objRole->RoleId, 2); if ($objRoleTransactionTypeAuthorization) { // Select the Proper Authorization Level if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 1) { $objAllItem->Selected = true; $objOwnerItem->Selected = false; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2) { $objAllItem->Selected = false; $objOwnerItem->Selected = true; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $objAllItem->Selected = false; $objOwnerItem->Selected = false; $objNoneItem->Selected = true; } } } $objControl->AddItem($objAllItem); $objControl->AddItem($objOwnerItem); $objControl->AddItem($objNoneItem); $this->arrControls['check_in_out'] = $objControl; // Create control for Reserve/Unreserve $objControl = new QListBox($this); $objControl->Width = 100; $objAllItem = new QListItem('All', 1); $objOwnerItem = new QListItem('Owner', 2); $objNoneItem = new QListItem('None', 3); $objControl->ActionParameter = 3; if ($this->blnEditMode) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId($this->objRole->RoleId, 8); if ($objRoleTransactionTypeAuthorization) { // Select the Proper Authorization Level if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 1) { $objAllItem->Selected = true; $objOwnerItem->Selected = false; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2) { $objAllItem->Selected = false; $objOwnerItem->Selected = true; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $objAllItem->Selected = false; $objOwnerItem->Selected = false; $objNoneItem->Selected = true; } } } $objControl->AddItem($objAllItem); $objControl->AddItem($objOwnerItem); $objControl->AddItem($objNoneItem); $this->arrControls['reserve_unreserve'] = $objControl; // Create control for Take Out $objControl = new QListBox($this); $objControl->Width = 100; $objAllItem = new QListItem('All', 1); $objOwnerItem = new QListItem('Owner', 2); $objNoneItem = new QListItem('None', 3); $objControl->ActionParameter = 4; if ($this->blnEditMode) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId($this->objRole->RoleId, 5); if ($objRoleTransactionTypeAuthorization) { // Select the Proper Authorization Level if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 1) { $objAllItem->Selected = true; $objOwnerItem->Selected = false; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2) { $objAllItem->Selected = false; $objOwnerItem->Selected = true; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $objAllItem->Selected = false; $objOwnerItem->Selected = false; $objNoneItem->Selected = true; } } } $objControl->AddItem($objAllItem); $objControl->AddItem($objOwnerItem); $objControl->AddItem($objNoneItem); $this->arrControls['take_out'] = $objControl; // Create control for Restock $objControl = new QListBox($this); $objControl->Width = 100; $objAllItem = new QListItem('All', 1); $objOwnerItem = new QListItem('Owner', 2); $objNoneItem = new QListItem('None', 3); $objControl->ActionParameter = 5; if ($this->blnEditMode) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId($this->objRole->RoleId, 4); if ($objRoleTransactionTypeAuthorization) { // Select the Proper Authorization Level if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 1) { $objAllItem->Selected = true; $objOwnerItem->Selected = false; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2) { $objAllItem->Selected = false; $objOwnerItem->Selected = true; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $objAllItem->Selected = false; $objOwnerItem->Selected = false; $objNoneItem->Selected = true; } } } $objControl->AddItem($objAllItem); $objControl->AddItem($objOwnerItem); $objControl->AddItem($objNoneItem); $this->arrControls['restock'] = $objControl; // Create control for Check In/Out $objControl = new QListBox($this); $objControl->Width = 100; $objAllItem = new QListItem('All', 1); $objOwnerItem = new QListItem('Owner', 2); $objNoneItem = new QListItem('None', 3); $objControl->ActionParameter = 6; if ($this->blnEditMode) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId($this->objRole->RoleId, 10); if ($objRoleTransactionTypeAuthorization) { // Select the Proper Authorization Level if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 1) { $objAllItem->Selected = true; $objOwnerItem->Selected = false; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2) { $objAllItem->Selected = false; $objOwnerItem->Selected = true; $objNoneItem->Selected = false; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $objAllItem->Selected = false; $objOwnerItem->Selected = false; $objNoneItem->Selected = true; } } } $objControl->AddItem($objAllItem); $objControl->AddItem($objOwnerItem); $objControl->AddItem($objNoneItem); $this->arrControls['archive_unarchive'] = $objControl; }
public function btnAdd_Click($strFormId, $strControlId, $strParameter) { $strAssetCode = $this->txtNewAssetCode->Text; $blnDuplicate = false; $blnError = false; if ($strAssetCode) { // Begin error checking if ($this->objAssetArray) { foreach ($this->objAssetArray as $asset) { if ($asset && $asset->AssetCode == $strAssetCode) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset has already been added."; } } } if (!$blnError) { $this->txtNewAssetCode->Warning = ''; $objNewAsset = Asset::LoadByAssetCodeWithCustomFields($this->txtNewAssetCode->Text); if (!$objNewAsset instanceof Asset) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset code does not exist."; } elseif ($objNewAsset->LinkedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is locked to a parent asset."; } elseif ($objNewAsset->LocationId == 6 && $this->intTransactionTypeId != 11) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset has already been archived."; } elseif ($objNewAsset->LocationId == 2) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset has already been shipped."; } elseif ($objNewAsset->LocationId == 5) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is currently scheduled to be received."; } elseif ($objPendingShipment = AssetTransaction::PendingShipment($objNewAsset->AssetId)) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is already in a pending shipment."; } elseif (!QApplication::AuthorizeEntityBoolean($objNewAsset, 2)) { $blnError = true; $this->txtNewAssetCode->Warning = "You do not have authorization to perform a transaction on this asset."; } elseif ($this->intTransactionTypeId == 1) { if ($objNewAsset->CheckedOutFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is checked out."; } elseif ($objNewAsset->ReservedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is reserved."; } } elseif ($this->intTransactionTypeId == 2) { if (!$objNewAsset->CheckedOutFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is not checked out."; } elseif ($objNewAsset->ReservedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is reserved."; } elseif ($objNewAsset->CheckedOutFlag) { $objUserAccount = $objNewAsset->GetLastTransactionUser(); if (QApplication::$TracmorSettings->StrictCheckinPolicy == '1' && $objUserAccount->UserAccountId != QApplication::$objUserAccount->UserAccountId) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset was not checked out by the current user."; } } } elseif ($this->intTransactionTypeId == 3) { if ($objNewAsset->CheckedOutFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is already checked out."; } elseif ($objNewAsset->ReservedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is reserved."; } } elseif ($this->intTransactionTypeId == 8) { if ($objNewAsset->ReservedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is already reserved."; } elseif ($objNewAsset->CheckedOutFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is checked out."; } } elseif ($this->intTransactionTypeId == 9) { if (!$objNewAsset->ReservedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is not reserved"; } elseif ($objNewAsset->CheckedOutFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is checked out."; } elseif ($objNewAsset->ReservedFlag) { $objUserAccount = $objNewAsset->GetLastTransactionUser(); if ($objUserAccount->UserAccountId != QApplication::$objUserAccount->UserAccountId) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset was not reserved by the current user."; } } } elseif ($this->intTransactionTypeId == 10) { if ($objNewAsset->ArchivedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is already archived."; } elseif ($objNewAsset->CheckedOutFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is checked out."; } elseif ($objNewAsset->ReservedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is reserved."; } } elseif ($this->intTransactionTypeId == 11) { if (!$objNewAsset->ArchivedFlag) { $blnError = true; $this->txtNewAssetCode->Warning = "That asset is not archived."; } } if (!$blnError && ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 2 || $this->intTransactionTypeId == 3 || $this->intTransactionTypeId == 8 || $this->intTransactionTypeId == 9 || $this->intTransactionTypeId == 10 || $this->intTransactionTypeId == 11)) { $objRoleTransactionTypeAuthorization = RoleTransactionTypeAuthorization::LoadByRoleIdTransactionTypeId(QApplication::$objUserAccount->RoleId, $this->intTransactionTypeId); if ($objRoleTransactionTypeAuthorization) { // If the user has 'None' privileges for this transaction if ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 3) { $blnError = true; $this->txtNewAssetCode->Warning = "You do not have privileges for this transaction."; } elseif ($objRoleTransactionTypeAuthorization->AuthorizationLevelId == 2 && $objNewAsset->CreatedBy != QApplication::$objUserAccount->UserAccountId) { $blnError = true; $this->txtNewAssetCode->Warning = "You are not the owner of this asset."; } } } if (!$blnError && $objNewAsset instanceof Asset) { $this->objAssetArray[] = $objNewAsset; $this->txtNewAssetCode->Text = null; // Load all linked assets $objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetIdWithNoCustomFields($objNewAsset->AssetId); if ($objLinkedAssetArray) { $strAssetCodeArray = array(); foreach ($objLinkedAssetArray as $objLinkedAsset) { $strAssetCodeArray[] = $objLinkedAsset->AssetCode; $this->objAssetArray[] = $objLinkedAsset; } $this->txtNewAssetCode->Warning = sprintf("The following asset(s) have been added to the transaction because they are locked to asset (%s):<br />%s", $objNewAsset->AssetCode, implode('<br />', $strAssetCodeArray)); } unset($objLinkedAssetArray); $this->dtgAssetTransact->Refresh(); } } if (!$blnError) { $this->txtNewAssetCode->Warning = ''; } } else { $this->txtNewAssetCode->Warning = "Please enter an asset code."; } $this->txtNewAssetCode->Focus(); $this->txtNewAssetCode->Select(); }