cmdbAbstractObject
bizmodel,searchable
false
expirationrule
name
false
description
true
html
class
false
active
inactive
status
active
false
list
simple
advanced
type
simple
false
date_to_check_att
true
term_of_notice
true
oql_scope
true
false
public
Overload-DBObject
false
public
Overload-DBObject
false
public
Overload-DBObject
IsNull($this->Get('oql_scope'))) ? 'simple' : 'advanced';
$this->Set('type', $sType);
return parent::ComputeValues();
}]]>
false
public
Get('class');
$sDateToCheckAttCode = $this->Get('date_to_check_att');
$sOqlScope = $this->Get('oql_scope');
// - Class
if(!MetaModel::IsValidClass($sClass))
{
$this->m_aCheckIssues[] = Dict::Format('Class:ExpirationRule/Error:ClassNotValid', $sClass);
}
// - Date to check attribute
if(!empty($sDateToCheckAttCode))
{
if(!MetaModel::IsValidAttCode($sClass, $sDateToCheckAttCode))
{
$this->m_aCheckIssues[] = Dict::Format('Class:ExpirationRule/Error:AttributeNotValid', $sClass, $sDateToCheckAttCode);
}
else
{
$oAttDef = MetaModel::GetAttributeDef($sClass, $sDateToCheckAttCode);
if(($oAttDef instanceof AttributeDateTime) === false)
{
$this->m_aCheckIssues[] = Dict::Format('Class:ExpirationRule/Error:AttributeMustBeDate', $sClass, $sDateToCheckAttCode);
}
}
}
// Checking option consistency
// - At least one option must be filled (either simple or advanced)
$bNoOptionFilled = true;
$aOptionAttCodes = array('date_to_check_att', 'term_of_notice', 'oql_scope');
foreach($aOptionAttCodes as $sOptionAttCode)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sOptionAttCode);
$value = $this->Get($sOptionAttCode);
if(!$oAttDef->IsNull($value))
{
$bNoOptionFilled = false;
break;
}
}
if($bNoOptionFilled)
{
$this->m_aCheckIssues[] = Dict::Format('Class:ExpirationRule/Error:NoOptionFilled');
}
// - Checking that option 1 is valid if selected
elseif(empty($sOqlScope))
{
$bOptionOneValid = true;
// Removing OQL attribute as we only test option 1 attributes
array_pop($aOptionAttCodes);
foreach($aOptionAttCodes as $sOptionAttCode)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sOptionAttCode);
$value = $this->Get($sOptionAttCode);
if($oAttDef->IsNull($value))
{
$bOptionOneValid = false;
break;
}
}
if(!$bOptionOneValid)
{
$this->m_aCheckIssues[] = Dict::Format('Class:ExpirationRule/Error:OptionOneMissingField');
}
}
// - Checking that option 2 OQL is about the right class
elseif(!empty($sOqlScope))
{
try
{
$oSearch = DBObjectSearch::FromOQL($sOqlScope);
$sOqlClass = $oSearch->GetClass();
if($sOqlClass !== $sClass)
{
$this->m_aCheckIssues[] = Dict::Format('Class:StateRule/Error:OQLClassDontMatch', $sClass, $sOqlClass);
}
}
catch(Exception $e)
{
$this->m_aCheckIssues[] = Dict::Format('Class:StateRule/Error:OQLNotValid', $e->getMessage());
}
}
}]]>
false
public
Overload-DBObject
Get('type') === 'advanced')
{
$oSearch = DBObjectSearch::FromOQL($this->Get('oql_scope'));
}
else
{
$sClass = $this->Get('class');
$sDateAttCode = $this->Get('date_to_check_att');
$oSearch = DBObjectSearch::FromOQL('SELECT '.$sClass.' WHERE '.$sDateAttCode.' = DATE_ADD(CURRENT_DATE(), INTERVAL :term_of_notice DAY)');
$oSearch->SetInternalParams(
array(
'term_of_notice' => $this->Get('term_of_notice'),
)
);
}
return $oSearch;
}]]>
false
public
Overload-DBObject
SetCurrentTab(Dict::S('UI:ExpiredObject:Preview'));
$this->OnShowPreview($oPage);
}
}]]>
false
protected
Overload-DBObject
Get('class');
$oPage->p(MetaModel::GetClassIcon($sClass)." ".Dict::Format('UI:ExpiredObject:Title', MetaModel::GetName($sClass)));
$aParams = array(
'menu' => true,
'table_id' => 'ExpiredObject_preview_rule_'.$this->GetKey(),
);
$oBlock = new DisplayBlock($this->GetFilter(), 'list', true, $aParams);
$oBlock->Display($oPage, 'rel_preview_rule_'.$this->GetKey(), $aParams);
}]]>
-
10
-
20
-
30
-
40
-
50
-
10
-
20
-
30
-
40
-
70
-
80
-
90
-
100
-
10
-
10
-
10
-
20
-
30
-
40
-
50
-
20
-
10
-
10
-
20
-
30
-
10
-
10