N°6314 N°1150 Fix cannot reopen or close a UR in the user portal

Since introduction of MultipleChoicesField and SelectObjectField value checks with b71cd218, when a portal user was trying to do an action on a resolved UR the agent_id field was rejected. The reason for the rejection is the corresponding SelectObjectField query is containing the portal user scopes (query generated in ObjectFormManager::Build), and of course the agent_id set isn't in this scope...

As a workaround we are disabling those checks for read only fields (values are set server side and possibly in a different context than the portal user)
This commit is contained in:
Pierre Goiffon
2023-05-16 17:34:50 +02:00
parent ea88aa85df
commit 4038d4d925
2 changed files with 26 additions and 22 deletions

View File

@@ -218,14 +218,16 @@ abstract class MultipleChoicesField extends Field
$this->SetValid(true);
$this->EmptyErrorMessages();
if (count($this->currentValue) > 0) {
foreach ($this->currentValue as $sCode => $value) {
if (utils::IsNullOrEmptyString($value)) {
continue;
}
if (false === array_key_exists($value, $this->aChoices)) {
$this->SetValid(false);
$this->AddErrorMessage("Value ({$value}) is not part of the field possible values list");
if ($this->GetReadOnly() === false) {
if (count($this->currentValue) > 0) {
foreach ($this->currentValue as $sCode => $value) {
if (utils::IsNullOrEmptyString($value)) {
continue;
}
if (false === array_key_exists($value, $this->aChoices)) {
$this->SetValid(false);
$this->AddErrorMessage("Value ({$value}) is not part of the field possible values list");
}
}
}
}