From 7c8fb1a51dbdbeee3be37023876765c84cb1d98f Mon Sep 17 00:00:00 2001 From: Anne-Cath Date: Tue, 9 Dec 2025 09:15:51 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B08852=20-=20improve=20display=20attachmen?= =?UTF-8?q?t=20in=20properties=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2.x/itop-attachments/main.itop-attachments.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/datamodels/2.x/itop-attachments/main.itop-attachments.php b/datamodels/2.x/itop-attachments/main.itop-attachments.php index e2025e731..8913dce1a 100644 --- a/datamodels/2.x/itop-attachments/main.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/main.itop-attachments.php @@ -5,10 +5,12 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ +use Combodo\iTop\Application\UI\Base\Component\FieldSet\FieldSetUIBlockFactory; use Combodo\iTop\Application\WebPage\WebPage; use Combodo\iTop\Service\Events\EventData; use Combodo\iTop\Service\Events\EventService; use Combodo\iTop\Service\Events\iEventServiceSetup; +use Combodo\iTop\Application\UI\Base\Component\Html\Html; class AttachmentPlugIn implements iApplicationUIExtension, iEventServiceSetup { @@ -236,10 +238,14 @@ class AttachmentPlugIn implements iApplicationUIExtension, iEventServiceSetup } $oAttachmentsRenderer = AttachmentsRendererFactory::GetInstance($oPage, $sObjClass, $iObjKey, $sTransactionId); + $iCount = $oAttachmentsRenderer->GetAttachmentsSet()->Count() + $oAttachmentsRenderer->GetTempAttachmentsSet()->Count(); + $sTitle = ($iCount > 0) ? Dict::Format('Attachments:TabTitle_Count', $iCount) : Dict::S('Attachments:EmptyTabTitle'); if ($this->GetAttachmentsPosition() === 'relations') { - $iCount = $oAttachmentsRenderer->GetAttachmentsSet()->Count() + $oAttachmentsRenderer->GetTempAttachmentsSet()->Count(); - $sTitle = ($iCount > 0) ? Dict::Format('Attachments:TabTitle_Count', $iCount) : Dict::S('Attachments:EmptyTabTitle'); $oPage->SetCurrentTab('Attachments:Tab', $sTitle); + } else { + $oBlock = FieldSetUIBlockFactory::MakeStandard($sTitle); + $oBlock->AddSubBlock(new Html('')); + $oPage->AddUiBlock($oBlock); } $bIsReadOnlyState = self::IsReadonlyState($oObject, $oObject->GetState(), AttachmentPlugIn::ENUM_GUI_BACKOFFICE);