当前位置: 首页>>代码示例>>PHP>>正文


PHP Asset::LoadChildLinkedArrayByParentAssetId方法代码示例

本文整理汇总了PHP中Asset::LoadChildLinkedArrayByParentAssetId方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::LoadChildLinkedArrayByParentAssetId方法的具体用法?PHP Asset::LoadChildLinkedArrayByParentAssetId怎么用?PHP Asset::LoadChildLinkedArrayByParentAssetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Asset的用法示例。


在下文中一共展示了Asset::LoadChildLinkedArrayByParentAssetId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: btnRemove_Click

 public function btnRemove_Click($strFormId, $strControlId, $strParameter)
 {
     $intAssetId = $strParameter;
     $objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($intAssetId);
     if ($this->ctlAssetTransact->objAssetArray) {
         foreach ($this->ctlAssetTransact->objAssetArray as $key => $value) {
             if ($value->AssetId == $intAssetId) {
                 unset($this->ctlAssetTransact->objAssetArray[$key]);
             } elseif ($objLinkedAssetArray) {
                 foreach ($objLinkedAssetArray as $objLinkedAsset) {
                     if ($value->AssetId == $objLinkedAsset->AssetId) {
                         unset($this->ctlAssetTransact->objAssetArray[$key]);
                     }
                 }
             }
         }
     }
     $this->ctlAssetTransact->dtgAssetTransact->Refresh();
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:19,代码来源:asset_edit.php

示例2: btnReceiveAssetTransaction_Click

 public function btnReceiveAssetTransaction_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     $intAssetTransactionId = $strParameter;
     if ($this->objAssetTransactionArray) {
         try {
             // Get an instance of the database
             $objDatabase = QApplication::$Database[1];
             // Begin a MySQL Transaction to be either committed or rolled back
             $objDatabase->TransactionBegin();
             // This boolean later lets us know if we need to flip the ReceivedFlag
             $blnAllAssetsReceived = true;
             $this->dtgAssetTransact->Warning = "";
             $objAssetTransactionArray = array();
             $objLinkedAssetTransactionArray = array();
             foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
                 if (!$objAssetTransaction->Asset->LinkedFlag) {
                     $objAssetTransactionArray[] = $objAssetTransaction;
                 } else {
                     $objLinkedAssetTransactionArray[$objAssetTransaction->Asset->AssetCode] = $objAssetTransaction;
                 }
             }
             foreach ($objAssetTransactionArray as &$objAssetTransaction) {
                 if ($objAssetTransaction->AssetTransactionId == $intAssetTransactionId) {
                     // Get the value of the location where this Asset is being received to
                     $lstLocationAssetReceived = $this->GetControl('lstLocationAssetReceived' . $objAssetTransaction->AssetTransactionId);
                     if ($lstLocationAssetReceived && $lstLocationAssetReceived->SelectedValue) {
                         if ($objAssetTransaction->Asset->LinkedFlag) {
                             $blnError = true;
                             $this->dtgAssetTransact->Warning .= sprintf("Asset Tag %s is locked to a parent asset.<br />", $objAssetTransaction->Asset->AssetCode);
                         } else {
                             // Set the DestinationLocation of the AssetTransaction
                             $objAssetTransaction->DestinationLocationId = $lstLocationAssetReceived->SelectedValue;
                             $objAssetTransaction->Save();
                             // Reload AssetTransaction to avoid Optimistic Locking Exception if this receipt is edited and saved.
                             $objAssetTransaction = AssetTransaction::Load($objAssetTransaction->AssetTransactionId);
                             // Move the asset to the new location
                             $objAssetTransaction->Asset->LocationId = $lstLocationAssetReceived->SelectedValue;
                             $objAssetTransaction->Asset->Save();
                             if ($objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objAssetTransaction->Asset->AssetId)) {
                                 foreach ($objLinkedAssetArray as $objLinkedAsset) {
                                     $objLinkedAssetTransaction = $objLinkedAssetTransactionArray[$objLinkedAsset->AssetCode];
                                     $objLinkedAssetTransaction->DestinationLocationId = $lstLocationAssetReceived->SelectedValue;
                                     $objLinkedAssetTransaction->Save();
                                     $objLinkedAssetTransaction->Asset->LocationId = $lstLocationAssetReceived->SelectedValue;
                                     $objLinkedAssetTransaction->Asset->Save();
                                 }
                             }
                             $objAssetTransaction->Asset = Asset::Load($objAssetTransaction->AssetId);
                         }
                     } else {
                         $blnError = true;
                         $lstLocationAssetReceived->Warning = "Please Select a Location.";
                     }
                 }
                 // If any AssetTransaction still does not have a DestinationLocation, it is still Pending
                 if (!$objAssetTransaction->DestinationLocationId && !$objAssetTransaction->Asset->LinkedFlag) {
                     $blnAllAssetsReceived = false;
                 }
             }
             // If all the assets have been received, check that all the inventory has been received
             if ($blnAllAssetsReceived) {
                 $blnAllInventoryReceived = true;
                 if ($this->objInventoryTransactionArray) {
                     foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
                         if (!$objInventoryTransaction->DestinationLocationId) {
                             $blnAllInventoryReceived = false;
                         }
                     }
                 }
                 // Set the entire receipt as received if assets and inventory have all been received
                 if ($blnAllInventoryReceived) {
                     $this->objReceipt->ReceivedFlag = true;
                     $this->objReceipt->ReceiptDate = new QDateTime(QDateTime::Now);
                     $this->objReceipt->Save();
                     // Reload to get new timestamp to avoid optimistic locking if edited/saved again without reload
                     $this->objReceipt = Receipt::Load($this->objReceipt->ReceiptId);
                     // Update labels (specifically we want to update Received Date)
                     $this->UpdateReceiptLabels();
                 }
             }
             // Commit all of the transactions to the database
             $objDatabase->TransactionCommit();
         } catch (QExtendedOptimisticLockingException $objExc) {
             // Rollback the database transactions if an exception was thrown
             $objDatabase->TransactionRollback();
             if ($objExc->Class == 'AssetTransaction' || $objExc->Class == 'Asset') {
                 // Set the offending AssetTransaction DestinationLocation to null so that the value doesn't change in the datagrid
                 if ($objExc->Class == 'AssetTransaction' && $this->objAssetTransactionArray) {
                     foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
                         if ($objAssetTransaction->AssetTransactionId == $objExc->EntityId) {
                             $objAssetTransaction->DestinationLocationId = null;
                         }
                     }
                 }
                 $this->dtgAssetTransact->Warning = sprintf('That asset has been added, removed, or received by another user. You must <a href="receipt_edit.php?intReceiptId=%s">Refresh</a> to edit this receipt.', $this->objReceipt->ReceiptId);
             } else {
                 throw new QOptimisticLockingException($objExc->Class);
             }
         }
