From 3c94974d9dd70d5c6d22d05451a3b9b8ee8ed32f Mon Sep 17 00:00:00 2001 From: acognet Date: Tue, 25 Apr 2023 12:09:11 +0200 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B0541=20-=20Dashlets:=20Improve=20read?= =?UTF-8?q?ability=20when=20to=20much=20labels=20(pie=20chart)=20or=20too?= =?UTF-8?q?=20long=20labels=20(bar=20chart)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/displayblock.class.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 1fff40f1f..918060846 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -1009,7 +1009,6 @@ EOF $iTotalCount = 0; $aValues = array(); $aURLs = array(); - $iMaxNbCharsInLabel = 0; foreach ($aRes as $iRow => $aRow) { @@ -1019,9 +1018,6 @@ EOF $iTotalCount += $aRow['_itop_count_']; $aValues[] = array('label' => html_entity_decode(strip_tags($sHtmlValue), ENT_QUOTES, 'UTF-8'), 'label_html' => $sHtmlValue, 'value' => (int) $aRow[$sFctVar]); - if ($iMaxNbCharsInLabel < mb_strlen($sValue)) { - $iMaxNbCharsInLabel = mb_strlen($sValue); - } // Build the search for this subset $oSubsetSearch = $this->m_oFilter->DeepClone(); @@ -1036,9 +1032,13 @@ EOF { case 'bars': $aNames = array(); + $iMaxNbCharsInLabel = 0; foreach($aValues as $idx => $aValue) { $aNames[$idx] = $aValue['label']; + if ($iMaxNbCharsInLabel < mb_strlen($aValue['label'])) { + $iMaxNbCharsInLabel = mb_strlen($aValue['label']); + } } $sJSNames = json_encode($aNames); From 9d3e389011b9667a2c498b73eceedba377849053 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Tue, 25 Apr 2023 17:43:51 +0200 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B06124=20-=20Workaround=20performance?= =?UTF-8?q?=20problem=20on=20adding=20items=20to=20an=20object=20with=20an?= =?UTF-8?q?=20n:n=20relation=20having=20a=20large=20volume?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/ui.linkswidget.class.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/application/ui.linkswidget.class.inc.php b/application/ui.linkswidget.class.inc.php index e2bf70609..ba32c0fd3 100644 --- a/application/ui.linkswidget.class.inc.php +++ b/application/ui.linkswidget.class.inc.php @@ -207,8 +207,11 @@ EOF foreach($this->m_aEditableFields as $sFieldCode) { + // N°6124 - Force remote ext. key as read-only if too many items in the linkset + $bReadOnlyField = ($sFieldCode === $this->m_sExtKeyToRemote) && (false === $bAllowRemoteExtKeyEdit); + $sSafeFieldId = $this->GetFieldId($iUniqueId, $sFieldCode); - $this->AddRowForFieldCode($aRow, $sFieldCode, $aArgs, $oNewLinkObj, $oP, $sNameSuffix, $sSafeFieldId); + $this->AddRowForFieldCode($aRow, $sFieldCode, $aArgs, $oNewLinkObj, $oP, $sNameSuffix, $sSafeFieldId, $bReadOnlyField); $aFieldsMap[$sFieldCode] = $sSafeFieldId; $sValue = $oNewLinkObj->Get($sFieldCode); @@ -602,10 +605,11 @@ JS $aLinkedObjectIds = utils::ReadMultipleSelection($oFullSetFilter); $iAdditionId = $iMaxAddedId + 1; + $bAllowRemoteExtKeyEdit = count($aLinkedObjectIds) <= utils::GetConfig()->Get('link_set_max_edit_ext_key'); foreach ($aLinkedObjectIds as $iObjectId) { $oLinkedObj = MetaModel::GetObject($this->m_sRemoteClass, $iObjectId, false); if (is_object($oLinkedObj)) { - $aRow = $this->GetFormRow($oP, $oLinkedObj, $iObjectId, array(), $oCurrentObj, $iAdditionId); // Not yet created link get negative Ids + $aRow = $this->GetFormRow($oP, $oLinkedObj, $iObjectId, array(), $oCurrentObj, $iAdditionId, false /* Default value */, $bAllowRemoteExtKeyEdit); // Not yet created link get negative Ids $aData = []; foreach ($aRow as $item) { $aData[] = $item;