Fixed Trac#313: Provider contracts are filtered on the 'provider_id' - for filtering in the UI via the drop-down list of Organizations and for the security profiles ("Allowed Organizations"). The mapping for 'org_id', if any, is now taken into account by the security.

SVN:trunk[1120]
This commit is contained in:
Denis Flaven
2011-03-08 12:31:16 +00:00
parent 38a502aa25
commit 45134e182d
2 changed files with 25 additions and 0 deletions

View File

@@ -649,6 +649,14 @@ exit;
{
$sAttCode = 'id';
}
elseif (is_callable("$sClass::MapContextParam"))
{
$sAttCode = eval("return $sClass::MapContextParam('org_id');"); // Returns null when there is no mapping for this parameter
if ($sAttCode == null)
{
return true;
}
}
elseif(MetaModel::IsValidAttCode($sClass, 'org_id'))
{
$sAttCode = 'org_id';

View File

@@ -92,6 +92,23 @@ class ProviderContract extends Contract
MetaModel::Init_SetZListItems('standard_search', array('name', 'description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency', 'provider_id', 'sla', 'coverage'));
MetaModel::Init_SetZListItems('list', array('start_date', 'end_date', 'provider_id', 'sla', 'coverage'));
}
/**
* Maps the given context parameter name to the appropriate filter/search code for this class
* @param string $sContextParam Name of the context parameter, e.g. 'org_id'
* @return string Filter code, e.g. 'customer_id'
*/
public static function MapContextParam($sContextParam)
{
if ($sContextParam == 'org_id')
{
return 'provider_id';
}
else
{
return $sContextParam;
}
}
}
class CustomerContract extends Contract
{