N°7963 - Inlineimage::SetDefaultOrgId blend field name between Person and linked class

This commit is contained in:
Anne-Cath
2024-11-13 11:17:35 +01:00
parent e7488b2c89
commit c2d0c310a9

View File

@@ -153,18 +153,18 @@ class InlineImage extends DBObject
//
if (MetaModel::IsValidClass('Person'))
{
$aCallSpec = array($sClass, 'MapContextParam');
if (is_callable($aCallSpec))
$aCallSpecPerson = array('Person', 'MapContextParam');
if (is_callable($aCallSpecPerson))
{
$sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter
if (MetaModel::IsValidAttCode($sClass, $sAttCode))
$sAttCodePerson = call_user_func($aCallSpecPerson, 'org_id'); // Returns null when there is no mapping for this parameter
if (MetaModel::IsValidAttCode('Person', $sAttCodePerson))
{
// OK - try it
//
$oCurrentPerson = MetaModel::GetObject('Person', UserRights::GetContactId(), false);
if ($oCurrentPerson)
{
$this->Set('item_org_id', $oCurrentPerson->Get($sAttCode));
$this->Set('item_org_id', $oCurrentPerson->Get($sAttCodePerson));
}
}
}