//.........这里部分代码省略.........
开发者ID:proxymoron,项目名称:tracmor,代码行数:101,代码来源:receipt_edit.php

示例3: LoadChildLinkedArrayByParentAssetId

 /**
  * Loads array of Child Linked Asset Objects with custom field virtual attributes
  *
  * @param int $intParentAssetId AssetId of the parent asset to load linked assets
  * @return mixed
  */
 public static function LoadChildLinkedArrayByParentAssetId($intParentAssetId)
 {
     $objLinkedAssetArray = array();
     Asset::QueryHelper($objDatabase);
     $arrCustomFieldSql = CustomField::GenerateHelperSql(EntityQtype::Asset);
     // Setup the SQL Query
     $strQuery = sprintf("\n\t\t\t\tSELECT \n\t\t\t\t\t`asset`.* \n\t\t\t\t\t%s\n\t\t\t\tFROM \n\t\t\t\t\t`asset` \n\t\t\t\t\t%s\n\t\t\t\tWHERE `asset`.`parent_asset_id` = %s\n\t\t\t\tAND `asset`.`linked_flag` = 1\n\t\t\t", $arrCustomFieldSql['strSelect'], $arrCustomFieldSql['strFrom'], $intParentAssetId);
     // Perform the Query and Instantiate the Result
     $objDbResult = $objDatabase->Query($strQuery);
     $objChildAssetArray = Asset::InstantiateDbResult($objDbResult);
     if ($objChildAssetArray && count($objChildAssetArray)) {
         foreach ($objChildAssetArray as $objLinkedAsset) {
             $objLinkedAssetArray[] = $objLinkedAsset;
             $objNewLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objLinkedAsset->AssetId);
             if ($objNewLinkedAssetArray) {
                 foreach ($objNewLinkedAssetArray as $objLinkedAsset2) {
                     $objLinkedAssetArray[] = $objLinkedAsset2;
                 }
             }
         }
         return $objLinkedAssetArray;
     } else {
         return false;
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:31,代码来源:Asset.class.php

示例4: Transaction

 } else {
     $intDestinationLocationId = $objDestinationLocation->LocationId;
     // There is a 1 to Many relationship between Transaction and AssetTransaction so each Transaction can have many AssetTransactions.
     $objTransaction = new Transaction();
     $objTransaction->EntityQtypeId = EntityQtype::Asset;
     $objTransaction->TransactionTypeId = 2;
     // Check in
     $objTransaction->Save();
     foreach ($objAssetArray as $objAsset) {
         $objAssetTransaction = new AssetTransaction();
         $objAssetTransaction->AssetId = $objAsset->AssetId;
         $objAssetTransaction->TransactionId = $objTransaction->TransactionId;
         $objAssetTransaction->SourceLocationId = $objAsset->LocationId;
         $objAssetTransaction->DestinationLocationId = $intDestinationLocationId;
         $objAssetTransaction->Save();
         $objLinkedAssetArrayByNewAsset = Asset::LoadChildLinkedArrayByParentAssetId($objAsset->AssetId);
         if ($objLinkedAssetArrayByNewAsset) {
             foreach ($objLinkedAssetArrayByNewAsset as $objLinkedAsset) {
                 $objLinkedAsset->CheckedOutFlag = false;
                 $objLinkedAsset->LocationId = $intDestinationLocationId;
                 $objLinkedAsset->Save();
                 // Create the new assettransaction object and save it
                 $objAssetTransaction = new AssetTransaction();
                 $objAssetTransaction->AssetId = $objLinkedAsset->AssetId;
                 $objAssetTransaction->TransactionId = $objTransaction->TransactionId;
                 $objAssetTransaction->SourceLocationId = $objAsset->LocationId;
                 $objAssetTransaction->DestinationLocationId = $intDestinationLocationId;
                 $objAssetTransaction->Save();
             }
         }
         $objAsset->CheckedOutFlag = false;
开发者ID:proxymoron,项目名称:tracmor,代码行数:31,代码来源:asset_check_in.php

示例5: SetupDisplay

 public function SetupDisplay($intTransactionTypeId)
 {
     $this->intTransactionTypeId = $intTransactionTypeId;
     $this->ctlAssetSearchTool->blnSearchArchived = false;
     switch ($this->intTransactionTypeId) {
         // Move
         case 1:
             $this->lstLocation->Display = true;
             break;
             // Check In
         // Check In
         case 2:
             $this->lstLocation->Display = true;
             break;
             // Check Out
         // Check Out
         case 3:
             $this->lstLocation->Display = false;
             break;
             // Reserve
         // Reserve
         case 8:
             $this->lstLocation->Display = false;
             break;
             // Unreserve
         // Unreserve
         case 9:
             $this->lstLocation->Display = false;
             break;
             // Archive
         // Archive
         case 10:
             $this->lstLocation->Display = false;
             break;
             // Unarchive
         // Unarchive
         case 11:
             $this->lstLocation->Display = true;
             $this->ctlAssetSearchTool->blnSearchArchived = true;
             break;
     }
     // Redeclare in case the asset has been edited by asset_id as asset_code also can be changed
     $this->objAssetArray = null;
     if ($this->blnEditMode && $this->objAsset instanceof Asset) {
         $this->objAssetArray[] = Asset::LoadByAssetIdWithCustomFields($this->objAsset->AssetId);
         // Load all child assets
         $objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($this->objAsset->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", $this->objAsset->AssetCode, implode('<br />', $strAssetCodeArray));
         }
     }
 }
开发者ID:jdellinger,项目名称:tracmor,代码行数:57,代码来源:QAssetTransactComposite.class.php

示例6: array_unique

             $objAssetTransactionArray[$objNewAsset->AssetId] = $objPendingReceipt;
         }
     }
 }
 if (!$blnError) {
     $arrPendingReceiptId = array_unique($arrPendingReceiptId);
     foreach ($objAssetArray as $objAsset) {
         $objDestinationLocation = $arrLocation[$objAsset->AssetId];
         $intDestinationLocationId = $objDestinationLocation->LocationId;
         // Set the DestinationLocation of the AssetTransaction
         $objAssetTransaction = $objAssetTransactionArray[$objAsset->AssetId];
         $objAssetTransaction->DestinationLocationId = $intDestinationLocationId;
         $objAssetTransaction->Save();
         $objAsset->LocationId = $intDestinationLocationId;
         $objAsset->Save();
         if ($objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objAsset->AssetId)) {
             foreach ($objLinkedAssetArray as $objLinkedAsset) {
                 $objLinkedAsset->LocationId = $intDestinationLocationId;
                 $objLinkedAsset->Save();
                 if ($objChildPendingReceipt = AssetTransaction::PendingReceipt($objLinkedAsset->AssetId)) {
                     $objChildPendingReceipt->DestinationLocationId = $intDestinationLocationId;
                     $objChildPendingReceipt->Save();
                 }
             }
         }
     }
     foreach ($arrPendingReceiptId as $intReceiptId) {
         Receipt::ReceiptComplete($intReceiptId);
     }
     $strWarning .= "Your transaction has successfully completed<br /><a href='index.php'>Main Menu</a> | <a href='asset_menu.php'>Manage Assets</a><br />";
     //Remove that flag when transaction is compelete or exists some errors
