N°803 - Allow display & edition of attributes on n:n relations on Portal

- Issue when selecting links rows with checkbox
- Change linked set field validation to prevent checking host id -1
This commit is contained in:
Benjamin Dalsass
2023-06-12 17:25:03 +02:00
parent ad1836d028
commit 465388b5e3
3 changed files with 47 additions and 36 deletions

View File

@@ -358,17 +358,26 @@ class LinkedSetField extends Field
/** @var ormLinkSet $oSet */
$oSet = $this->GetCurrentValue();
// retrieve displayed attributes
$aAttributesToDisplayCodes = $this->GetLnkAttributesToDisplay(true);
// validate each links...
/** @var \DBObject $oItem */
foreach ($oSet as $oItem) {
list($bRes, $aIssues) = $oItem->CheckToWrite();
if ($bRes === false) {
foreach ($aIssues as $sIssue) {
$sItem = $oItem->Get('friendlyname') != '' ? $oItem->Get('friendlyname') : Dict::S('UI:Links:NewItem');
$this->AddErrorMessage('<b>'.$sItem.' : </b>'.$sIssue);
$aChanges = $oItem->ListChanges();
foreach ($aChanges as $sAttCode => $value) {
if (!in_array($sAttCode, $aAttributesToDisplayCodes)) {
continue;
}
$res = $oItem->CheckValue($sAttCode);
if ($res !== true) {
$sAttLabel = $this->GetLabel($sAttCode);
$sItem = $oItem->Get('friendlyname') != '' ? $oItem->Get('friendlyname') : Dict::S('UI:Links:NewItem');
$sIssue = Dict::Format('Core:CheckValueError', $sAttLabel, $sAttCode, $res);
$this->AddErrorMessage('<b>'.$sItem.' : </b>'.$sIssue);
$bValid = false;
}
$bValid = false;
}
}
$oSet->Rewind();