Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 8 commits into
base: support/3.2
Choose a base branch
from
Open
10 changes: 5 additions & 5 deletions core/inlineimage.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,18 @@ public function SetDefaultOrgId()
//
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));
}
}
}
Expand Down