开发者ID:proxymoron,项目名称:tracmor,代码行数:31,代码来源:asset_receive.php

示例7: disableAdvancedIfInternal

 protected function disableAdvancedIfInternal()
 {
     if (!$this->lblFromCompany->Display) {
         if ($this->lstToCompany->SelectedValue == $this->lstFromCompany->SelectedValue) {
             // switch off advansed parameters
             if ($this->objAssetTransactionArray) {
                 $objNewAssetTransactionArray = array();
                 foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
                     $objNewAssetTransactionArray[$objAssetTransaction->Asset->AssetCode] = $objAssetTransaction;
                 }
                 foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
                     // set advansed to 'None'
                     $objAssetTransaction->ScheduleReceiptFlag = false;
                     $objAssetTransaction->NewAssetFlag = false;
                     $objAssetTransaction->NewAssetId = null;
                     $objAssetTransaction->NewAsset = null;
                     $objAssetTransaction->ScheduleReceiptDueDate = null;
                     if ($objLinkedAssetCodeArray = Asset::LoadChildLinkedArrayByParentAssetId($objAssetTransaction->Asset->AssetId)) {
                         foreach ($objLinkedAssetCodeArray as $objLinkedAssetCode) {
                             $objLinkedAssetTransaction = $objNewAssetTransactionArray[$objLinkedAssetCode->AssetCode];
                             $objLinkedAssetTransaction->ScheduleReceiptFlag = false;
                             $objLinkedAssetTransaction->NewAssetFlag = false;
                             $objLinkedAssetTransaction->NewAssetId = null;
                             $objLinkedAssetTransaction->NewAsset = null;
                             $objLinkedAssetTransaction->ScheduleReceiptDueDate = null;
                         }
                     }
                 }
                 $this->blnModifyAssets = true;
             }
             $this->dtgAssetTransact->RemoveColumnByName('Advanced');
             $this->dtgAssetTransact->RemoveColumnByName('Due Date');
         } else {
             if (!$this->dtgAssetTransact->GetColumnByName('Advanced')) {
                 $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Advanced', '<?= $_FORM->AdvancedColumn_Render($_ITEM) ?>', array('CssClass' => "dtg_column", 'HtmlEntities' => false)));
                 $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Due Date', '<?= $_FORM->DueDateColumn_Render($_ITEM) ?>', array('CssClass' => "dtg_column", 'HtmlEntities' => false)));
             }
         }
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:40,代码来源:shipment_edit.php

