mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-28 14:44:17 +01:00
N°7636 - Too many OQL requests executed in order to display a lnk (#661)
This commit is contained in:
@@ -82,6 +82,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
protected bool $bIsAllowCreate;
|
||||
protected bool $bIsAllowModify;
|
||||
protected bool $bIsAllowDelete;
|
||||
protected int $iCount;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -95,7 +96,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function __construct(WebPage $oPage, DBObject $oDbObject, string $sObjectClass, string $sAttCode, AttributeLinkedSet $oAttDef, bool $bIsReadOnly = false)
|
||||
public function __construct(WebPage $oPage, DBObject $oDbObject, string $sObjectClass, string $sAttCode, AttributeLinkedSet $oAttDef, bool $bIsReadOnly = false, ?int $iCount = null)
|
||||
{
|
||||
parent::__construct("links_view_table_$sAttCode", ["ibo-block-links-table"]);
|
||||
|
||||
@@ -106,6 +107,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
$this->oDbObject = $oDbObject;
|
||||
$this->sTableId = 'rel_'.$this->sAttCode;
|
||||
$this->bIsAttEditable = !$bIsReadOnly;
|
||||
$this->iCount = $iCount;
|
||||
$this->SetDataAttributes(['role' => 'ibo-block-links-table', 'link-attcode' => $sAttCode, 'link-class' => $this->oAttDef->GetLinkedClass()]);
|
||||
// Initialization
|
||||
$this->Init();
|
||||
@@ -195,9 +197,13 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
$oOrmLinkSet = $this->oDbObject->Get($this->sAttCode);
|
||||
$oLinkSet = $oOrmLinkSet->ToDBObjectSet(utils::ShowObsoleteData());
|
||||
|
||||
$aExtraParams = $this->GetExtraParam();
|
||||
if (is_null($this->iCount) === false) {
|
||||
$aExtraParams['object_count' ] = $this->iCount;
|
||||
}
|
||||
// add list block
|
||||
$oBlock = new DisplayBlock($oLinkSet->GetFilter(), DisplayBlock::ENUM_STYLE_LIST_IN_OBJECT, false);
|
||||
$this->AddSubBlock($oBlock->GetRenderContent($oPage, $this->GetExtraParam(), $this->sTableId));
|
||||
$this->AddSubBlock($oBlock->GetRenderContent($oPage, $aExtraParams, $this->sTableId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user