mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°5221 - DG Form: display related URs without the scope and its flag <ignore_silo>
This commit is contained in:
@@ -52,6 +52,8 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
|||||||
*/
|
*/
|
||||||
protected $bHasDelta = false;
|
protected $bHasDelta = false;
|
||||||
|
|
||||||
|
protected $bAllowAllData = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object from the original set, minus the removed objects
|
* Object from the original set, minus the removed objects
|
||||||
* @var DBObject[] array of iObjectId => DBObject
|
* @var DBObject[] array of iObjectId => DBObject
|
||||||
@@ -118,6 +120,11 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
|||||||
return clone $this->oOriginalSet->GetFilter();
|
return clone $this->oOriginalSet->GetFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function AllowAllData(): void
|
||||||
|
{
|
||||||
|
$this->bAllowAllData = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the subset of attributes to load (for each class of objects) before performing the SQL query for retrieving the rows from the DB
|
* Specify the subset of attributes to load (for each class of objects) before performing the SQL query for retrieving the rows from the DB
|
||||||
*
|
*
|
||||||
@@ -309,6 +316,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current element
|
* Return the current element
|
||||||
*
|
*
|
||||||
@@ -329,7 +337,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
|||||||
$iPreservedCount = count($this->aPreserved);
|
$iPreservedCount = count($this->aPreserved);
|
||||||
if ($this->iCursor < $iPreservedCount) {
|
if ($this->iCursor < $iPreservedCount) {
|
||||||
$sId = key($this->aPreserved);
|
$sId = key($this->aPreserved);
|
||||||
$oRet = MetaModel::GetObject($this->sClass, $sId);
|
$oRet = MetaModel::GetObject($this->sClass, $sId, true, $this->bAllowAllData);
|
||||||
} else {
|
} else {
|
||||||
$iModifiedCount = count($this->aModified);
|
$iModifiedCount = count($this->aModified);
|
||||||
if ($this->iCursor < $iPreservedCount + $iModifiedCount) {
|
if ($this->iCursor < $iPreservedCount + $iModifiedCount) {
|
||||||
|
|||||||
@@ -365,6 +365,9 @@ class ObjectFormManager extends FormManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oObject), $sAttCode);
|
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oObject), $sAttCode);
|
||||||
|
if ($oAttDef instanceof \AttributeLinkedSet && array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('ignore_scopes', $this->aExtraData[$sAttCode])) {
|
||||||
|
$oAttDef->AllowAllData();
|
||||||
|
}
|
||||||
|
|
||||||
/** @var Field $oField */
|
/** @var Field $oField */
|
||||||
$oField = null;
|
$oField = null;
|
||||||
@@ -572,7 +575,11 @@ class ObjectFormManager extends FormManager
|
|||||||
$aLimitedAccessItemIDs = [];
|
$aLimitedAccessItemIDs = [];
|
||||||
|
|
||||||
/** @var \ormLinkSet $oFieldOriginalSet */
|
/** @var \ormLinkSet $oFieldOriginalSet */
|
||||||
|
|
||||||
$oFieldOriginalSet = $oField->GetCurrentValue();
|
$oFieldOriginalSet = $oField->GetCurrentValue();
|
||||||
|
if (array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('ignore_scopes', $this->aExtraData[$sAttCode])) {
|
||||||
|
$oFieldOriginalSet->AllowAllData();
|
||||||
|
}
|
||||||
foreach ($oFieldOriginalSet as $oLink) {
|
foreach ($oFieldOriginalSet as $oLink) {
|
||||||
if ($oField->IsIndirect()) {
|
if ($oField->IsIndirect()) {
|
||||||
$iRemoteKey = $oLink->Get($oAttDef->GetExtKeyToRemote());
|
$iRemoteKey = $oLink->Get($oAttDef->GetExtKeyToRemote());
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ use ValueSetObjects;
|
|||||||
*/
|
*/
|
||||||
class AttributeLinkedSet extends AttributeDefinition
|
class AttributeLinkedSet extends AttributeDefinition
|
||||||
{
|
{
|
||||||
|
public $bAllowAllData = false;
|
||||||
/**
|
/**
|
||||||
* Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329)
|
* Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329)
|
||||||
*
|
*
|
||||||
@@ -50,6 +51,11 @@ class AttributeLinkedSet extends AttributeDefinition
|
|||||||
$this->aCSSClasses[] = 'attribute-set';
|
$this->aCSSClasses[] = 'attribute-set';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function AllowAllData()
|
||||||
|
{
|
||||||
|
$this->bAllowAllData = true;
|
||||||
|
}
|
||||||
|
|
||||||
public static function ListExpectedParams()
|
public static function ListExpectedParams()
|
||||||
{
|
{
|
||||||
return array_merge(
|
return array_merge(
|
||||||
@@ -89,7 +95,7 @@ class AttributeLinkedSet extends AttributeDefinition
|
|||||||
$oValSetDef = $this->Get("allowed_values");
|
$oValSetDef = $this->Get("allowed_values");
|
||||||
if (!$oValSetDef) {
|
if (!$oValSetDef) {
|
||||||
// Let's propose every existing value
|
// Let's propose every existing value
|
||||||
$oValSetDef = new ValueSetObjects('SELECT '.LinkSetModel::GetTargetClass($this));
|
$oValSetDef = new ValueSetObjects('SELECT '.LinkSetModel::GetTargetClass($this), '', [], $this->bAllowAllData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $oValSetDef;
|
return $oValSetDef;
|
||||||
|
|||||||
Reference in New Issue
Block a user