示例8: btnCompleteShipment_Click


//.........这里部分代码省略.........
                                 $objReceipt = new Receipt();
                                 $objReceipt->TransactionId = $objTransaction->TransactionId;
                                 // The receipt will be coming from the company that was shipped to
                                 $objReceipt->FromCompanyId = $this->objShipment->ToCompanyId;
                                 $objReceipt->FromContactId = $this->objShipment->ToContactId;
                                 $objReceipt->ToContactId = $this->objShipment->FromContactId;
                                 $objReceipt->ToAddressId = $this->objShipment->FromAddressId;
                                 $objReceipt->ReceivedFlag = 0;
                                 $objReceipt->ReceiptNumber = Receipt::LoadNewReceiptNumber();
                                 if ($objAssetTransaction->ScheduleReceiptDueDate) {
                                     $objReceipt->DueDate = $objAssetTransaction->ScheduleReceiptDueDate;
                                 }
                                 $objReceipt->Save();
                             }
                             $objReceiptAssetTransaction = new AssetTransaction();
                             // If this is a return
                             if (!$objAssetTransaction->NewAssetId) {
                                 $objReceiptAssetTransaction->AssetId = $objAssetTransaction->AssetId;
                             } else {
                                 // Both the shipmentAssetTranscation (objAssetTransaction and the objReceiptAssetTransaction were involved in creating a new asset
                                 // Asset Transactions where NewAssetFlag = true but AssetId is NULL are receipt asset transactions for exchanges.
                                 $objReceiptAssetTransaction->AssetId = $objAssetTransaction->NewAssetId;
                                 $objReceiptAssetTransaction->NewAssetFlag = true;
                                 $objAssetTransaction->NewAssetFlag = true;
                                 $objAssetTransaction->Save();
                             }
                             $objReceiptAssetTransaction->TransactionId = $objTransaction->TransactionId;
                             $objReceiptAssetTransaction->SourceLocationId = $objAssetTransaction->DestinationLocationId;
                             // This is not right. NewAssetFlag should be set only if a new asset was created when creating this AssetTransaction
                             // It should not be true on the new AssetTransaction, but only on the AssetTransaction that caused the new asset to be created.
                             // $objReceiptAssetTransaction->NewAssetFlag = true;
                             $objReceiptAssetTransaction->Save();
                             // Load all child assets
                             if ($objLinkedAssetCodeArray = Asset::LoadChildLinkedArrayByParentAssetId($objAssetTransaction->Asset->AssetId)) {
                                 foreach ($objLinkedAssetCodeArray as $objLinkedAssetCode) {
                                     $objLinkedAssetTransaction = $objNewAssetTransactionArray[$objLinkedAssetCode->AssetCode];
                                     $objLinkedReceiptAssetTransaction = new AssetTransaction();
                                     // If this is a return
                                     if (!$objAssetTransaction->NewAssetId) {
                                         $objLinkedReceiptAssetTransaction->AssetId = $objLinkedAssetTransaction->AssetId;
                                         $objLinkedReceiptAssetTransaction->TransactionId = $objTransaction->TransactionId;
                                         $objLinkedReceiptAssetTransaction->SourceLocationId = $objAssetTransaction->DestinationLocationId;
                                         $objLinkedReceiptAssetTransaction->Save();
                                     } else {
                                         // Both the shipmentAssetTranscation (objAssetTransaction and the objReceiptAssetTransaction were involved in creating a new asset
                                         // Asset Transactions where NewAssetFlag = true but AssetId is NULL are receipt asset transactions for exchanges.
                                         $objLinkedReceiptAssetTransaction->AssetId = $objAssetTransaction->NewAssetId;
                                     }
                                     $objNewAssetTransactionArray[$objLinkedAssetCode->AssetCode] = $objLinkedAssetTransaction;
                                 }
                             }
                         }
                         $objAssetTransaction->Save();
                         if ($objAssetTransaction->ScheduleReceiptFlag) {
                             // Set the Receipt Asset Transaction as child of the Shipment Asset Transaction
                             $objAssetTransaction->AssociateChildAssetTransaction($objReceiptAssetTransaction);
                         }
                         $objReceipt = null;
                         $objTransaction = null;
                     }
                 }
             }
             if ($intEntityQtypeId == EntityQtype::AssetInventory || $intEntityQtypeId == EntityQtype::Inventory) {
                 // Assign different source and destinations depending on transaction type
                 foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
                     // LocationId #2 == Shipped
开发者ID:brustj,项目名称:tracmor,代码行数:67,代码来源:shipment_edit.php

示例9: LoadChildLinkedArrayByParentAssetId

 /**
  * Loads array of Child Linked Asset Objects
  *
  * @param int $intParentAssetId AssetId of the parent asset to load linked assets
  * @return mixed
  */
 public function LoadChildLinkedArrayByParentAssetId($intParentAssetId)
 {
     $objLinkedAssetArray = array();
     $objChildAssetArray = Asset::LoadArrayByParentAssetIdLinkedFlag($intParentAssetId, 1);
     if ($objChildAssetArray && count($objChildAssetArray)) {
         foreach ($objChildAssetArray as $objLinkedAsset) {
             $objLinkedAssetArray[] = $objLinkedAsset;
             $objNewLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objLinkedAsset->AssetId);
             if ($objNewLinkedAssetArray) {
                 foreach ($objNewLinkedAssetArray as $objLinkedAsset2) {
                     $objLinkedAssetArray[] = $objLinkedAsset2;
                 }
             }
         }
         return $objLinkedAssetArray;
     } else {
         return false;
     }
 }
开发者ID:brustj,项目名称:tracmor,代码行数:25,代码来源:Asset.class.php


注:本文中的Asset::LoadChildLinkedArrayByParentAssetId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。