DBObject addon,bizmodel false autoincrement attachment id %1$s %2$s expire false temp_id true item_class false item_id true item_org_id 0 true true public Overload-ExNihilo false public Overload-ExNihilo GetKey(); $this->Set('item_class', $sClass); $this->Set('item_id', $iItemId); $aCallSpec = array($sClass, 'MapContextParam'); if (is_callable($aCallSpec)) { $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter if (MetaModel::IsValidAttCode($sClass, $sAttCode)) { $iOrgId = $oItem->Get($sAttCode); if ($iOrgId > 0) { if ($iOrgId != $this->Get('item_org_id')) { $this->Set('item_org_id', $iOrgId); if ($bUpdateOnChange) { $this->DBUpdate(); } } } } } }]]> /** * Give a default value for item_org_id (if relevant...) * @return void */ false public Overload-ExNihilo Get('item_class'); $aCallSpec = array($sClass, 'MapContextParam'); if (is_callable($aCallSpec)) { $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter if (MetaModel::IsValidAttCode($sClass, $sAttCode)) { // Second: check that the organization CAN be fetched from the current user // if (MetaModel::IsValidClass('Person')) { $aCallSpec = array($sClass, 'MapContextParam'); if (is_callable($aCallSpec)) { $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter if (MetaModel::IsValidAttCode($sClass, $sAttCode)) { // OK - try it // $oCurrentPerson = MetaModel::GetObject('Person', UserRights::GetContactId(), false); if ($oCurrentPerson) { $this->Set('item_org_id', $oCurrentPerson->Get($sAttCode)); } } } } } } }]]>
10 20 30 40
10 20 30 10 20 30