Patch for supporting a data model without any Person.

SVN:trunk[1016]
This commit is contained in:
Denis Flaven
2010-12-07 15:06:17 +00:00
parent e3caff6689
commit 5ff5e3f1a7

View File

@@ -444,20 +444,23 @@ class UserRightsProfile extends UserRightsAddOnAPI
$iOrgId = 0;
}
$oContact = new Person();
$oContact->Set('name', 'My last name');
$oContact->Set('first_name', 'My first name');
//$oContact->Set('status', 'available');
if (MetaModel::IsValidAttCode('Person', 'org_id'))
// Support drastic data model changes: no Person class !
if (MetaModel::IsValidClass('Person'))
{
// Protect for a different data model where contacts are not part of an org
$oContact->Set('org_id', $iOrgId);
$oContact = new Person();
$oContact->Set('name', 'My last name');
$oContact->Set('first_name', 'My first name');
if (MetaModel::IsValidAttCode('Person', 'org_id'))
{
$oContact->Set('org_id', $iOrgId);
}
$oContact->Set('email', 'my.email@foo.org');
$iContactId = $oContact->DBInsertTrackedNoReload($oChange, true /* skip security */);
}
else
{
$iContactId = 0;
}
$oContact->Set('email', 'my.email@foo.org');
//$oContact->Set('phone', '');
//$oContact->Set('location_id', $iLocationId);
//$oContact->Set('employee_number', '');
$iContactId = $oContact->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oUser = new UserLocal();
$oUser->Set('login', $sAdminUser);