mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 09:38:48 +02:00
(Retrofit from trunk) N°804 Portal: Object display crashed when a linkedset attribute has corrupted data (eg. an external key to 0)
SVN:2.3[4639]
This commit is contained in:
@@ -19,7 +19,9 @@
|
||||
|
||||
namespace Combodo\iTop\Renderer\Bootstrap\FieldRenderer;
|
||||
|
||||
use \Exception;
|
||||
use \utils;
|
||||
use \IssueLog;
|
||||
use \Dict;
|
||||
use \UserRights;
|
||||
use \InlineImage;
|
||||
@@ -479,8 +481,17 @@ EOF
|
||||
// In case of indirect linked set, we must retrieve the remote object
|
||||
if ($this->oField->IsIndirect())
|
||||
{
|
||||
// Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated
|
||||
$oRemoteItem = MetaModel::GetObject($this->oField->GetTargetClass(), $oItem->Get($this->oField->GetExtKeyToRemote()), true, true);
|
||||
try{
|
||||
// Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated
|
||||
$oRemoteItem = MetaModel::GetObject($this->oField->GetTargetClass(), $oItem->Get($this->oField->GetExtKeyToRemote()), true, true);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
// In some cases we can't retrieve an object from a linkedset, eg. when the extkey to remote is 0 due to a database corruption.
|
||||
// Rather than crashing we rather just skip the object like in the administration console
|
||||
IssueLog::Error('Could not retrieve object of linkedset in form #'.$this->oField->GetFormPath().' for field #'.$this->oField->GetId().'. Message: '.$e->getMessage());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user