Modules replaced by the brand new datamodel source (xml) - known issue : the flags are not correct (or not correctly interpreted in the compilation)

SVN:trunk[1764]
This commit is contained in:
Romain Quetiez
2012-01-12 17:15:27 +00:00
parent 780fb6dc27
commit cb5f09cbf2
43 changed files with 1311 additions and 4778 deletions

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<classes><class name="Attachment" category="addon,bizmodel" parent="DBObject" abstract="false" key_type="autoincrement" db_table="attachment" db_key_field="id" db_final_class_field=""><properties><comment><![CDATA[/**
* Module attachments
*
* A quick and easy way to upload and attach files to *any* (see Configuration below) object in the CMBD in one click
*
* Configuration: the list of classes for which the "Attachments" tab is visible is defined via the module's 'allowed_classes'
* configuration parameter. By default the tab is active for all kind of Tickets.
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/]]></comment><naming format="%1$s %2$s"><attributes><attribute name="item_class"/><attribute name="temp_id"/></attributes></naming><display_template></display_template><icon></icon><reconciliation><attributes/></reconciliation></properties><fields><field name="expire" type="DateTime" sql="expire" default_value="" is_null_allowed="false"/><field name="temp_id" type="String" sql="temp_id" default_value="" is_null_allowed="true"/><field name="item_class" type="String" sql="item_class" default_value="" is_null_allowed="false"/><field name="item_id" type="String" sql="item_id" default_value="" is_null_allowed="true"/><field name="item_org_id" type="Integer" sql="item_org_id" default_value="0" is_null_allowed="true"/><field name="contents" type="Blob"/></fields><methods><method name="MapContextParam" static="true" access="public" type="Overload-ExNihilo"><comment><![CDATA[/**
* 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'
*/]]></comment><![CDATA[ public static function MapContextParam($sContextParam)
{
if ($sContextParam == 'org_id')
{
return 'item_org_id';
}
else
{
return null;
}
}]]></method><method name="SetItem" static="false" access="public" type="Overload-ExNihilo"><comment><![CDATA[/**
* Set/Update all of the '_item' fields
* @param object $oItem Container item
* @return void
*/]]></comment><![CDATA[ public function SetItem($oItem, $bUpdateOnChange = false)
{
$sClass = get_class($oItem);
$iItemId = $oItem->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();
}
}
}
}
}
}]]></method><method name="SetDefaultOrgId" static="false" access="public" type="Overload-ExNihilo"><comment><![CDATA[/**
* Give a default value for item_org_id (if relevant...)
* @return void
*/]]></comment><![CDATA[ public function SetDefaultOrgId()
{
// First check that the organization CAN be fetched from the target class
//
$sClass = $this->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));
}
}
}
}
}
}
}]]></method></methods><presentation><details><items><item>temp_id</item><item>item_class</item><item>item_id</item><item>item_org_id</item></items></details><search><items><item>temp_id</item><item>item_class</item><item>item_id</item></items></search><list><items><item>temp_id</item><item>item_class</item><item>item_id</item></items></list></presentation></class></classes>

View File

@@ -14,147 +14,6 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Module attachments
*
* A quick and easy way to upload and attach files to *any* (see Configuration below) object in the CMBD in one click
*
* Configuration: the list of classes for which the "Attachments" tab is visible is defined via the module's 'allowed_classes'
* configuration parameter. By default the tab is active for all kind of Tickets.
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
class Attachment extends DBObject
{
public static function Init()
{
$aParams = array
(
"category" => "addon,bizmodel",
"key_type" => "autoincrement",
"name_attcode" => array('item_class', 'temp_id'),
"state_attcode" => "",
"reconc_keys" => array(),
"db_table" => "attachment",
"db_key_field" => "id",
"db_finalclass_field" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeDateTime("expire", array("allowed_values"=>null, "sql"=>"expire", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("temp_id", array("allowed_values"=>null, "sql"=>"temp_id", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("item_class", array("allowed_values"=>null, "sql"=>"item_class", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("item_id", array("allowed_values"=>null, "sql"=>"item_id", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeInteger("item_org_id", array("allowed_values"=>null, "sql"=>"item_org_id", "default_value"=>0, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeBlob("contents", array("depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('temp_id', 'item_class', 'item_id', 'item_org_id'));
MetaModel::Init_SetZListItems('advanced_search', array('temp_id', 'item_class', 'item_id'));
MetaModel::Init_SetZListItems('standard_search', array('temp_id', 'item_class', 'item_id'));
MetaModel::Init_SetZListItems('list', array('temp_id', 'item_class', 'item_id'));
}
/**
* 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 'item_org_id';
}
else
{
return null;
}
}
/**
* Set/Update all of the '_item' fields
* @param object $oItem Container item
* @return void
*/
public function SetItem($oItem, $bUpdateOnChange = false)
{
$sClass = get_class($oItem);
$iItemId = $oItem->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
*/
public function SetDefaultOrgId()
{
// First check that the organization CAN be fetched from the target class
//
$sClass = $this->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));
}
}
}
}
}
}
}
// Todo - implement a cleanup function (see a way to do that generic !)
}
class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExtension
{
public function OnDisplayProperties($oObject, WebPage $oPage, $bEditMode = false)

View File

@@ -35,7 +35,8 @@ SetupWebPage::AddModule(
// Components
//
'datamodel' => array(
'model.attachments.php'
'model.itop-attachments.php',
'main.attachments.php',
),
'webservice' => array(

View File

@@ -1,52 +0,0 @@
<?php
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'itop-basic/1.0.0',
array(
// Identification
//
'label' => 'iTop Basic Model',
'category' => 'business',
// Setup
//
'dependencies' => array(
),
'mandatory' => false,
'visible' => true,
// Components
//
'datamodel' => array(
'model.itop-basic.php',
),
'dictionary' => array(
'en.dict.itop-basic.php',
'es_cr.dict.itop-basic.php',
'fr.dict.itop-basic.php',
'pt_br.dict.itop-basic.php',
'tr.dict.itop-basic.php',
'zh.dict.itop-basic.php',
),
'data.struct' => array(
//'data.struct.itop-basic.xml',
),
'data.sample' => array(
//'data.sample.itop-basic.xml',
),
// Documentation
//
'doc.manual_setup' => '/doc/xxx/yyy.htm',
'doc.more_information' => '/doc/xxx/yyy.htm',
// Default settings
//
'settings' => array(
),
)
);
?>

View File

@@ -1,51 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Localized data
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
// Dictionnay conventions
// Class:<class_name>
// Class:<class_name>+
// Class:<class_name>/Attribute:<attribute_code>
// Class:<class_name>/Attribute:<attribute_code>+
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>+
// Class:<class_name>/Stimulus:<stimulus_code>
// Class:<class_name>/Stimulus:<stimulus_code>+
//////////////////////////////////////////////////////////////////////
// Classes in 'bizmodel'
//////////////////////////////////////////////////////////////////////
//
// Dictionnay conventions
// Class:<class_name>
// Class:<class_name>+
// Class:<class_name>/Attribute:<attribute_code>
// Class:<class_name>/Attribute:<attribute_code>+
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>+
// Class:<class_name>/Stimulus:<stimulus_code>
// Class:<class_name>/Stimulus:<stimulus_code>+
?>

View File

@@ -1,51 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Localized data
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
// Dictionnay conventions
// Class:<class_name>
// Class:<class_name>+
// Class:<class_name>/Attribute:<attribute_code>
// Class:<class_name>/Attribute:<attribute_code>+
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>+
// Class:<class_name>/Stimulus:<stimulus_code>
// Class:<class_name>/Stimulus:<stimulus_code>+
//////////////////////////////////////////////////////////////////////
// Classes in 'bizmodel'
//////////////////////////////////////////////////////////////////////
//
// Dictionnay conventions
// Class:<class_name>
// Class:<class_name>+
// Class:<class_name>/Attribute:<attribute_code>
// Class:<class_name>/Attribute:<attribute_code>+
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>+
// Class:<class_name>/Stimulus:<stimulus_code>
// Class:<class_name>/Stimulus:<stimulus_code>+
?>

View File

@@ -1,51 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Localized data
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
// Dictionnay conventions
// Class:<class_name>
// Class:<class_name>+
// Class:<class_name>/Attribute:<attribute_code>
// Class:<class_name>/Attribute:<attribute_code>+
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>+
// Class:<class_name>/Stimulus:<stimulus_code>
// Class:<class_name>/Stimulus:<stimulus_code>+
//////////////////////////////////////////////////////////////////////
// Classes in 'bizmodel'
//////////////////////////////////////////////////////////////////////
//
// Dictionnay conventions
// Class:<class_name>
// Class:<class_name>+
// Class:<class_name>/Attribute:<attribute_code>
// Class:<class_name>/Attribute:<attribute_code>+
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>+
// Class:<class_name>/Stimulus:<stimulus_code>
// Class:<class_name>/Stimulus:<stimulus_code>+
?>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,30 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$oMyMenuGroup = new MenuGroup('ChangeManagement', 50 /* fRank */);
new TemplateMenuNode('Change:Overview', dirname(__FILE__).'/overview.html', $oMyMenuGroup->GetIndex() /* oParent */, 0 /* fRank */);
new NewObjectMenuNode('NewChange', 'Change', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
new SearchMenuNode('SearchChanges', 'Change', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
$oShortcutNode = new TemplateMenuNode('Change:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
$oNode = new OQLMenuNode('MyChanges', 'SELECT Change WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('Changes', 'SELECT Change WHERE status != "closed"', $oShortcutNode->GetIndex(), 2 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('WaitingApproval', 'SELECT ApprovedChange WHERE status IN ("plannedscheduled")', $oShortcutNode->GetIndex(), 3 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('WaitingAcceptance', 'SELECT NormalChange WHERE status IN ("new")', $oShortcutNode->GetIndex(), 4 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
?>

View File

@@ -1,589 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Persistent classes for a CMDB
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
abstract class Change extends Ticket
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,changemgmt",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "status",
"reconc_keys" => array("ref"),
"db_table" => "change",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
"icon" => "../modules/itop-change-mgmt-1.0.0/images/change.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('approved,assigned,closed,implemented,monitored,new,notapproved,plannedscheduled,rejected,validated'), "sql"=>"status", "default_value"=>"new", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"reason", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("requestor_id", array("targetclass"=>"Person", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Person AS p WHERE p.org_id = :this->org_id'), "sql"=>"requestor_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("requestor_email", array("allowed_values"=>null, "extkey_attcode"=>"requestor_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"Organization", "jointype"=>null, "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("allowed_values"=>null, "extkey_attcode"=>"org_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("workgroup_id", array("targetclass"=>"Team", "jointype"=>null, "allowed_values"=>null, "sql"=>"workgroup_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("workgroup_name", array("allowed_values"=>null, "extkey_attcode"=>"workgroup_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("creation_date", array("allowed_values"=>null, "sql"=>"creation_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("last_update", array("allowed_values"=>null, "sql"=>"last_update", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("end_date", array("allowed_values"=>null, "sql"=>"end_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("close_date", array("allowed_values"=>null, "sql"=>"close_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("impact", array("allowed_values"=>null, "sql"=>"impact", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("agent_id", array("targetclass"=>"Person", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Person AS p JOIN lnkTeamToContact AS l ON l.contact_id=p.id JOIN Team AS t ON l.team_id=t.id WHERE t.id = :this->workgroup_id'), "sql"=>"agent_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("workgroup_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("agent_name", array("allowed_values"=>null, "extkey_attcode"=>"agent_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("agent_email", array("allowed_values"=>null, "extkey_attcode"=>"agent_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("supervisor_group_id", array("targetclass"=>"Team", "jointype"=>null, "allowed_values"=>null, "sql"=>"supervisor_group_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("supervisor_group_name", array("allowed_values"=>null, "extkey_attcode"=>"supervisor_group_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("supervisor_id", array("targetclass"=>"Person", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Person AS p JOIN lnkTeamToContact AS l ON l.contact_id=p.id JOIN Team AS t ON l.team_id=t.id WHERE t.id = :this->supervisor_group_id'), "sql"=>"supervisor_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("supervisor_group_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("supervisor_email", array("allowed_values"=>null, "extkey_attcode"=>"supervisor_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("manager_group_id", array("targetclass"=>"Team", "jointype"=>null, "allowed_values"=>null, "sql"=>"manager_group_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("manager_group_name", array("allowed_values"=>null, "extkey_attcode"=>"manager_group_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("manager_id", array("targetclass"=>"Person", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Person AS p JOIN lnkTeamToContact AS l ON l.contact_id=p.id JOIN Team AS t ON l.team_id=t.id WHERE t.id = :this->manager_group_id'), "sql"=>"manager_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("manager_group_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("manager_email", array("allowed_values"=>null, "extkey_attcode"=>"manager_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("outage", array("allowed_values"=>new ValueSetEnum('yes,no'), "sql"=>"outage", "default_value"=>"no", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("fallback", array("allowed_values"=>null, "sql"=>"fallback", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('title', 'org_id', 'description','ticket_log', 'start_date','end_date', 'document_list', 'ci_list', 'contact_list','incident_list', 'status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage', 'fallback'));
MetaModel::Init_SetZListItems('advanced_search', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'end_date','status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage'));
MetaModel::Init_SetZListItems('standard_search', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'end_date','status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage'));
MetaModel::Init_SetZListItems('list', array('finalclass', 'title', 'start_date', 'status'));
MetaModel::Init_DefineState(
"new",
array(
"attribute_inherit" => null,
"attribute_list" => array(
'start_date' => OPT_ATT_HIDDEN,
'end_date' => OPT_ATT_HIDDEN,
'close_date' => OPT_ATT_HIDDEN,
'ticket_log' => OPT_ATT_HIDDEN,
'impact' => OPT_ATT_HIDDEN,
'outage' => OPT_ATT_HIDDEN,
'fallback' => OPT_ATT_HIDDEN,
'ref' => OPT_ATT_READONLY,
'requestor_id' => OPT_ATT_MANDATORY,
'title' => OPT_ATT_MANDATORY,
'reason' => OPT_ATT_MANDATORY,
'workgroup_id' => OPT_ATT_HIDDEN,
'creation_date' => OPT_ATT_READONLY,
'last_update' => OPT_ATT_READONLY,
'agent_id' => OPT_ATT_HIDDEN,
'agent_email' => OPT_ATT_HIDDEN,
'supervisor_group_id' => OPT_ATT_HIDDEN,
'supervisor_id' => OPT_ATT_HIDDEN,
'manager_group_id' => OPT_ATT_HIDDEN,
'manager_id' => OPT_ATT_HIDDEN,
),
)
);
MetaModel::Init_DefineState(
"validated",
array(
"attribute_inherit" => 'new',
"attribute_list" => array(
'title' => OPT_ATT_READONLY,
'reason' => OPT_ATT_READONLY,
'workgroup_id' => OPT_ATT_MANDATORY,
'supervisor_group_id' => OPT_ATT_MANDATORY,
'manager_group_id' => OPT_ATT_MANDATORY,
'description' => OPT_ATT_READONLY,
'requestor_id' => OPT_ATT_READONLY,
'title' => OPT_ATT_MANDATORY,
),
)
);
MetaModel::Init_DefineState(
"rejected",
array(
"attribute_inherit" => 'new',
"attribute_list" => array(
),
)
);
MetaModel::Init_DefineState(
"assigned",
array(
"attribute_inherit" => 'validated',
"attribute_list" => array(
'workgroup_id' => OPT_ATT_MANDATORY,
'agent_id' => OPT_ATT_MUSTCHANGE,
'supervisor_id' => OPT_ATT_MUSTCHANGE,
'manager_id' => OPT_ATT_MUSTCHANGE,
'description' => OPT_ATT_READONLY,
'requestor_id' => OPT_ATT_READONLY,
),
)
);
MetaModel::Init_DefineState(
"plannedscheduled",
array(
"attribute_inherit" => 'assigned',
"attribute_list" => array(
'ticket_log' => OPT_ATT_NORMAL,
'requestor_id' => OPT_ATT_READONLY,
'org_id' => OPT_ATT_READONLY,
'workgroup_id' => OPT_ATT_READONLY,
'start_date' => OPT_ATT_MANDATORY,
'end_date' => OPT_ATT_MANDATORY,
'impact' => OPT_ATT_MANDATORY,
'agent_id' => OPT_ATT_MANDATORY,
'supervisor_group_id' => OPT_ATT_MANDATORY,
'supervisor_id' => OPT_ATT_MANDATORY,
'manager_group_id' => OPT_ATT_MANDATORY,
'manager_id' => OPT_ATT_MANDATORY,
'fallback' => OPT_ATT_MANDATORY,
'outage' => OPT_ATT_MUSTPROMPT,
),
)
);
MetaModel::Init_DefineState(
"approved",
array(
"attribute_inherit" => 'plannedscheduled',
"attribute_list" => array(
'start_date' => OPT_ATT_READONLY,
'end_date' => OPT_ATT_MANDATORY,
'impact' => OPT_ATT_READONLY,
'supervisor_group_id' => OPT_ATT_READONLY,
'supervisor_id' => OPT_ATT_READONLY,
'manager_group_id' => OPT_ATT_READONLY,
'manager_id' => OPT_ATT_READONLY,
'outage' => OPT_ATT_READONLY,
),
)
);
MetaModel::Init_DefineState(
"notapproved",
array(
"attribute_inherit" => 'plannedscheduled',
"attribute_list" => array(
'impact' => OPT_ATT_READONLY,
'supervisor_group_id' => OPT_ATT_READONLY,
'supervisor_id' => OPT_ATT_READONLY,
'manager_group_id' => OPT_ATT_READONLY,
'manager_id' => OPT_ATT_READONLY,
),
)
);
MetaModel::Init_DefineState(
"implemented",
array(
"attribute_inherit" => 'approved',
"attribute_list" => array(
),
)
);
MetaModel::Init_DefineState(
"monitored",
array(
"attribute_inherit" => 'implemented',
"attribute_list" => array(
'end_date' => OPT_ATT_READONLY,
'agent_id' => OPT_ATT_READONLY,
'fallback' => OPT_ATT_READONLY,
),
)
);
MetaModel::Init_DefineState(
"closed",
array(
"attribute_inherit" => 'monitored',
"attribute_list" => array(
'ticket_log' => OPT_ATT_READONLY,
'close_date' => OPT_ATT_READONLY,
),
)
);
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_validate", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_reject", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_assign", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_reopen", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_plan", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_approve", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_replan", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_notapprove", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_implement", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_monitor", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_finish", array()));
}
public function SetClosureDate($sStimulusCode)
{
$this->Set('close_date', time());
return true;
}
protected function OnInsert()
{
$oToNotify = $this->Get('contact_list');
$oToImpact = $this->Get('ci_list');
$oImpactedInfras = DBObjectSet::FromLinkSet($this, 'ci_list', 'ci_id');
$aComputed = $oImpactedInfras->GetRelatedObjects('impacts', 10);
if (isset($aComputed['FunctionalCI']) && is_array($aComputed['FunctionalCI']))
{
foreach($aComputed['FunctionalCI'] as $iKey => $oObject)
{
$oNewLink = new lnkTicketToCI();
$oNewLink->Set('ci_id', $iKey);
$oToImpact->AddObject($oNewLink);
}
}
if (isset($aComputed['Contact']) && is_array($aComputed['Contact']))
{
foreach($aComputed['Contact'] as $iKey => $oObject)
{
$oNewLink = new lnkTicketToContact();
$oNewLink->Set('contact_id', $iKey);
$oNewLink->Set('role', 'contact automatically computed');
$oToNotify->AddObject($oNewLink);
}
}
$this->Set('creation_date', time());
$this->Set('last_update', time());
}
protected function OnUpdate()
{
$this->Set('last_update', time());
}
public function ComputeValues()
{
$sCurrRef = $this->Get('ref');
if (strlen($sCurrRef) == 0)
{
$iKey = $this->GetKey();
if ($iKey < 0)
{
// Object not yet in the Database
$iKey = MetaModel::GetNextKey(get_class($this));
}
$sName = sprintf('C-%06d', $iKey);
$this->Set('ref', $sName);
}
}
/**
* Get the icon representing this object
* @param boolean $bImgTag If true the result is a full IMG tag (or an emtpy string if no icon is defined)
* @return string Either the full IMG tag ($bImgTag == true) or just the path to the icon file
*/
public function GetIcon($bImgTag = true)
{
$sStatus = $this->Get('status');
switch($this->GetState())
{
case 'approved':
case 'implemented':
case 'monitored':
$sIcon = self::MakeIconFromName('change-approved.png');
break;
case 'rejected':
case 'notapproved':
$sIcon = self::MakeIconFromName('change-rejected.png');
break;
case 'closed':
$sIcon = self::MakeIconFromName('change-closed.png');
break;
default:
$sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag);
}
return $sIcon;
}
protected static function MakeIconFromName($sIconName, $bImgTag = true)
{
$sIcon = '';
if ($sIconName != '')
{
$sPath = '../modules/itop-change-mgmt-1.0.0/images/'.$sIconName;
if ($bImgTag)
{
$sIcon = "<img src=\"$sPath\" style=\"vertical-align:middle;\"/>";
}
else
{
$sIcon = $sPath;
}
}
return $sIcon;
}
}
class RoutineChange extends Change
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,changemgmt",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "",
"reconc_keys" => array("ref"),
"db_table" => "change_routine",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_InheritLifecycle();
MetaModel::Init_SetZListItems('details', array('document_list', 'ci_list', 'contact_list','incident_list',
'col:col1' => array(
'fieldset:Ticket:baseinfo' => array('ref','title','org_id','status','reason','impact','description', ),
'fieldset:Ticket:moreinfo' => array('outage', 'fallback',),
),
'col:col2' => array(
'fieldset:Ticket:date' => array('creation_date','start_date','last_update','close_date',),
'fieldset:Ticket:contact' => array('requestor_id','workgroup_id','agent_id','supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id',),
)
));
//MetaModel::Init_SetZListItems('details', array('title', 'org_id', 'description','ticket_log', 'start_date', 'end_date','document_list', 'ci_list', 'contact_list','incident_list', 'status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage', 'fallback'));
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'end_date','status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage'));
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date','end_date', 'status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage'));
MetaModel::Init_SetZListItems('list', array('title', 'org_id', 'start_date', 'status', 'requestor_id'));
MetaModel::Init_DefineTransition("new", "ev_assign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("assigned", "ev_plan", array("target_state"=>"plannedscheduled", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("plannedscheduled", "ev_implement", array("target_state"=>"implemented", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("implemented", "ev_monitor", array("target_state"=>"monitored", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("implemented", "ev_finish", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("monitored", "ev_finish", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
}
}
abstract class ApprovedChange extends Change
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,changemgmt",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "",
"reconc_keys" => array("ref"),
"db_table" => "change_approved",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_InheritLifecycle();
MetaModel::Init_AddAttribute(new AttributeDateTime("approval_date", array("allowed_values"=>null, "sql"=>"approval_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("approval_comment", array("allowed_values"=>null, "sql"=>"approval_comment", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('title', 'org_id', 'description','ticket_log', 'start_date', 'end_date','document_list', 'ci_list', 'contact_list','incident_list', 'status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage', 'fallback', 'approval_date', 'approval_comment'));
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date','end_date', 'status', 'reason', 'requestor_id', 'workgroup_id', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage','approval_date'));
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date','end_date', 'status', 'reason', 'requestor_id', 'workgroup_id', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage', 'approval_date'));
MetaModel::Init_SetZListItems('list', array('title', 'org_id', 'start_date', 'status', 'requestor_id'));
MetaModel::Init_OverloadStateAttribute('new', 'approval_date', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('new', 'approval_comment', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('validated', 'approval_date', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('validated', 'approval_comment', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('rejected', 'approval_date', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('rejected', 'approval_comment', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('assigned', 'approval_date', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('assigned', 'approval_comment', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('plannedscheduled', 'approval_date', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('plannedscheduled', 'approval_comment', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('notapproved', 'approval_date', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('notapproved', 'approval_comment', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('approved', 'approval_date', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('approved', 'approval_comment', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('implemented', 'approval_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('implemented', 'approval_comment', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('monitored', 'approval_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('monitored', 'approval_comment', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('closed', 'approval_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('closed', 'approval_comment', OPT_ATT_READONLY);
}
}
class NormalChange extends ApprovedChange
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,changemgmt",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "",
"reconc_keys" => array("ref"),
"db_table" => "change_normal",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_InheritLifecycle();
MetaModel::Init_AddAttribute(new AttributeDateTime("acceptance_date", array("allowed_values"=>null, "sql"=>"acceptance_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("acceptance_comment", array("allowed_values"=>null, "sql"=>"acceptance_comment", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('document_list', 'ci_list', 'contact_list','incident_list',
'col:col1' => array(
'fieldset:Ticket:baseinfo' => array('ref','title','org_id','status','reason','impact','description', ),
'fieldset:Ticket:moreinfo' => array('acceptance_comment','approval_comment','outage', 'fallback',),
),
'col:col2' => array(
'fieldset:Ticket:date' => array('creation_date','start_date','last_update','acceptance_date','approval_date','close_date',),
'fieldset:Ticket:contact' => array('requestor_id','workgroup_id','agent_id','supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id',),
)
));
// MetaModel::Init_SetZListItems('details', array('title', 'org_id', 'description','ticket_log', 'start_date','end_date', 'document_list', 'ci_list', 'contact_list','incident_list', 'status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update','close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage', 'fallback', 'approval_date', 'approval_comment', 'acceptance_date', 'acceptance_comment'));
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'end_date','status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage'));
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date','end_date', 'status', 'reason', 'requestor_id', 'workgroup_id', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage'));
MetaModel::Init_SetZListItems('list', array('title', 'org_id', 'start_date', 'status', 'requestor_id'));
MetaModel::Init_OverloadStateAttribute('new', 'acceptance_date', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('new', 'acceptance_comment', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('validated', 'acceptance_date', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('validated', 'acceptance_comment', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('rejected', 'acceptance_date', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('rejected', 'acceptance_comment', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('plannedscheduled', 'acceptance_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('plannedscheduled', 'acceptance_comment', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('approved', 'acceptance_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('approved', 'acceptance_comment', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('notapproved', 'acceptance_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('notapproved', 'acceptance_comment', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('implemented', 'acceptance_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('implemented', 'acceptance_comment', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('monitored', 'acceptance_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('monitored', 'acceptance_comment', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('closed', 'acceptance_date', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('closed', 'acceptance_comment', OPT_ATT_READONLY);
MetaModel::Init_DefineTransition("new", "ev_validate", array("target_state"=>"validated", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("new", "ev_reject", array("target_state"=>"rejected", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("rejected", "ev_reopen", array("target_state"=>"new", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("validated", "ev_assign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("assigned", "ev_plan", array("target_state"=>"plannedscheduled", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("plannedscheduled", "ev_approve", array("target_state"=>"approved", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("plannedscheduled", "ev_notapprove", array("target_state"=>"notapproved", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("notapproved", "ev_replan", array("target_state"=>"plannedscheduled", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("approved", "ev_implement", array("target_state"=>"implemented", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("implemented", "ev_monitor", array("target_state"=>"monitored", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("implemented", "ev_finish", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("monitored", "ev_finish", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
}
}
class EmergencyChange extends ApprovedChange
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,changemgmt",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "",
"reconc_keys" => array("ref"),
"db_table" => "change_emergency",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_InheritLifecycle();
MetaModel::Init_SetZListItems('details', array('document_list', 'ci_list', 'contact_list','incident_list',
'col:col1' => array(
'fieldset:Ticket:baseinfo' => array('ref','title','org_id','status','reason','impact','description', ),
'fieldset:Ticket:moreinfo' => array('approval_comment','outage', 'fallback',),
),
'col:col2' => array(
'fieldset:Ticket:date' => array('creation_date','start_date','last_update','approval_date','close_date',),
'fieldset:Ticket:contact' => array('requestor_id','workgroup_id','agent_id','supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id',),
)
));
// MetaModel::Init_SetZListItems('details', array('title', 'org_id', 'description','ticket_log', 'start_date', 'end_date','document_list', 'ci_list', 'contact_list','incident_list', 'status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage', 'fallback', 'approval_date', 'approval_comment'));
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date','end_date', 'status', 'reason', 'requestor_id', 'workgroup_id', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage', 'approval_date'));
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date', 'end_date','status', 'reason', 'requestor_id', 'workgroup_id', 'creation_date', 'last_update', 'close_date', 'impact', 'agent_id', 'agent_email', 'supervisor_group_id', 'supervisor_id', 'manager_group_id', 'manager_id', 'outage', 'approval_date'));
MetaModel::Init_SetZListItems('list', array('title', 'org_id', 'start_date', 'status', 'requestor_id'));
MetaModel::Init_DefineTransition("new", "ev_assign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("assigned", "ev_plan", array("target_state"=>"plannedscheduled", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("plannedscheduled", "ev_approve", array("target_state"=>"approved", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("plannedscheduled", "ev_notapprove", array("target_state"=>"notapproved", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("notapproved", "ev_replan", array("target_state"=>"plannedscheduled", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("approved", "ev_implement", array("target_state"=>"implemented", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("implemented", "ev_monitor", array("target_state"=>"monitored", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("implemented", "ev_finish", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("monitored", "ev_finish", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
}
}
$oMyMenuGroup = new MenuGroup('ChangeManagement', 50 /* fRank */);
new TemplateMenuNode('Change:Overview', dirname(__FILE__).'/overview.html', $oMyMenuGroup->GetIndex() /* oParent */, 0 /* fRank */);
new NewObjectMenuNode('NewChange', 'Change', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
new SearchMenuNode('SearchChanges', 'Change', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
$oShortcutNode = new TemplateMenuNode('Change:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
$oNode = new OQLMenuNode('MyChanges', 'SELECT Change WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('Changes', 'SELECT Change WHERE status != "closed"', $oShortcutNode->GetIndex(), 2 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('WaitingApproval', 'SELECT ApprovedChange WHERE status IN ("plannedscheduled")', $oShortcutNode->GetIndex(), 3 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('WaitingAcceptance', 'SELECT NormalChange WHERE status IN ("new")', $oShortcutNode->GetIndex(), 4 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
?>

View File

@@ -24,6 +24,7 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'model.itop-change-mgmt.php',
'main.itop-change-mgmt.php',
),
'data.struct' => array(
//'data.struct.itop-change-mgmt.xml',

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,72 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
MetaModel::RegisterRelation("impacts", array("description"=>"Objects impacted by", "verb_down"=>"impacts", "verb_up"=>"depends on"));
MetaModel::RegisterRelation("depends on", array("description"=>"That impacts ", "verb_down"=>"depends on", "verb_up"=>"impacts"));
// Note (RQ) :
// After 1.0.1, the welcome page and menus have been removed from the application
// and put into a separate module "itop-welcome-itil"
// Until we develop a migration utility, and as would like to preserve the
// capability to upgrade iTop without any manual operation, we have decided to
// implement this dirty workaround that makes it...
//////////////require_once(APPROOT.'modules/itop-welcome-itil/model.itop-welcome-itil.php');
// Starting with iTop 1.2 you can restrict the list of organizations displayed in the drop-down list
// by specifying a query as shown below. Note that this is NOT a security settings, since the
// choice 'All Organizations' will always be available in the menu
ApplicationMenu::SetFavoriteSiloQuery('SELECT Organization');
$oAdminMenu = new MenuGroup('DataAdministration', 70 /* fRank */, 'Organization', UR_ACTION_MODIFY, UR_ALLOWED_YES|UR_ALLOWED_DEPENDS);
$iAdminGroup = $oAdminMenu->GetIndex();
new WebPageMenuNode('Audit', utils::GetAbsoluteUrlAppRoot().'pages/audit.php', $iAdminGroup, 33 /* fRank */);
$oTypologyNode = new TemplateMenuNode('Catalogs', '', $iAdminGroup, 50 /* fRank */);
$iTopology = $oTypologyNode->GetIndex();
new OQLMenuNode('Organization', 'SELECT Organization', $iTopology, 10 /* fRank */, true /* bSearch */);
new OQLMenuNode('Application', 'SELECT Application', $iTopology, 20 /* fRank */);
new OQLMenuNode('DBServer', 'SELECT DBServer', $iTopology, 40 /* fRank */);
$oConfigManagementGroup = new MenuGroup('ConfigManagement', 20 /* fRank */);
// Create an entry, based on a custom template, for the Configuration management overview, under the top-level group
new TemplateMenuNode('ConfigManagementOverview', dirname(__FILE__).'/overview.html', $oConfigManagementGroup->GetIndex(), 0 /* fRank */);
$oContactNode = new TemplateMenuNode('Contact', dirname(__FILE__).'/contacts_menu.html', $oConfigManagementGroup->GetIndex(), 1 /* fRank */);
new NewObjectMenuNode('NewContact', 'Contact', $oContactNode->GetIndex(), 1 /* fRank */);
new SearchMenuNode('SearchContacts', 'Contact', $oContactNode->GetIndex(), 2 /* fRank */);
new OQLMenuNode('Document', 'SELECT Document', $oConfigManagementGroup->GetIndex(), 2 /* fRank */, true /* bSearch */);
new OQLMenuNode('Location', 'SELECT Location', $oConfigManagementGroup->GetIndex(), 3 /* fRank */, true /* bSearch */);
new OQLMenuNode('Group', 'SELECT Group', $oConfigManagementGroup->GetIndex(), 4 /* fRank */, true /* bSearch */);
$oCINode = new TemplateMenuNode('ConfigManagementCI', dirname(__FILE__).'/cis_menu.html', $oConfigManagementGroup->GetIndex(), 5 /* fRank */);
new NewObjectMenuNode('NewCI', 'FunctionalCI', $oCINode->GetIndex(), 0 /* fRank */);
new SearchMenuNode('SearchCIs', 'FunctionalCI', $oCINode->GetIndex(), 1 /* fRank */);
$oShortcutsNode = new TemplateMenuNode('ConfigManagement:Shortcuts', '', $oConfigManagementGroup->GetIndex(), 6 /* fRank */);
new OQLMenuNode('Server', 'SELECT Server', $oShortcutsNode->GetIndex(), 1 /* fRank */);
new OQLMenuNode('NetworkDevice', 'SELECT NetworkDevice', $oShortcutsNode->GetIndex(), 2 /* fRank */);
new OQLMenuNode('Printer', 'SELECT Printer', $oShortcutsNode->GetIndex(), 3 /* fRank */);
new OQLMenuNode('PC', 'SELECT PC', $oShortcutsNode->GetIndex(), 4 /* fRank */);
new OQLMenuNode('BusinessProcess', 'SELECT BusinessProcess', $oShortcutsNode->GetIndex(), 5 /* fRank */);
new OQLMenuNode('ApplicationSolution', 'SELECT ApplicationSolution', $oShortcutsNode->GetIndex(), 6 /* fRank */);
?>

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,7 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'model.itop-config-mgmt.php',
'main.itop-config-mgmt.php',
),
'data.struct' => array(
'data.struct.Audit.xml',

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$oMyMenuGroup = new MenuGroup('IncidentManagement', 40 /* fRank */);
new TemplateMenuNode('Incident:Overview', dirname(__FILE__).'/overview.html', $oMyMenuGroup->GetIndex() /* oParent */, 0 /* fRank */);
new NewObjectMenuNode('NewIncident', 'Incident', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
new SearchMenuNode('SearchIncidents', 'Incident', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
$oShortcutNode = new TemplateMenuNode('Incident:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
$oNode = new OQLMenuNode('Incident:MyIncidents', 'SELECT Incident WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('Incident:EscalatedIncidents', 'SELECT Incident WHERE status IN ("escalated_tto", "escalated_ttr")', $oShortcutNode->GetIndex(), 2 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('Incident:OpenIncidents', 'SELECT Incident WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "resolved")', $oShortcutNode->GetIndex(), 3 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'standard'));
?>

View File

@@ -1,251 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Persistent classes for a CMDB
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
class Incident extends ResponseTicket
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,incidentmgmt",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "status",
"reconc_keys" => array("ref"),
"db_table" => "ticket_incident",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
"icon" => "../modules/itop-incident-mgmt-1.0.0/images/incident.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_InheritLifecycle();
MetaModel::Init_SetZListItems('details', array('document_list', 'ci_list', 'contact_list','incident_list',
'col:col1' => array(
'fieldset:Ticket:baseinfo' => array('ref','title','org_id','status','priority','service_id','servicesubcategory_id','product' ),
'fieldset:Ticket:moreinfo' => array('impact','urgency','description','resolution_code', 'solution', 'user_satisfaction', 'user_commment',),
),
'col:col2' => array(
'fieldset:Ticket:date' => array('start_date','last_update','assignment_date','tto_escalation_deadline', 'ttr_escalation_deadline', 'close_date','closure_deadline',),
'fieldset:Ticket:contact' => array('caller_id','workgroup_id','agent_id',),
'fieldset:Ticket:relation' => array('related_problem_id', 'related_change_id',),
)
));
// MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'description', 'start_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'document_list', 'ci_list', 'contact_list','incident_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment','ticket_log',));
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'close_date', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
MetaModel::Init_SetZListItems('list', array('title', 'org_id', 'start_date', 'status', 'service_id', 'priority', 'workgroup_id', 'agent_id'));
}
public function ComputeValues()
{
$sCurrRef = $this->Get('ref');
if (strlen($sCurrRef) == 0)
{
$iKey = $this->GetKey();
if ($iKey < 0)
{
// Object not yet in the Database
$iKey = MetaModel::GetNextKey(get_class($this));
}
$sName = sprintf('I-%06d', $iKey);
$this->Set('ref', $sName);
}
return parent::ComputeValues();
}
protected function OnInsert()
{
$oToNotify = $this->Get('contact_list');
$oToImpact = $this->Get('ci_list');
$oImpactedInfras = DBObjectSet::FromLinkSet($this, 'ci_list', 'ci_id');
$aComputed = $oImpactedInfras->GetRelatedObjects('impacts', 10);
if (isset($aComputed['FunctionalCI']) && is_array($aComputed['FunctionalCI']))
{
foreach($aComputed['FunctionalCI'] as $iKey => $oObject)
{
$oNewLink = new lnkTicketToCI();
$oNewLink->Set('ci_id', $iKey);
$oNewLink->Set('impact', 'potentially impacted (automatically computed)');
$oToImpact->AddObject($oNewLink);
}
}
if (isset($aComputed['Contact']) && is_array($aComputed['Contact']))
{
foreach($aComputed['Contact'] as $iKey => $oObject)
{
$oNewLink = new lnkTicketToContact();
$oNewLink->Set('contact_id', $iKey);
$oNewLink->Set('role', 'contact automatically computed');
$oToNotify->AddObject($oNewLink);
}
}
parent::OnInsert();
}
/**
* Get the icon representing this object
* @param boolean $bImgTag If true the result is a full IMG tag (or an emtpy string if no icon is defined)
* @return string Either the full IMG tag ($bImgTag == true) or just the path to the icon file
*/
public function GetIcon($bImgTag = true)
{
$sStatus = $this->Get('status');
switch($this->GetState())
{
case 'escalated_tto':
case 'escalated_ttr':
$sIcon = self::MakeIconFromName('incident-escalated.png');
break;
case 'resolved':
case 'closed':
$sIcon = self::MakeIconFromName('incident-closed.png');
break;
case 'new':
$sIcon = self::MakeIconFromName('incident.png');
$oEscalationDeadline = $this->Get('tto_escalation_deadline');
if ($oEscalationDeadline != null)
{
// A SLA is running
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
$iEscalationDeadline = AttributeDateTime::GetAsUnixSeconds($oEscalationDeadline);
$ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate);
if ($ratio <= 0)
{
$sIcon = self::MakeIconFromName('incident-escalated.png');
}
else if ($ratio <= 0.25)
{
$sIcon = self::MakeIconFromName('incident-deadline.png');
}
}
break;
case 'assigned':
$sIcon = self::MakeIconFromName('incident.png');
$oEscalationDeadline = $this->Get('ttr_escalation_deadline');
if ($oEscalationDeadline != null)
{
// A SLA is running
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
$iEscalationDeadline = AttributeDateTime::GetAsUnixSeconds($oEscalationDeadline);
$ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate);
if ($ratio <= 0)
{
$sIcon = self::MakeIconFromName('incident-escalated.png');
}
else if ($ratio <= 0.25)
{
$sIcon = self::MakeIconFromName('incident-deadline.png');
}
}
break;
default:
$sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag);
}
return $sIcon;
}
protected static function MakeIconFromName($sIconName, $bImgTag = true)
{
$sIcon = '';
if ($sIconName != '')
{
$sPath = '../modules/itop-incident-mgmt-1.0.0/images/'.$sIconName;
if ($bImgTag)
{
$sIcon = "<img src=\"$sPath\" style=\"vertical-align:middle;\"/>";
}
else
{
$sIcon = $sPath;
}
}
return $sIcon;
}
}
class lnkTicketToIncident extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,incidentmgmt,requestmgmt,lnkincident",
"key_type" => "autoincrement",
"name_attcode" => "ticket_id",
"state_attcode" => "",
"reconc_keys" => array("ticket_id","incident_id"),
"db_table" => "lnktickettoincident",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("ticket_id", array("targetclass"=>"Ticket", "jointype"=>null, "allowed_values"=>null, "sql"=>"ticket_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ticket_ref", array("allowed_values"=>null, "extkey_attcode"=>"ticket_id", "target_attcode"=>"ref", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("incident_id", array("targetclass"=>"Incident", "jointype"=>null, "allowed_values"=>null, "sql"=>"incident_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("incident_ref", array("allowed_values"=>null, "extkey_attcode"=>"incident_id", "target_attcode"=>"ref", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"reason", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('ticket_id', 'incident_id','reason'));
MetaModel::Init_SetZListItems('advanced_search', array('ticket_id', 'incident_id'));
MetaModel::Init_SetZListItems('standard_search', array('ticket_id', 'incident_id'));
MetaModel::Init_SetZListItems('list', array('ticket_id', 'incident_id','reason'));
}
}
$oMyMenuGroup = new MenuGroup('IncidentManagement', 40 /* fRank */);
new TemplateMenuNode('Incident:Overview', dirname(__FILE__).'/overview.html', $oMyMenuGroup->GetIndex() /* oParent */, 0 /* fRank */);
new NewObjectMenuNode('NewIncident', 'Incident', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
new SearchMenuNode('SearchIncidents', 'Incident', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
$oShortcutNode = new TemplateMenuNode('Incident:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
$oNode = new OQLMenuNode('Incident:MyIncidents', 'SELECT Incident WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('Incident:EscalatedIncidents', 'SELECT Incident WHERE status IN ("escalated_tto", "escalated_ttr")', $oShortcutNode->GetIndex(), 2 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('Incident:OpenIncidents', 'SELECT Incident WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "resolved")', $oShortcutNode->GetIndex(), 3 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'standard'));
?>

View File

@@ -24,6 +24,7 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'model.itop-incident-mgmt.php',
'main.itop-incident-mgmt.php',
),
'data.struct' => array(
'data.struct.ta-triggers.xml',

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classes><class name="KnownError" category="bizmodel,searchable,knownerrormgmt" parent="cmdbAbstractObject" abstract="false" key_type="autoincrement" db_table="known_error" db_key_field="id" db_final_class_field=""><properties><comment><![CDATA[/**
* Description of known error
*/]]></comment><naming format="%1$s"><attributes><attribute name="name"/></attributes></naming><display_template></display_template><icon>../modules/itop-knownerror-mgmt-1.0.0/images/known-error.png</icon><reconciliation><attributes><attribute name="org_id"/><attribute name="name"/></attributes></reconciliation></properties><fields><field name="name" type="String" sql="name" default_value="" is_null_allowed="false"/><field name="org_id" type="ExternalKey" target_class="Organization" sql="cust_id" is_null_allowed="false" on_target_delete="DEL_MANUAL"/><field name="cust_name" type="ExternalField" extkey_attcode="org_id" target_attcode="name"/><field name="problem_id" type="ExternalKey" target_class="Problem" sql="problem_id" is_null_allowed="true" on_target_delete="DEL_MANUAL"/><field name="problem_ref" type="ExternalField" extkey_attcode="problem_id" target_attcode="ref"/><field name="symptom" type="Text" sql="symptom" default_value="" is_null_allowed="false"/><field name="root_cause" type="Text" sql="rootcause" default_value="" is_null_allowed="true"/><field name="workaround" type="Text" sql="workaround" default_value="" is_null_allowed="true"/><field name="solution" type="Text" sql="solution" default_value="" is_null_allowed="true"/><field name="error_code" type="String" sql="error_code" default_value="" is_null_allowed="true"/><field name="domain" type="Enum" sql="domain" default_value="Application" is_null_allowed="false"><values><value>Network</value><value>Server</value><value>Application</value><value>Desktop</value></values></field><field name="vendor" type="String" sql="vendor" default_value="" is_null_allowed="true"/><field name="model" type="String" sql="model" default_value="" is_null_allowed="true"/><field name="version" type="String" sql="version" default_value="" is_null_allowed="true"/><field name="ci_list" type="LinkedSetIndirect" linked_class="lnkInfraError" ext_key_to_me="error_id" ext_key_to_remote="infra_id" count_min="0" count_max="0"/><field name="document_list" type="LinkedSetIndirect" linked_class="lnkDocumentError" ext_key_to_me="error_id" ext_key_to_remote="doc_id" count_min="0" count_max="0"/></fields><methods/><presentation><details><items><item>name</item><item>org_id</item><item>problem_id</item><item>error_code</item><item>domain</item><item>vendor</item><item>model</item><item>version</item><item>symptom</item><item>root_cause</item><item>workaround</item><item>solution</item><item>ci_list</item><item>document_list</item></items></details><search><items><item>name</item><item>org_id</item><item>problem_id</item><item>error_code</item><item>domain</item><item>symptom</item></items></search><list><items><item>org_id</item><item>problem_id</item><item>error_code</item><item>symptom</item></items></list></presentation></class><class name="lnkInfraError" category="bizmodel,searchable,knownerrormgmt,lnkknownerror" parent="cmdbAbstractObject" abstract="false" key_type="autoincrement" db_table="infra_error_links" db_key_field="link_id" db_final_class_field=""><properties><comment><![CDATA[/**
* n-n link between any Infra and a Known Error
*/]]></comment><naming format="lnkInfraError"><attributes/></naming><display_template></display_template><icon></icon><reconciliation><attributes><attribute name="infra_id"/><attribute name="error_id"/></attributes></reconciliation></properties><fields><field name="infra_id" type="ExternalKey" target_class="FunctionalCI" jointype="" sql="infra_id" is_null_allowed="false" on_target_delete="DEL_AUTO"/><field name="infra_name" type="ExternalField" extkey_attcode="infra_id" target_attcode="name"/><field name="infra_status" type="ExternalField" extkey_attcode="infra_id" target_attcode="status"/><field name="error_id" type="ExternalKey" target_class="KnownError" jointype="" sql="error_id" is_null_allowed="false" on_target_delete="DEL_AUTO"/><field name="error_name" type="ExternalField" extkey_attcode="error_id" target_attcode="name"/><field name="reason" type="String" sql="dummy" default_value="" is_null_allowed="true"/></fields><methods/><presentation><details><items><item>infra_id</item><item>error_id</item><item>reason</item></items></details><search><items><item>infra_id</item><item>error_id</item></items></search><list><items><item>infra_id_finalclass_recall</item><item>infra_id</item><item>infra_status</item><item>error_id</item><item>reason</item></items></list></presentation></class><class name="lnkDocumentError" category="bizmodel,searchable,knownerrormgmt,lnkknownerror" parent="cmdbAbstractObject" abstract="false" key_type="autoincrement" db_table="documents_error_link" db_key_field="link_id" db_final_class_field=""><properties><comment><![CDATA[/**
* n-n link between any Contract and a Document
*/]]></comment><naming format="%1$s"><attributes><attribute name="link_type"/></attributes></naming><display_template>../business/templates/default.html</display_template><icon></icon><reconciliation><attributes><attribute name="doc_id"/><attribute name="error_id"/></attributes></reconciliation></properties><fields><field name="doc_id" type="ExternalKey" target_class="Document" sql="doc_id" is_null_allowed="false" on_target_delete="DEL_AUTO"/><field name="doc_name" type="ExternalField" extkey_attcode="doc_id" target_attcode="name"/><field name="error_id" type="ExternalKey" target_class="KnownError" sql="error_id" is_null_allowed="false" on_target_delete="DEL_AUTO"/><field name="error_name" type="ExternalField" extkey_attcode="error_id" target_attcode="name"/><field name="link_type" type="String" sql="link_type" default_value="" is_null_allowed="true"/></fields><methods/><presentation><details><items><item>doc_id</item><item>error_name</item><item>link_type</item></items></details><search><items/></search><list><items><item>doc_id_finalclass_recall</item><item>doc_id</item><item>error_name</item><item>link_type</item></items></list></presentation></class></classes>

View File

@@ -14,13 +14,11 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Persistent classes for a CMDB
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
$oMyMenuGroup = new MenuGroup('ProblemManagement', 42 /* fRank */);
$iIndex = $oMyMenuGroup->GetIndex();
new NewObjectMenuNode('NewError', 'KnownError', $iIndex, 3 /* fRank */);
new SearchMenuNode('SearchError', 'KnownError', $iIndex, 4 /* fRank */);
$oShortcutNode = new TemplateMenuNode('Problem:Shortcuts', '', $iIndex, 5 /* fRank */);
new OQLMenuNode('Problem:KnownErrors', 'SELECT KnownError', $oShortcutNode->GetIndex(), 3 /* fRank */,true /*bsearch */);
?>

View File

@@ -1,175 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Persistent classes for a CMDB
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
////////////////////////////////////////////////////////////////////////////////////
/**
* Description of known error
*/
////////////////////////////////////////////////////////////////////////////////////
class KnownError extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,knownerrormgmt",
"name" => "Known Error",
"description" => "Error documented for a known issue",
"key_type" => "autoincrement",
"key_label" => "id",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array("org_id", "name"), // inherited attributes
"db_table" => "known_error",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
"icon" => "../modules/itop-knownerror-mgmt-1.0.0/images/known-error.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"Organization", "allowed_values"=>null, "sql"=>"cust_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("cust_name", array("allowed_values"=>null, "extkey_attcode"=> 'org_id', "target_attcode"=>"name")));
MetaModel::Init_AddAttribute(new AttributeExternalKey("problem_id", array("targetclass"=>"Problem", "allowed_values"=>null, "sql"=>"problem_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("problem_ref", array("allowed_values"=>null, "extkey_attcode"=> 'problem_id', "target_attcode"=>"ref")));
MetaModel::Init_AddAttribute(new AttributeText("symptom", array("allowed_values"=>null, "sql"=>"symptom", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("root_cause", array("allowed_values"=>null, "sql"=>"rootcause", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("workaround", array("allowed_values"=>null, "sql"=>"workaround", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("solution", array("allowed_values"=>null, "sql"=>"solution", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("error_code", array("allowed_values"=>null, "sql"=>"error_code", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("domain", array("allowed_values"=>new ValueSetEnum("Network, Server, Application, Desktop"), "sql"=>"domain", "default_value"=>"Application", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("vendor", array("allowed_values"=>null, "sql"=>"vendor", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("model", array("allowed_values"=>null, "sql"=>"model", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("version", array("allowed_values"=>null, "sql"=>"version", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ci_list", array("linked_class"=>"lnkInfraError", "ext_key_to_me"=>"error_id", "ext_key_to_remote"=>"infra_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("document_list", array("linked_class"=>"lnkDocumentError", "ext_key_to_me"=>"error_id", "ext_key_to_remote"=>"doc_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('name', 'org_id','problem_id','error_code','domain','vendor','model','version', 'symptom','root_cause','workaround','solution','ci_list','document_list')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('org_id','problem_id','error_code', 'symptom')); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('name', 'org_id','problem_id','error_code','domain','symptom')); // Criteria of the std search form
MetaModel::Init_SetZListItems('advanced_search', array('name', 'org_id','problem_id', 'error_code','domain','symptom')); // Criteria of the advanced search form
}
}
////////////////////////////////////////////////////////////////////////////////////
/**
* n-n link between any Infra and a Known Error
*/
////////////////////////////////////////////////////////////////////////////////////
class lnkInfraError extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,knownerrormgmt,lnkknownerror",
"name" => "InfraErrorLinks",
"description" => "Infra related to a known error",
"key_type" => "autoincrement",
"key_label" => "link_id",
"name_attcode" => "", // ????
"state_attcode" => "",
"reconc_keys" => array("infra_id","error_id"), // ????
"db_table" => "infra_error_links",
"db_key_field" => "link_id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_AddAttribute(new AttributeExternalKey("infra_id", array("targetclass"=>"FunctionalCI", "jointype"=> '',"allowed_values"=>null, "sql"=>"infra_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("infra_name", array("allowed_values"=>null, "extkey_attcode"=> 'infra_id', "target_attcode"=>"name")));
MetaModel::Init_AddAttribute(new AttributeExternalField("infra_status", array("allowed_values"=>null, "extkey_attcode"=> 'infra_id', "target_attcode"=>"status")));
MetaModel::Init_AddAttribute(new AttributeExternalKey("error_id", array("targetclass"=>"KnownError", "jointype"=> '', "allowed_values"=>null, "sql"=>"error_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("error_name", array( "allowed_values"=>null, "extkey_attcode"=> 'error_id', "target_attcode"=>"name")));
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"dummy", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
// Display lists
MetaModel::Init_SetZListItems('details', array('infra_id', 'error_id','reason')); // Attributes to be displayed for a list
MetaModel::Init_SetZListItems('list', array('infra_id', 'infra_status','error_id','reason')); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('infra_id', 'error_id')); // Criteria of the std search form
MetaModel::Init_SetZListItems('advanced_search', array('infra_id', 'error_id')); // Criteria of the advanced search form
}
}
////////////////////////////////////////////////////////////////////////////////////
/**
* n-n link between any Contract and a Document
*/
////////////////////////////////////////////////////////////////////////////////////
class lnkDocumentError extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,knownerrormgmt,lnkknownerror",
"name" => "DocumentsErrorLinks",
"description" => "A link between a document and a known error",
"key_type" => "autoincrement",
"key_label" => "link_id",
"name_attcode" => "link_type",
"state_attcode" => "",
"reconc_keys" => array("doc_id", "error_id"),
"db_table" => "documents_error_link",
"db_key_field" => "link_id",
"db_finalclass_field" => "",
"display_template" => "../business/templates/default.html",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_AddAttribute(new AttributeExternalKey("doc_id", array("targetclass"=>"Document","allowed_values"=>null, "sql"=>"doc_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("doc_name", array("allowed_values"=>null, "extkey_attcode"=> 'doc_id', "target_attcode"=>"name")));
MetaModel::Init_AddAttribute(new AttributeExternalKey("error_id", array("targetclass"=>"KnownError","allowed_values"=>null, "sql"=>"error_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("error_name", array("allowed_values"=>null, "extkey_attcode"=> 'error_id', "target_attcode"=>"name")));
MetaModel::Init_AddAttribute(new AttributeString("link_type", array("allowed_values"=>null, "sql"=>"link_type", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
// Display lists
MetaModel::Init_SetZListItems('details', array('doc_id', 'error_name', 'link_type')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('doc_id', 'error_name', 'link_type')); // Attributes to be displayed for a list
}
}
$oMyMenuGroup = new MenuGroup('ProblemManagement', 42 /* fRank */);
$iIndex = $oMyMenuGroup->GetIndex();
new NewObjectMenuNode('NewError', 'KnownError', $iIndex, 3 /* fRank */);
new SearchMenuNode('SearchError', 'KnownError', $iIndex, 4 /* fRank */);
$oShortcutNode = new TemplateMenuNode('Problem:Shortcuts', '', $iIndex, 5 /* fRank */);
new OQLMenuNode('Problem:KnownErrors', 'SELECT KnownError', $oShortcutNode->GetIndex(), 3 /* fRank */,true /*bsearch */);
?>

View File

@@ -24,6 +24,7 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'model.itop-knownerror-mgmt.php',
'main.itop-knownerror-mgmt.php',
),
'data.struct' => array(
//'data.struct.itop-knownerror-mgmt.xml',

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$oMyMenuGroup = new MenuGroup('ProblemManagement', 42 /* fRank */); // Will create if it does not exist
$iIndex = $oMyMenuGroup->GetIndex();
new TemplateMenuNode('Problem:Overview', dirname(__FILE__).'/overview.html', $iIndex /* oParent */, 0 /* fRank */);
new NewObjectMenuNode('NewProblem', 'Problem', $iIndex, 1 /* fRank */);
new SearchMenuNode('SearchProblems', 'Problem', $iIndex, 2 /* fRank */);
$oShortcutNode = new TemplateMenuNode('Problem:Shortcuts', '', $iIndex, 5 /* fRank */);
new OQLMenuNode('Problem:MyProblems', 'SELECT Problem WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
new OQLMenuNode('Problem:OpenProblems', 'SELECT Problem WHERE status IN ("new", "assigned", "resolved")', $oShortcutNode->GetIndex(), 2 /* fRank */);
?>

View File

@@ -1,254 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Persistent classes for a CMDB
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
class Problem extends Ticket
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,problemmgmt",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "status",
"reconc_keys" => array("ref"),
"db_table" => "ticket_problem",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
"icon" => "../modules/itop-problem-mgmt-1.0.0/images/problem.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
// MetaModel::Init_InheritLifecycle();
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('new,assigned,resolved,closed'), "sql"=>"status", "default_value"=>"new", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"Organization", "jointype"=>null, "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("allowed_values"=>null, "extkey_attcode"=>"org_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("service_id", array("targetclass"=>"Service", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Service AS s JOIN SLA AS sla ON sla.service_id=s.id JOIN lnkContractToSLA AS ln ON ln.sla_id=sla.id JOIN CustomerContract AS cc ON ln.contract_id=cc.id WHERE cc.org_id =:this->org_id'), "sql"=>"service_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("service_name", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("servicesubcategory_id", array("targetclass"=>"ServiceSubcategory", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT ServiceSubcategory WHERE service_id = :this->service_id'), "sql"=>"servicesubcategory_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("service_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("servicesubcategory_name", array("allowed_values"=>null, "extkey_attcode"=>"servicesubcategory_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("product", array("allowed_values"=>null, "sql"=>"product", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("impact", array("allowed_values"=>new ValueSetEnum('1,2,3'), "sql"=>"impact", "default_value"=>"1", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("urgency", array("allowed_values"=>new ValueSetEnum('1,2,3'), "sql"=>"urgency", "default_value"=>"1", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("priority", array("allowed_values"=>new ValueSetEnum('1,2,3'), "sql"=>"priority", "default_value"=>"1", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("workgroup_id", array("targetclass"=>"Team", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Team AS t JOIN CustomerContract AS cc ON cc.support_team_id=t.id JOIN lnkContractToSLA AS ln ON ln.contract_id=cc.id JOIN SLA AS sla ON ln.sla_id=sla.id WHERE sla.service_id = :this->service_id AND cc.org_id = :this->org_id'), "sql"=>"workgroup_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id","service_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("workgroup_name", array("allowed_values"=>null, "extkey_attcode"=>"workgroup_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("agent_id", array("targetclass"=>"Person", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Person AS p JOIN lnkTeamToContact AS l ON l.contact_id=p.id JOIN Team AS t ON l.team_id=t.id WHERE t.id = :this->workgroup_id'), "sql"=>"agent_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("workgroup_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("agent_name", array("allowed_values"=>null, "extkey_attcode"=>"agent_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("agent_email", array("allowed_values"=>null, "extkey_attcode"=>"agent_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("related_change_id", array("targetclass"=>"Change", "jointype"=>null, "allowed_values"=>null, "sql"=>"related_change_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("related_change_ref", array("allowed_values"=>null, "extkey_attcode"=>"related_change_id", "target_attcode"=>"ref", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("close_date", array("allowed_values"=>null, "sql"=>"close_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("last_update", array("allowed_values"=>null, "sql"=>"last_update", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("assignment_date", array("allowed_values"=>null, "sql"=>"assignment_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("resolution_date", array("allowed_values"=>null, "sql"=>"resolution_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("knownerrors_list", array("linked_class"=>"KnownError", "ext_key_to_me"=>"problem_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('document_list', 'ci_list', 'contact_list','incident_list',
'col:col1' => array(
'fieldset:Ticket:baseinfo' => array('ref','title','org_id','status','priority','service_id','servicesubcategory_id','product' ),
'fieldset:Ticket:moreinfo' => array('impact','urgency','description',),
),
'col:col2' => array(
'fieldset:Ticket:date' => array('start_date','last_update','assignment_date','close_date',),
'fieldset:Ticket:contact' => array('workgroup_id','agent_id',),
'fieldset:Ticket:relation' => array('related_change_id',),
)
));
// MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'description', 'ticket_log', 'start_date','knownerrors_list', 'document_list', 'ci_list', 'contact_list','incident_list', 'status', 'service_id', 'servicesubcategory_id','product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_change_id', 'close_date', 'last_update', 'assignment_date'));
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_change_id', 'close_date'));
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'close_date'));
MetaModel::Init_SetZListItems('list', array('title', 'org_id', 'start_date', 'status', 'service_id', 'priority'));
// Lifecycle
MetaModel::Init_DefineState(
"new",
array(
"attribute_inherit" => null,
"attribute_list" => array(
'ref' => OPT_ATT_READONLY,
'ticket_log' => OPT_ATT_HIDDEN,
'related_change_id' => OPT_ATT_HIDDEN,
'description' => OPT_ATT_MUSTCHANGE,
'start_date' => OPT_ATT_READONLY,
'last_update' => OPT_ATT_READONLY,
'assignment_date' => OPT_ATT_HIDDEN,
'resolution_date' => OPT_ATT_HIDDEN,
'close_date' => OPT_ATT_HIDDEN,
'org_id' => OPT_ATT_MUSTCHANGE,
'service_id' => OPT_ATT_MUSTCHANGE,
'servicesubcategory_id' => OPT_ATT_MUSTCHANGE,
'product' => OPT_ATT_MUSTPROMPT,
'impact' => OPT_ATT_MUSTCHANGE,
'urgency' => OPT_ATT_MUSTCHANGE,
'priority' => OPT_ATT_READONLY,
'workgroup_id' => OPT_ATT_MUSTCHANGE,
'agent_id' => OPT_ATT_HIDDEN,
'agent_email' => OPT_ATT_HIDDEN,
),
)
);
MetaModel::Init_DefineState(
"assigned",
array(
"attribute_inherit" => 'new',
"attribute_list" => array(
'title' => OPT_ATT_READONLY,
'org_id' => OPT_ATT_READONLY,
'ticket_log' => OPT_ATT_NORMAL,
'assignment_date' => OPT_ATT_READONLY,
'description' => OPT_ATT_READONLY,
'agent_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
'agent_email' => OPT_ATT_READONLY,
'workgroup_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
'related_change_id' => OPT_ATT_NORMAL,
),
)
);
MetaModel::Init_DefineState(
"resolved",
array(
"attribute_inherit" => 'assigned',
"attribute_list" => array(
'service_id' => OPT_ATT_READONLY,
'servicesubcategory_id' => OPT_ATT_READONLY,
'product' => OPT_ATT_READONLY,
'impact' => OPT_ATT_READONLY,
'workgroup_id' => OPT_ATT_READONLY,
'agent_id' => OPT_ATT_READONLY,
'urgency' => OPT_ATT_READONLY,
),
)
);
MetaModel::Init_DefineState(
"closed",
array(
"attribute_inherit" => 'resolved',
"attribute_list" => array(
'ticket_log' => OPT_ATT_READONLY,
'close_date' => OPT_ATT_READONLY,
),
)
);
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_assign", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_reassign", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_resolve", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_close", array()));
MetaModel::Init_DefineTransition("new", "ev_assign", array("target_state"=>"assigned", "actions"=>array('SetAssignedDate'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("assigned", "ev_reassign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("assigned", "ev_resolve", array("target_state"=>"resolved", "actions"=>array('SetResolveDate'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("resolved", "ev_reassign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("resolved", "ev_close", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
}
// Lifecycle actions
//
public function SetAssignedDate($sStimulusCode)
{
$this->Set('assignment_date', time());
return true;
}
public function SetResolveDate($sStimulusCode)
{
$this->Set('resolution_date', time());
return true;
}
public function SetClosureDate($sStimulusCode)
{
$this->Set('close_date', time());
return true;
}
/** Compute the priority of the ticket based on its impact and urgency
* @return integer The priority of the ticket 1(high) .. 3(low)
*/
public function ComputePriority()
{
// priority[impact][urgency]
$aPriorities = array(
// single person
1 => array(
1 => 1,
2 => 1,
3 => 2,
),
// a group
2 => array(
1 => 1,
2 => 2,
3 => 3,
),
// a departement!
3 => array(
1 => 2,
2 => 3,
3 => 3,
),
);
$iPriority = $aPriorities[(int)$this->Get('impact')][(int)$this->Get('urgency')];
return $iPriority;
}
public function ComputeValues()
{
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
$sCurrRef = $this->Get('ref');
if (strlen($sCurrRef) == 0)
{
$iKey = $this->GetKey();
if ($iKey < 0)
{
// Object not yet in the Database
$iKey = MetaModel::GetNextKey(get_class($this));
}
$sName = sprintf('P-%06d', $iKey);
$this->Set('ref', $sName);
}
}
}
$oMyMenuGroup = new MenuGroup('ProblemManagement', 42 /* fRank */); // Will create if it does not exist
$iIndex = $oMyMenuGroup->GetIndex();
new TemplateMenuNode('Problem:Overview', dirname(__FILE__).'/overview.html', $iIndex /* oParent */, 0 /* fRank */);
new NewObjectMenuNode('NewProblem', 'Problem', $iIndex, 1 /* fRank */);
new SearchMenuNode('SearchProblems', 'Problem', $iIndex, 2 /* fRank */);
$oShortcutNode = new TemplateMenuNode('Problem:Shortcuts', '', $iIndex, 5 /* fRank */);
new OQLMenuNode('Problem:MyProblems', 'SELECT Problem WHERE agent_id = :current_contact_id AND status NOT IN ("closed", "resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
new OQLMenuNode('Problem:OpenProblems', 'SELECT Problem WHERE status IN ("new", "assigned", "resolved")', $oShortcutNode->GetIndex(), 2 /* fRank */);
?>

View File

@@ -24,6 +24,7 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'model.itop-problem-mgmt.php',
'main.itop-problem-mgmt.php',
),
'data.struct' => array(
//'data.struct.itop-problem-mgmt.xml',

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,30 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$oMyMenuGroup = new MenuGroup('RequestManagement', 30 /* fRank */);
new TemplateMenuNode('UserRequest:Overview', dirname(__FILE__).'/overview.html', $oMyMenuGroup->GetIndex() /* oParent */, 0 /* fRank */);
new NewObjectMenuNode('NewUserRequest', 'UserRequest', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
new SearchMenuNode('SearchUserRequests', 'UserRequest', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
$oShortcutNode = new TemplateMenuNode('UserRequest:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
$oNode = new OQLMenuNode('UserRequest:MyRequests', 'SELECT UserRequest WHERE agent_id = :current_contact_id AND status NOT IN ("closed","resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('UserRequest:EscalatedRequests', 'SELECT UserRequest WHERE status IN ("escalated_tto", "escalated_ttr")', $oShortcutNode->GetIndex(), 2 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('UserRequest:OpenRequests', 'SELECT UserRequest WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "frozen", "resolved")', $oShortcutNode->GetIndex(), 3 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
?>

View File

@@ -1,213 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Persistent classes for a CMDB
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
class UserRequest extends ResponseTicket
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,requestmgmt",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "status",
"reconc_keys" => array("ref"),
"db_table" => "ticket_request",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
"icon" => "../modules/itop-request-mgmt-1.0.0/images/user-request.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_InheritLifecycle();
MetaModel::Init_AddAttribute(new AttributeEnum("request_type", array("allowed_values"=>new ValueSetEnum('service request,issue,information'), "sql"=>"request_type", "default_value"=>"service request", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("freeze_reason", array("allowed_values"=>null, "sql"=>"freeze_reason", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('document_list', 'ci_list', 'contact_list','incident_list',
'col:col1' => array(
'fieldset:Ticket:baseinfo' => array('ref','title','org_id','status','priority','request_type','service_id','servicesubcategory_id','product' ),
'fieldset:Ticket:moreinfo' => array('impact','urgency','description','resolution_code', 'solution', 'user_satisfaction', 'user_commment','freeze_reason'),
),
'col:col2' => array(
'fieldset:Ticket:date' => array('start_date','last_update','assignment_date','tto_escalation_deadline', 'ttr_escalation_deadline', 'close_date', 'closure_deadline',),
'fieldset:Ticket:contact' => array('caller_id','workgroup_id','agent_id',),
'fieldset:Ticket:relation' => array('related_problem_id', 'related_change_id'),
)
));
// MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'description', 'request_type','ticket_log', 'start_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'document_list', 'ci_list', 'contact_list','incident_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment', 'freeze_reason'));
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'request_type','start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'close_date', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
MetaModel::Init_SetZListItems('list', array('title', 'org_id', 'start_date', 'status', 'service_id', 'priority', 'workgroup_id', 'agent_id'));
MetaModel::Init_OverloadStateAttribute('frozen', 'freeze_reason', OPT_ATT_MANDATORY);
// The freeze reason remains hidden in all other states
MetaModel::Init_OverloadStateAttribute('new', 'request_type', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('new', 'freeze_reason', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('assigned', 'request_type', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('assigned', 'freeze_reason', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('frozen', 'request_type', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('frozen', 'freeze_reason', OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT);
MetaModel::Init_OverloadStateAttribute('escalated_tto', 'request_type', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('escalated_tto', 'freeze_reason', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('escalated_ttr', 'request_type', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('escalated_ttr', 'freeze_reason', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('resolved', 'request_type', OPT_ATT_MANDATORY);
MetaModel::Init_OverloadStateAttribute('resolved', 'freeze_reason', OPT_ATT_HIDDEN);
MetaModel::Init_OverloadStateAttribute('closed', 'request_type', OPT_ATT_READONLY);
MetaModel::Init_OverloadStateAttribute('closed', 'freeze_reason', OPT_ATT_HIDDEN);
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_freeze", array()));
MetaModel::Init_DefineTransition("assigned", "ev_freeze", array("target_state"=>"frozen", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("frozen", "ev_timeout", array("target_state"=>"escalated_ttr", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("frozen", "ev_assign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("frozen", "ev_resolve", array("target_state"=>"resolved", "actions"=>array(), "user_restriction"=>null));
}
public function ComputeValues()
{
$sCurrRef = $this->Get('ref');
if (strlen($sCurrRef) == 0)
{
$iKey = $this->GetKey();
if ($iKey < 0)
{
// Object not yet in the Database
$iKey = MetaModel::GetNextKey(get_class($this));
}
$sName = sprintf('R-%06d', $iKey);
$this->Set('ref', $sName);
}
return parent::ComputeValues();
}
/**
* Get the icon representing this object
* @param boolean $bImgTag If true the result is a full IMG tag (or an emtpy string if no icon is defined)
* @return string Either the full IMG tag ($bImgTag == true) or just the path to the icon file
*/
public function GetIcon($bImgTag = true)
{
$sStatus = $this->Get('status');
switch($this->GetState())
{
case 'escalated_tto':
case 'escalated_ttr':
$sIcon = self::MakeIconFromName('user-request-escalated.png');
break;
case 'resolved':
case 'closed':
$sIcon = self::MakeIconFromName('user-request-closed.png');
break;
case 'new':
$sIcon = self::MakeIconFromName('user-request.png');
$oEscalationDeadline = $this->Get('tto_escalation_deadline');
if ($oEscalationDeadline != null)
{
// A SLA is running
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
$iEscalationDeadline = AttributeDateTime::GetAsUnixSeconds($oEscalationDeadline);
$ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate);
if ($ratio <= 0)
{
$sIcon = self::MakeIconFromName('user-request-escalated.png');
}
else if ($ratio <= 0.25)
{
$sIcon = self::MakeIconFromName('user-request-deadline.png');
}
}
break;
case 'assigned':
$sIcon = self::MakeIconFromName('user-request.png');
$oEscalationDeadline = $this->Get('ttr_escalation_deadline');
if ($oEscalationDeadline != null)
{
// A SLA is running
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
$iEscalationDeadline = AttributeDateTime::GetAsUnixSeconds($oEscalationDeadline);
$ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate);
if ($ratio <= 0)
{
$sIcon = self::MakeIconFromName('user-request-escalated.png');
}
else if ($ratio <= 0.25)
{
$sIcon = self::MakeIconFromName('user-request-deadline.png');
}
}
break;
default:
$sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag);
}
return $sIcon;
}
protected static function MakeIconFromName($sIconName, $bImgTag = true)
{
$sIcon = '';
if ($sIconName != '')
{
$sPath = '../modules/itop-request-mgmt-1.0.0/images/'.$sIconName;
if ($bImgTag)
{
$sIcon = "<img src=\"$sPath\" style=\"vertical-align:middle;\"/>";
}
else
{
$sIcon = $sPath;
}
}
return $sIcon;
}
}
$oMyMenuGroup = new MenuGroup('RequestManagement', 30 /* fRank */);
new TemplateMenuNode('UserRequest:Overview', dirname(__FILE__).'/overview.html', $oMyMenuGroup->GetIndex() /* oParent */, 0 /* fRank */);
new NewObjectMenuNode('NewUserRequest', 'UserRequest', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
new SearchMenuNode('SearchUserRequests', 'UserRequest', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
$oShortcutNode = new TemplateMenuNode('UserRequest:Shortcuts', '', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
$oNode = new OQLMenuNode('UserRequest:MyRequests', 'SELECT UserRequest WHERE agent_id = :current_contact_id AND status NOT IN ("closed","resolved")', $oShortcutNode->GetIndex(), 1 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('UserRequest:EscalatedRequests', 'SELECT UserRequest WHERE status IN ("escalated_tto", "escalated_ttr")', $oShortcutNode->GetIndex(), 2 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
$oNode = new OQLMenuNode('UserRequest:OpenRequests', 'SELECT UserRequest WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "frozen", "resolved")', $oShortcutNode->GetIndex(), 3 /* fRank */);
$oNode->SetParameters(array('auto_reload' => 'fast'));
?>

View File

@@ -23,6 +23,7 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'model.itop-request-mgmt.php',
'main.itop-request-mgmt.php',
),
'data.struct' => array(
'data.struct.ta-triggers.xml',

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$oServiceManagementGroup = new MenuGroup('ServiceManagement', 60 /* fRank */);
$iRank = 0;
new TemplateMenuNode('Service:Overview', dirname(__FILE__).'/overview.html', $oServiceManagementGroup->GetIndex() /* oParent */, $iRank++ /* fRank */);
new OQLMenuNode('ProviderContract', 'SELECT ProviderContract', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('CustomerContract', 'SELECT CustomerContract', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('Service', 'SELECT Service', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('ServiceSubcategory', 'SELECT ServiceSubcategory', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('SLA', 'SELECT SLA', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('SLT', 'SELECT SLT', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
?>

View File

@@ -1,619 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Persistent classes for a CMDB
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
abstract class Contract extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array("name"),
"db_table" => "contract",
"db_key_field" => "id",
"db_finalclass_field" => "",
"icon" => "../modules/itop-service-mgmt-1.0.0/contract.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("start_date", array("allowed_values"=>null, "sql"=>"start_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("end_date", array("allowed_values"=>null, "sql"=>"end_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeInteger("cost", array("allowed_values"=>null, "sql"=>"cost", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("cost_currency", array("allowed_values"=>new ValueSetEnum('dollars,euros'), "sql"=>"cost_currency", "default_value"=>"euros", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("cost_unit", array("allowed_values"=>null, "sql"=>"cost_unit", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("billing_frequency", array("allowed_values"=>null, "sql"=>"billing_frequency", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("contact_list", array("linked_class"=>"lnkContractToContact", "ext_key_to_me"=>"contract_id", "ext_key_to_remote"=>"contact_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("document_list", array("linked_class"=>"lnkContractToDoc", "ext_key_to_me"=>"contract_id", "ext_key_to_remote"=>"document_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ci_list", array("linked_class"=>"lnkContractToCI", "ext_key_to_me"=>"contract_id", "ext_key_to_remote"=>"ci_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('name', 'description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency', 'contact_list', 'document_list', 'ci_list'));
MetaModel::Init_SetZListItems('advanced_search', array('name', 'description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency'));
MetaModel::Init_SetZListItems('standard_search', array('name', 'description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency'));
MetaModel::Init_SetZListItems('list', array('description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency'));
}
}
class ProviderContract extends Contract
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array("name","provider_id"),
"db_table" => "providercontract",
"db_key_field" => "id",
"db_finalclass_field" => "",
"icon" => "../modules/itop-service-mgmt-1.0.0/contract.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("provider_id", array("targetclass"=>"Organization", "jointype"=>null, "allowed_values"=>null, "sql"=>"provider_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("provider_name", array("allowed_values"=>null, "extkey_attcode"=>"provider_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("sla", array("allowed_values"=>null, "sql"=>"sla", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("coverage", array("allowed_values"=>null, "sql"=>"coverage", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('name', 'description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency', 'contact_list', 'document_list', 'ci_list', 'provider_id', 'sla', 'coverage'));
MetaModel::Init_SetZListItems('advanced_search', array('name', 'description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency', 'provider_id', 'sla', 'coverage'));
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 parent::MapContextParam($sContextParam); // Ask the parent what to do with other parameters...
}
}
}
class CustomerContract extends Contract
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array("name","org_id","provider_id"),
"db_table" => "customercontract",
"db_key_field" => "id",
"db_finalclass_field" => "",
"icon" => "../modules/itop-service-mgmt-1.0.0/contract.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"Organization", "jointype"=>null, "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("allowed_values"=>null, "extkey_attcode"=>"org_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("provider_id", array("targetclass"=>"Organization", "jointype"=>null, "allowed_values"=>null, "sql"=>"provider_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("provider_name", array("allowed_values"=>null, "extkey_attcode"=>"provider_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("support_team_id", array("targetclass"=>"Team", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Team WHERE Team.org_id = :this->provider_id'), "sql"=>"support_team_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array('provider_id'))));
MetaModel::Init_AddAttribute(new AttributeExternalField("support_team_name", array("allowed_values"=>null, "extkey_attcode"=>"support_team_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("sla_list", array("linked_class"=>"lnkContractToSLA", "ext_key_to_me"=>"contract_id", "ext_key_to_remote"=>"sla_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("provider_list", array("linked_class"=>"lnkCustomerContractToProviderContract", "ext_key_to_me"=>"customer_contract_id", "ext_key_to_remote"=>"provider_contract_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('name', 'org_id', 'description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency', 'contact_list', 'document_list', 'ci_list', 'provider_list','provider_id', 'support_team_id', 'sla_list'));
MetaModel::Init_SetZListItems('advanced_search', array('name', 'description', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency', 'org_id', 'support_team_id'));
MetaModel::Init_SetZListItems('standard_search', array('name', 'description', 'org_id', 'start_date', 'end_date', 'cost', 'cost_currency', 'cost_unit', 'billing_frequency', 'provider_id', 'support_team_id'));
MetaModel::Init_SetZListItems('list', array('org_id', 'start_date', 'end_date', 'provider_id', 'support_team_id'));
}
}
class lnkCustomerContractToProviderContract extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "customer_contract_id",
"state_attcode" => "",
"reconc_keys" => array("customer_contract_id","provider_contract_id"),
"db_table" => "lnkcustomercontracttoprovider",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("customer_contract_id", array("targetclass"=>"CustomerContract", "jointype"=>null, "allowed_values"=>null, "sql"=>"customer_contract_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("customer_contract_name", array("allowed_values"=>null, "extkey_attcode"=>"customer_contract_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("provider_contract_id", array("targetclass"=>"ProviderContract", "jointype"=>null, "allowed_values"=>null, "sql"=>"provider_contract_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("provider_contract_name", array("allowed_values"=>null, "extkey_attcode"=>"provider_contract_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("provider_sla", array("allowed_values"=>null, "extkey_attcode"=>"provider_contract_id", "target_attcode"=>"sla", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("provider_coverage", array("allowed_values"=>null, "extkey_attcode"=>"provider_contract_id", "target_attcode"=>"coverage", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('customer_contract_id', 'provider_contract_id','provider_sla','provider_coverage'));
MetaModel::Init_SetZListItems('advanced_search', array('customer_contract_id', 'provider_contract_id'));
MetaModel::Init_SetZListItems('standard_search', array('customer_contract_id', 'provider_contract_id'));
MetaModel::Init_SetZListItems('list', array('customer_contract_id', 'provider_contract_id','provider_sla','provider_coverage'));
}
}
class lnkContractToSLA extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "contract_id",
"state_attcode" => "",
"reconc_keys" => array("contract_id","sla_id"),
"db_table" => "lnkcontracttosla",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("contract_id", array("targetclass"=>"CustomerContract", "jointype"=>null, "allowed_values"=>null, "sql"=>"contract_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contract_name", array("allowed_values"=>null, "extkey_attcode"=>"contract_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("sla_id", array("targetclass"=>"SLA", "jointype"=>null, "allowed_values"=>null, "sql"=>"sla_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("sla_name", array("allowed_values"=>null, "extkey_attcode"=>"sla_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("sla_service_name", array("allowed_values"=>null, "extkey_attcode"=>"sla_id", "target_attcode"=>"service_name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("coverage", array("allowed_values"=>null, "sql"=>"coverage", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('contract_id', 'sla_id','sla_service_name', 'coverage'));
MetaModel::Init_SetZListItems('advanced_search', array('contract_id', 'sla_id', 'coverage'));
MetaModel::Init_SetZListItems('standard_search', array('contract_id', 'sla_id', 'coverage'));
MetaModel::Init_SetZListItems('list', array('contract_id', 'sla_id', 'sla_service_name','coverage'));
}
}
class lnkContractToDoc extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "contract_id",
"state_attcode" => "",
"reconc_keys" => array("contract_id","document_id"),
"db_table" => "lnkcontracttodoc",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("contract_id", array("targetclass"=>"Contract", "jointype"=>null, "allowed_values"=>null, "sql"=>"contract_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contract_name", array("allowed_values"=>null, "extkey_attcode"=>"contract_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("document_id", array("targetclass"=>"Document", "jointype"=>null, "allowed_values"=>null, "sql"=>"document_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("document_name", array("allowed_values"=>null, "extkey_attcode"=>"document_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("document_type", array("allowed_values"=>null, "extkey_attcode"=>"document_id", "target_attcode"=>"type", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("document_status", array("allowed_values"=>null, "extkey_attcode"=>"document_id", "target_attcode"=>"status", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('contract_id', 'document_id', 'document_type', 'document_status'));
MetaModel::Init_SetZListItems('advanced_search', array('contract_id', 'document_id', 'document_type', 'document_status'));
MetaModel::Init_SetZListItems('standard_search', array('contract_id', 'document_id', 'document_type', 'document_status'));
MetaModel::Init_SetZListItems('list', array('contract_id', 'document_id', 'document_type', 'document_status'));
}
}
class lnkContractToContact extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "contract_id",
"state_attcode" => "",
"reconc_keys" => array("contract_id","contact_id"),
"db_table" => "lnkcontracttocontact",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("contract_id", array("targetclass"=>"Contract", "jointype"=>null, "allowed_values"=>null, "sql"=>"contract_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contract_name", array("allowed_values"=>null, "extkey_attcode"=>"contract_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("contact_id", array("targetclass"=>"Contact", "jointype"=>null, "allowed_values"=>null, "sql"=>"contact_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("role", array("allowed_values"=>null, "sql"=>"role", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('contract_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('advanced_search', array('contract_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('standard_search', array('contract_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('list', array('contract_id', 'contact_id', 'contact_email', 'role'));
}
}
class lnkContractToCI extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "contract_id",
"state_attcode" => "",
"reconc_keys" => array("contract_id","ci_id"),
"db_table" => "lnkcontracttoci",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("contract_id", array("targetclass"=>"Contract", "jointype"=>null, "allowed_values"=>null, "sql"=>"contract_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contract_name", array("allowed_values"=>null, "extkey_attcode"=>"contract_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("ci_id", array("targetclass"=>"FunctionalCI", "jointype"=>null, "allowed_values"=>null, "sql"=>"ci_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ci_name", array("allowed_values"=>null, "extkey_attcode"=>"ci_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ci_status", array("allowed_values"=>null, "extkey_attcode"=>"ci_id", "target_attcode"=>"status", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('contract_id', 'ci_id', 'ci_status'));
MetaModel::Init_SetZListItems('advanced_search', array('contract_id', 'ci_id', 'ci_status'));
MetaModel::Init_SetZListItems('standard_search', array('contract_id', 'ci_id', 'ci_status'));
MetaModel::Init_SetZListItems('list', array('contract_id', 'ci_id', 'ci_status'));
}
}
class Service extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array("name","org_id"),
"db_table" => "service",
"db_key_field" => "id",
"db_finalclass_field" => "",
"icon" => "../modules/itop-service-mgmt-1.0.0/service.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"Organization", "jointype"=>null, "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("provider_name", array("allowed_values"=>null, "extkey_attcode"=>"org_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("type", array("allowed_values"=>new ValueSetEnum('RequestManagement,IncidentManagement'), "sql"=>"type", "default_value"=>"IncidentManagement", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('design,production,obsolete'), "sql"=>"status", "default_value"=>"design", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("subcategory_list", array("linked_class"=>"ServiceSubcategory", "ext_key_to_me"=>"service_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("sla_list", array("linked_class"=>"SLA", "ext_key_to_me"=>"service_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("document_list", array("linked_class"=>"lnkServiceToDoc", "ext_key_to_me"=>"service_id", "ext_key_to_remote"=>"document_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("contact_list", array("linked_class"=>"lnkServiceToContact", "ext_key_to_me"=>"service_id", "ext_key_to_remote"=>"contact_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('name', 'description', 'org_id', 'type', 'status', 'subcategory_list', 'sla_list', 'document_list', 'contact_list'));
MetaModel::Init_SetZListItems('advanced_search', array('name', 'description', 'org_id', 'type', 'status'));
MetaModel::Init_SetZListItems('standard_search', array('name', 'description', 'org_id', 'type', 'status'));
MetaModel::Init_SetZListItems('list', array('description', 'org_id', 'type', 'status'));
}
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
{
parent::DisplayBareRelations($oPage, $bEditMode);
$aExtraParam = array ('menu' => false, 'block_id' => 'service');
$ServiceID=$this->GetKey();
if (!$bEditMode)
{
$oPage->SetCurrentTab(Dict::S('Class:Service/Tab:Related_Contracts'));
$oCustomerContracts=new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT CustomerContract AS cc JOIN lnkContractToSLA AS ln ON ln.contract_id=cc.id JOIN SLA AS sla ON ln.sla_id=sla.id WHERE sla.service_id=$ServiceID"));
self::DisplaySet($oPage,$oCustomerContracts,$aExtraParam);
}
}
}
class ServiceSubcategory extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array("name","service_id"),
"db_table" => "servicesubcategory",
"db_key_field" => "id",
"db_finalclass_field" => "",
"icon" => "../modules/itop-service-mgmt-1.0.0/sla.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("service_id", array("targetclass"=>"Service", "jointype"=>null, "allowed_values"=>null, "sql"=>"service_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("service_name", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("org_id", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"org_id", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("provider_name", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"provider_name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('name', 'org_id','service_id','description'));
MetaModel::Init_SetZListItems('advanced_search', array('name', 'description', 'service_id'));
MetaModel::Init_SetZListItems('standard_search', array('name', 'description', 'service_id','provider_name'));
MetaModel::Init_SetZListItems('list', array('service_id','description'));
}
}
class SLA extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array("name","service_id"),
"db_table" => "sla",
"db_key_field" => "id",
"db_finalclass_field" => "",
"icon" => "../modules/itop-service-mgmt-1.0.0/sla.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("service_id", array("targetclass"=>"Service", "jointype"=>null, "allowed_values"=>null, "sql"=>"service_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("service_name", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("slt_list", array("linked_class"=>"lnkSLTToSLA", "ext_key_to_me"=>"sla_id", "ext_key_to_remote"=>"slt_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('name', 'service_id', 'slt_list'));
MetaModel::Init_SetZListItems('advanced_search', array('name', 'service_id'));
MetaModel::Init_SetZListItems('standard_search', array('name', 'service_id'));
MetaModel::Init_SetZListItems('list', array('service_id'));
}
}
class SLT extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt",
"key_type" => "autoincrement",
"name_attcode" => "name",
"state_attcode" => "",
"reconc_keys" => array("name"),
"db_table" => "slt",
"db_key_field" => "id",
"db_finalclass_field" => "",
"icon" => "../modules/itop-service-mgmt-1.0.0/slt.png",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("metric", array("allowed_values"=>new ValueSetEnum('TTO,TTR'), "sql"=>"metric", "default_value"=>'TTO', "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("ticket_priority", array("allowed_values"=>new ValueSetEnum('1,2,3'), "sql"=>"ticket_priority", "default_value"=>"1", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeInteger("value", array("allowed_values"=>null, "sql"=>"value", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("value_unit", array("allowed_values"=>new ValueSetEnum('days,hours,minutes'), "sql"=>"value_unit", "default_value"=>"hours", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("sla_list", array("linked_class"=>"lnkSLTToSLA", "ext_key_to_me"=>"slt_id", "ext_key_to_remote"=>"sla_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('name', 'metric', 'ticket_priority', 'value', 'value_unit', 'sla_list'));
MetaModel::Init_SetZListItems('advanced_search', array('name', 'metric', 'ticket_priority', 'value', 'value_unit'));
MetaModel::Init_SetZListItems('standard_search', array('name', 'metric', 'ticket_priority', 'value', 'value_unit'));
MetaModel::Init_SetZListItems('list', array('metric', 'ticket_priority', 'value', 'value_unit'));
}
}
class lnkSLTToSLA extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "sla_id",
"state_attcode" => "",
"reconc_keys" => array("sla_id","slt_id"),
"db_table" => "lnkslttosla",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("sla_id", array("targetclass"=>"SLA", "jointype"=>null, "allowed_values"=>null, "sql"=>"sla_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("sla_name", array("allowed_values"=>null, "extkey_attcode"=>"sla_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("slt_id", array("targetclass"=>"SLT", "jointype"=>null, "allowed_values"=>null, "sql"=>"slt_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("slt_name", array("allowed_values"=>null, "extkey_attcode"=>"slt_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("slt_metric", array("allowed_values"=>null, "extkey_attcode"=>"slt_id", "target_attcode"=>"metric", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("slt_ticket_priority", array("allowed_values"=>null, "extkey_attcode"=>"slt_id", "target_attcode"=>"ticket_priority", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("slt_value", array("allowed_values"=>null, "extkey_attcode"=>"slt_id", "target_attcode"=>"value", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("slt_value_unit", array("allowed_values"=>null, "extkey_attcode"=>"slt_id", "target_attcode"=>"value_unit", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('sla_id', 'slt_id', 'slt_metric', 'slt_ticket_priority', 'slt_value', 'slt_value_unit'));
MetaModel::Init_SetZListItems('advanced_search', array('sla_id', 'slt_id', 'slt_metric', 'slt_ticket_priority', 'slt_value', 'slt_value_unit'));
MetaModel::Init_SetZListItems('standard_search', array('sla_id', 'slt_id', 'slt_metric', 'slt_ticket_priority', 'slt_value', 'slt_value_unit'));
MetaModel::Init_SetZListItems('list', array('sla_id', 'slt_id', 'slt_metric', 'slt_ticket_priority', 'slt_value', 'slt_value_unit'));
}
}
class lnkServiceToDoc extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "service_id",
"state_attcode" => "",
"reconc_keys" => array("service_id","document_id"),
"db_table" => "lnkservicetodoc",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("service_id", array("targetclass"=>"Service", "jointype"=>null, "allowed_values"=>null, "sql"=>"service_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("service_name", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("document_id", array("targetclass"=>"Document", "jointype"=>null, "allowed_values"=>null, "sql"=>"document_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("document_name", array("allowed_values"=>null, "extkey_attcode"=>"document_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("document_type", array("allowed_values"=>null, "extkey_attcode"=>"document_id", "target_attcode"=>"type", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("document_status", array("allowed_values"=>null, "extkey_attcode"=>"document_id", "target_attcode"=>"status", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('service_id', 'document_id', 'document_type', 'document_status'));
MetaModel::Init_SetZListItems('advanced_search', array('service_id', 'document_id', 'document_type', 'document_status'));
MetaModel::Init_SetZListItems('standard_search', array('service_id', 'document_id', 'document_type', 'document_status'));
MetaModel::Init_SetZListItems('list', array('service_id', 'document_id', 'document_type', 'document_status'));
}
}
class lnkServiceToContact extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "service_id",
"state_attcode" => "",
"reconc_keys" => array("service_id","contact_id"),
"db_table" => "lnkservicetocontact",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("service_id", array("targetclass"=>"Service", "jointype"=>null, "allowed_values"=>null, "sql"=>"service_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("service_name", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("contact_id", array("targetclass"=>"Contact", "jointype"=>null, "allowed_values"=>null, "sql"=>"contact_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("role", array("allowed_values"=>null, "sql"=>"role", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('service_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('advanced_search', array('service_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('standard_search', array('service_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('list', array('service_id', 'contact_id', 'contact_email', 'role'));
}
}
class lnkServiceToCI extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,servicemgmt,lnkservice",
"key_type" => "autoincrement",
"name_attcode" => "service_id",
"state_attcode" => "",
"reconc_keys" => array("service_id","ci_id"),
"db_table" => "lnkservicetoci",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("service_id", array("targetclass"=>"Service", "jointype"=>null, "allowed_values"=>null, "sql"=>"service_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("service_name", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("ci_id", array("targetclass"=>"FunctionalCI", "jointype"=>null, "allowed_values"=>null, "sql"=>"ci_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ci_name", array("allowed_values"=>null, "extkey_attcode"=>"ci_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ci_status", array("allowed_values"=>null, "extkey_attcode"=>"ci_id", "target_attcode"=>"status", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('service_id', 'ci_id', 'ci_status'));
MetaModel::Init_SetZListItems('advanced_search', array('service_id', 'ci_id', 'ci_status'));
MetaModel::Init_SetZListItems('standard_search', array('service_id', 'ci_id', 'ci_status'));
MetaModel::Init_SetZListItems('list', array('service_id', 'ci_id', 'ci_status'));
}
}
//////////////////////////////////////////////////////////////////////////////
// Menu:
// +----------------------------------------+
// | My Module |
// +----------------------------------------+
// + All items
// + ...
// + ...
////////////////////////////////////////////////////////////////////////////////////
$oServiceManagementGroup = new MenuGroup('ServiceManagement', 60 /* fRank */);
$iRank = 0;
new TemplateMenuNode('Service:Overview', dirname(__FILE__).'/overview.html', $oServiceManagementGroup->GetIndex() /* oParent */, $iRank++ /* fRank */);
new OQLMenuNode('ProviderContract', 'SELECT ProviderContract', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('CustomerContract', 'SELECT CustomerContract', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('Service', 'SELECT Service', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('ServiceSubcategory', 'SELECT ServiceSubcategory', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('SLA', 'SELECT SLA', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
new OQLMenuNode('SLT', 'SELECT SLT', $oServiceManagementGroup->GetIndex(), $iRank++,true /* bsearch */);
?>

View File

@@ -22,6 +22,7 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'model.itop-service-mgmt.php',
'main.itop-service-mgmt.php',
),
'data.struct' => array(
//'data.struct.itop-service-mgmt.xml',

View File

@@ -34,7 +34,7 @@ SetupWebPage::AddModule(
// Components
//
'datamodel' => array(
'model.itop-sla-computation.php'
'main.itop-sla-computation.php'
),
'webservice' => array(

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,79 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
class ProcessSLAResponseTicket implements iBackgroundProcess
{
public function GetPeriodicity()
{
return 2; // seconds
}
public function Process($iTimeLimit)
{
$oMyChange = new CMDBChange();
$oMyChange->Set("date", time());
$oMyChange->Set("userinfo", "Automatic updates");
$iChangeId = $oMyChange->DBInsertNoReload();
$aReport = array();
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'new\' AND tto_escalation_deadline <= NOW()'));
while ((time() < $iTimeLimit) && $oToEscalate = $oSet->Fetch())
{
$oToEscalate->ApplyStimulus('ev_timeout');
//$oToEscalate->Set('tto_escalation_deadline', null);
$oToEscalate->DBUpdateTracked($oMyChange, true);
$aReport['reached TTO ESCALATION deadline'][] = $oToEscalate->Get('ref');
}
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'assigned\' AND ttr_escalation_deadline <= NOW()'));
while ((time() < $iTimeLimit) && $oToEscalate = $oSet->Fetch())
{
$oToEscalate->ApplyStimulus('ev_timeout');
//$oToEscalate->Set('ttr_escalation_deadline', null);
$oToEscalate->DBUpdateTracked($oMyChange, true);
$aReport['reached TTR ESCALATION deadline'][] = $oToEscalate->Get('ref');
}
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'resolved\' AND closure_deadline <= NOW()'));
while ((time() < $iTimeLimit) && $oToEscalate = $oSet->Fetch())
{
$oToEscalate->ApplyStimulus('ev_close');
//$oToEscalate->Set('closure_deadline', null);
$oToEscalate->DBUpdateTracked($oMyChange, true);
$aReport['reached closure deadline'][] = $oToEscalate->Get('ref');
}
$aStringReport = array();
foreach ($aReport as $sOperation => $aTicketRefs)
{
if (count($aTicketRefs) > 0)
{
$aStringReport[] = $sOperation.': '.count($aTicketRefs).' {'.implode(', ', $aTicketRefs).'}';
}
}
if (count($aStringReport) == 0)
{
return "No ticket to process";
}
else
{
return "Some tickets reached the limit - ".implode('; ', $aStringReport);
}
}
}
?>

View File

@@ -1,674 +0,0 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Persistent classes for a CMDB
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
abstract class Ticket extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "",
"reconc_keys" => array("ref"),
"db_table" => "ticket",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("ref", array("allowed_values"=>null, "sql"=>"ref", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("title", array("allowed_values"=>null, "sql"=>"title", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeCaseLog("ticket_log", array("allowed_values"=>null, "sql"=>"ticket_log", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("start_date", array("allowed_values"=>null, "sql"=>"start_date", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("document_list", array("linked_class"=>"lnkTicketToDoc", "ext_key_to_me"=>"ticket_id", "ext_key_to_remote"=>"document_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ci_list", array("linked_class"=>"lnkTicketToCI", "ext_key_to_me"=>"ticket_id", "ext_key_to_remote"=>"ci_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("contact_list", array("linked_class"=>"lnkTicketToContact", "ext_key_to_me"=>"ticket_id", "ext_key_to_remote"=>"contact_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("incident_list", array("linked_class"=>"lnkTicketToIncident", "ext_key_to_me"=>"ticket_id", "ext_key_to_remote"=>"incident_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('ref', 'title', 'description', 'start_date', 'document_list', 'ci_list', 'contact_list','incident_list'));
MetaModel::Init_SetZListItems('advanced_search', array('finalclass', 'ref', 'title', 'start_date'));
MetaModel::Init_SetZListItems('standard_search', array('finalclass', 'ref', 'title', 'start_date'));
MetaModel::Init_SetZListItems('list', array('finalclass', 'ref', 'title', 'ticket_log', 'start_date'));
}
}
class lnkTicketToDoc extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,incidentmgmt,requestmgmt,changemgmt,problemmgmt,lnkticket",
"key_type" => "autoincrement",
"name_attcode" => "ticket_id",
"state_attcode" => "",
"reconc_keys" => array("ticket_id","document_id"),
"db_table" => "lnktickettodoc",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("ticket_id", array("targetclass"=>"Ticket", "jointype"=>null, "allowed_values"=>null, "sql"=>"ticket_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ticket_ref", array("allowed_values"=>null, "extkey_attcode"=>"ticket_id", "target_attcode"=>"ref", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("document_id", array("targetclass"=>"Document", "jointype"=>null, "allowed_values"=>null, "sql"=>"document_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("document_name", array("allowed_values"=>null, "extkey_attcode"=>"document_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('ticket_id', 'document_id'));
MetaModel::Init_SetZListItems('advanced_search', array('ticket_id', 'document_id'));
MetaModel::Init_SetZListItems('standard_search', array('ticket_id', 'document_id'));
MetaModel::Init_SetZListItems('list', array('ticket_id', 'document_id'));
}
}
class lnkTicketToContact extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,incidentmgmt,requestmgmt,changemgmt,problemmgmt,lnkticket",
"key_type" => "autoincrement",
"name_attcode" => "ticket_id",
"state_attcode" => "",
"reconc_keys" => array("ticket_id","contact_id"),
"db_table" => "lnktickettocontact",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("ticket_id", array("targetclass"=>"Ticket", "jointype"=>null, "allowed_values"=>null, "sql"=>"ticket_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ticket_ref", array("allowed_values"=>null, "extkey_attcode"=>"ticket_id", "target_attcode"=>"ref", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("contact_id", array("targetclass"=>"Contact", "jointype"=>null, "allowed_values"=>null, "sql"=>"contact_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("role", array("allowed_values"=>null, "sql"=>"role", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('ticket_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('advanced_search', array('ticket_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('standard_search', array('ticket_id', 'contact_id', 'contact_email', 'role'));
MetaModel::Init_SetZListItems('list', array('ticket_id', 'contact_id', 'contact_email', 'role'));
}
}
class lnkTicketToCI extends cmdbAbstractObject
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel,searchable,incidentmgmt,requestmgmt,changemgmt,problemmgmt,lnkticket",
"key_type" => "autoincrement",
"name_attcode" => "ticket_id",
"state_attcode" => "",
"reconc_keys" => array("ticket_id","ci_id"),
"db_table" => "lnktickettoci",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeExternalKey("ticket_id", array("targetclass"=>"Ticket", "jointype"=>null, "allowed_values"=>null, "sql"=>"ticket_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ticket_ref", array("allowed_values"=>null, "extkey_attcode"=>"ticket_id", "target_attcode"=>"ref", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("ci_id", array("targetclass"=>"FunctionalCI", "jointype"=>null, "allowed_values"=>null, "sql"=>"ci_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ci_name", array("allowed_values"=>null, "extkey_attcode"=>"ci_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("ci_status", array("allowed_values"=>null, "extkey_attcode"=>"ci_id", "target_attcode"=>"status", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("impact", array("allowed_values"=>null, "sql"=>"impact", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('ticket_id', 'ci_id', 'impact','ci_status'));
MetaModel::Init_SetZListItems('advanced_search', array('ticket_id', 'ci_id', 'ci_status'));
MetaModel::Init_SetZListItems('standard_search', array('ticket_id', 'ci_id', 'ci_status'));
MetaModel::Init_SetZListItems('list', array('ticket_id', 'ci_id', 'impact','ci_status'));
}
}
abstract class ResponseTicket extends Ticket
{
public static function Init()
{
$aParams = array
(
"category" => "bizmodel",
"key_type" => "autoincrement",
"name_attcode" => "ref",
"state_attcode" => "status",
"reconc_keys" => array("ref"),
"db_table" => "ticket_response",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('new,assigned,frozen,escalated_tto,escalated_ttr,resolved,closed'), "sql"=>"status", "default_value"=>"new", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("caller_id", array("targetclass"=>"Person", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Person WHERE org_id = :this->org_id'), "sql"=>"caller_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("caller_email", array("allowed_values"=>null, "extkey_attcode"=>"caller_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"Organization", "jointype"=>null, "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("allowed_values"=>null, "extkey_attcode"=>"org_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("service_id", array("targetclass"=>"Service", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Service AS s JOIN SLA AS sla ON sla.service_id=s.id JOIN lnkContractToSLA AS ln ON ln.sla_id=sla.id JOIN CustomerContract AS cc ON ln.contract_id=cc.id WHERE cc.org_id =:this->org_id'), "sql"=>"service_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("service_name", array("allowed_values"=>null, "extkey_attcode"=>"service_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("servicesubcategory_id", array("targetclass"=>"ServiceSubcategory", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT ServiceSubcategory WHERE service_id = :this->service_id'), "sql"=>"servicesubcategory_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("service_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("servicesubcategory_name", array("allowed_values"=>null, "extkey_attcode"=>"servicesubcategory_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("product", array("allowed_values"=>null, "sql"=>"product", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("impact", array("allowed_values"=>new ValueSetEnum('1,2,3'), "sql"=>"impact", "default_value"=>"1", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("urgency", array("allowed_values"=>new ValueSetEnum('1,2,3'), "sql"=>"urgency", "default_value"=>"1", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("priority", array("allowed_values"=>new ValueSetEnum('1,2,3'), "sql"=>"priority", "default_value"=>"1", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("workgroup_id", array("targetclass"=>"Team", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Team AS t JOIN CustomerContract AS cc ON cc.support_team_id=t.id JOIN lnkContractToSLA AS ln ON ln.contract_id=cc.id JOIN SLA AS sla ON ln.sla_id=sla.id WHERE sla.service_id = :this->service_id AND cc.org_id = :this->org_id'), "sql"=>"workgroup_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id","service_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("workgroup_name", array("allowed_values"=>null, "extkey_attcode"=>"workgroup_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("agent_id", array("targetclass"=>"Person", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Person AS p JOIN lnkTeamToContact AS l ON l.contact_id=p.id JOIN Team AS t ON l.team_id=t.id WHERE t.id = :this->workgroup_id'), "sql"=>"agent_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("workgroup_id"))));
MetaModel::Init_AddAttribute(new AttributeExternalField("agent_name", array("allowed_values"=>null, "extkey_attcode"=>"agent_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("agent_email", array("allowed_values"=>null, "extkey_attcode"=>"agent_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("related_problem_id", array("targetclass"=>"Problem", "jointype"=>null, "allowed_values"=>null, "sql"=>"related_problem_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("related_problem_ref", array("allowed_values"=>null, "extkey_attcode"=>"related_problem_id", "target_attcode"=>"ref", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalKey("related_change_id", array("targetclass"=>"Change", "jointype"=>null, "allowed_values"=>null, "sql"=>"related_change_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeExternalField("related_change_ref", array("allowed_values"=>null, "extkey_attcode"=>"related_change_id", "target_attcode"=>"ref", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("close_date", array("allowed_values"=>null, "sql"=>"close_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("last_update", array("allowed_values"=>null, "sql"=>"last_update", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("assignment_date", array("allowed_values"=>null, "sql"=>"assignment_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDateTime("resolution_date", array("allowed_values"=>null, "sql"=>"resolution_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDeadline("tto_escalation_deadline", array("allowed_values"=>null, "sql"=>"tto_escalation_deadline", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDeadline("ttr_escalation_deadline", array("allowed_values"=>null, "sql"=>"ttr_escalation_deadline", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDeadline("closure_deadline", array("allowed_values"=>null, "sql"=>"closure_deadline", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("resolution_code", array("allowed_values"=>new ValueSetEnum('fixed,duplicate,couldnotreproduce,irrelevant'), "sql"=>"resolution_code", "default_value"=>"fixed", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("solution", array("allowed_values"=>null, "sql"=>"solution", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("user_satisfaction", array("allowed_values"=>new ValueSetEnum('1,2,3,4'), "sql"=>"user_satisfaction", "default_value"=>"1", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeText("user_commment", array("allowed_values"=>null, "sql"=>"user_commment", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'start_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'document_list', 'ci_list', 'contact_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
MetaModel::Init_SetZListItems('advanced_search', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
MetaModel::Init_SetZListItems('standard_search', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'close_date', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
MetaModel::Init_SetZListItems('list', array('finalclass', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'priority', 'workgroup_id', 'agent_id', 'last_update'));
// Lifecycle
MetaModel::Init_DefineState(
"new",
array(
"attribute_inherit" => null,
"attribute_list" => array(
'ref' => OPT_ATT_READONLY,
'caller_id' => OPT_ATT_MANDATORY,
'related_change_id' => OPT_ATT_HIDDEN,
'description' => OPT_ATT_MUSTCHANGE,
'start_date' => OPT_ATT_READONLY,
'last_update' => OPT_ATT_READONLY,
'assignment_date' => OPT_ATT_HIDDEN,
'resolution_date' => OPT_ATT_HIDDEN,
'tto_escalation_deadline' => OPT_ATT_READONLY,
'ttr_escalation_deadline' => OPT_ATT_HIDDEN,
'closure_deadline' => OPT_ATT_HIDDEN,
'close_date' => OPT_ATT_HIDDEN,
'org_id' => OPT_ATT_MUSTCHANGE,
'service_id' => OPT_ATT_MUSTCHANGE,
'servicesubcategory_id' => OPT_ATT_MUSTCHANGE,
'product' => OPT_ATT_MUSTPROMPT,
'impact' => OPT_ATT_MUSTCHANGE,
'urgency' => OPT_ATT_MUSTCHANGE,
'priority' => OPT_ATT_READONLY,
'workgroup_id' => OPT_ATT_MUSTCHANGE,
'agent_id' => OPT_ATT_NORMAL,
'agent_email' => OPT_ATT_HIDDEN,
'resolution_code' => OPT_ATT_HIDDEN,
'solution' => OPT_ATT_HIDDEN,
'user_satisfaction' => OPT_ATT_HIDDEN,
'related_problem_id' => OPT_ATT_HIDDEN,
'related_change_id' => OPT_ATT_HIDDEN,
'user_commment' => OPT_ATT_HIDDEN,
),
)
);
MetaModel::Init_DefineState(
"escalated_tto",
array(
"attribute_inherit" => 'new',
"attribute_list" => array(
),
)
);
MetaModel::Init_DefineState(
"assigned",
array(
"attribute_inherit" => 'new',
"attribute_list" => array(
'title' => OPT_ATT_READONLY,
'caller_id' => OPT_ATT_READONLY,
'org_id' => OPT_ATT_READONLY,
'ticket_log' => OPT_ATT_NORMAL,
'description' => OPT_ATT_READONLY,
'agent_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
'agent_email' => OPT_ATT_READONLY,
'workgroup_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
'tto_escalation_deadline' => OPT_ATT_HIDDEN,
'ttr_escalation_deadline' => OPT_ATT_READONLY,
'related_problem_id' => OPT_ATT_NORMAL,
'related_change_id' => OPT_ATT_NORMAL,
),
)
);
MetaModel::Init_DefineState(
"escalated_ttr",
array(
"attribute_inherit" => 'assigned',
"attribute_list" => array(
// MUST_PROMPT is not inherited...but does that make sense
'agent_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
'workgroup_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
),
)
);
MetaModel::Init_DefineState(
"frozen",
array(
"attribute_inherit" => 'assigned',
"attribute_list" => array(
),
)
);
MetaModel::Init_DefineState(
"resolved",
array(
"attribute_inherit" => 'assigned',
"attribute_list" => array(
'service_id' => OPT_ATT_READONLY,
'servicesubcategory_id' => OPT_ATT_READONLY,
'product' => OPT_ATT_READONLY,
'impact' => OPT_ATT_READONLY,
'workgroup_id' => OPT_ATT_READONLY,
'agent_id' => OPT_ATT_READONLY,
'urgency' => OPT_ATT_READONLY,
'resolution_code' => OPT_ATT_MUSTPROMPT,
'solution' => OPT_ATT_MUSTPROMPT,
'closure_deadline' => OPT_ATT_READONLY,
'ttr_escalation_deadline' => OPT_ATT_HIDDEN,
),
)
);
MetaModel::Init_DefineState(
"closed",
array(
"attribute_inherit" => 'resolved',
"attribute_list" => array(
'ticket_log' => OPT_ATT_READONLY,
'user_satisfaction' => OPT_ATT_MUSTPROMPT,
'user_commment' => OPT_ATT_MUSTPROMPT,
'resolution_code' => OPT_ATT_READONLY,
'solution' => OPT_ATT_READONLY,
'close_date' => OPT_ATT_READONLY,
'closure_deadline' => OPT_ATT_HIDDEN,
),
)
);
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_assign", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_reassign", array()));
MetaModel::Init_DefineStimulus(new StimulusInternal("ev_timeout", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_resolve", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_close", array()));
MetaModel::Init_DefineTransition("new", "ev_assign", array("target_state"=>"assigned", "actions"=>array('SetAssignedDate'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("new", "ev_timeout", array("target_state"=>"escalated_tto", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("escalated_tto", "ev_assign", array("target_state"=>"assigned", "actions"=>array('SetAssignedDate'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("assigned", "ev_reassign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("assigned", "ev_timeout", array("target_state"=>"escalated_ttr", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("assigned", "ev_resolve", array("target_state"=>"resolved", "actions"=>array('SetResolveDate','SetClosureDeadline'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("escalated_ttr", "ev_reassign", array("target_state"=>"escalated_ttr", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("escalated_ttr", "ev_resolve", array("target_state"=>"resolved", "actions"=>array('SetResolveDate','SetClosureDeadline'), "user_restriction"=>null));
MetaModel::Init_DefineTransition("resolved", "ev_reassign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
MetaModel::Init_DefineTransition("resolved", "ev_close", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
}
// Lifecycle actions
//
public function SetClosureDeadline($sStimulusCode)
{
$iMaxWaitHours = 24;
$this->Set('closure_deadline', time() + $iMaxWaitHours * 3600);
return true;
}
public function SetAssignedDate($sStimulusCode)
{
$this->Set('assignment_date', time());
return true;
}
public function SetResolveDate($sStimulusCode)
{
$this->Set('resolution_date', time());
return true;
}
public function SetClosureDate($sStimulusCode)
{
$this->Set('close_date', time());
return true;
}
/**
* Determines the shortest SLT, for this ticket, for the given metric. Returns null is no SLT was found
* @param string $sMetric Type of metric 'TTO', 'TTR', etc as defined in the SLT class
* @return hash Array with 'SLT' => name of the SLT selected, 'value' => duration in seconds of the SLT metric, null if no SLT applies to this ticket
*/
public function ComputeSLT($sMetric = 'TTO')
{
$aResult = null;
if (MetaModel::IsValidClass('SLT'))
{
$sOQL = "SELECT SLT JOIN lnkSLTToSLA AS L1 ON L1.slt_id=SLT.id JOIN SLA ON L1.sla_id = SLA.id JOIN lnkContractToSLA AS L2 ON L2.sla_id = SLA.id JOIN CustomerContract ON L2.contract_id = CustomerContract.id
WHERE SLT.ticket_priority = :priority AND SLA.service_id = :service_id AND SLT.metric = :metric AND CustomerContract.org_id = :org_id";
$oSLTSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
array(),
array(
'priority' => $this->Get('priority'),
'service_id' => $this->Get('service_id'),
'metric' => $sMetric,
'org_id' => $this->Get('org_id'),
)
);
$iMinDuration = PHP_INT_MAX;
$sSLTName = '';
while($oSLT = $oSLTSet->Fetch())
{
$iDuration = (int)$oSLT->Get('value');
$sUnit = $oSLT->Get('value_unit');
//echo "<p>Found SLT: ".$oSLT->GetName()." - $iDuration ($sUnit)</p>\n";
switch($sUnit)
{
case 'days':
$iDuration = $iDuration * 24; // 24 hours in 1 days
// Fall though
case 'hours':
$iDuration = $iDuration * 60; // 60 minutes in 1 hour
// Fall though
case 'minutes':
$iDuration = $iDuration * 60;
}
if ($iDuration < $iMinDuration)
{
$iMinDuration = $iDuration;
$sSLTName = $oSLT->GetName();
}
}
if ($iMinDuration == PHP_INT_MAX)
{
$aResult = null;
}
else
{
$aResult = array('SLT' => $sSLTName, 'value' => $iMinDuration);
}
}
return $aResult;
}
/**
* Compute the priority of the ticket based on its impact and urgency
* @return integer The priority of the ticket 1(high) .. 3(low)
*/
public function ComputePriority()
{
// priority[impact][urgency]
$aPriorities = array(
// single person
1 => array(
1 => 1,
2 => 1,
3 => 2,
),
// a group
2 => array(
1 => 1,
2 => 2,
3 => 3,
),
// a departement!
3 => array(
1 => 2,
2 => 3,
3 => 3,
),
);
$iPriority = $aPriorities[(int)$this->Get('impact')][(int)$this->Get('urgency')];
return $iPriority;
}
public function ComputeValues()
{
// Compute the priority of the ticket
$this->Set('priority', $this->ComputePriority());
// Compute the SLA deadlines, if any is applicable to this ticket
$aSLT = $this->ComputeSLT('TTO');
if ($aSLT != null)
{
$oStartDate = new DateTime($this->Get('start_date'));
$oDeadline = SLAComputation::GetDeadline($this, $aSLT['value'], $oStartDate);
$this->Set('tto_escalation_deadline', $oDeadline->format('U'));
}
else
{
$this->Set('tto_escalation_deadline', null);
}
$aSLT = $this->ComputeSLT('TTR');
if ($aSLT != null)
{
$oStartDate = new DateTime($this->Get('start_date'));
$oDeadline = SLAComputation::GetDeadline($this, $aSLT['value'], $oStartDate);
$this->Set('ttr_escalation_deadline', $oDeadline->format('U'));
}
else
{
$this->Set('ttr_escalation_deadline', null);
}
}
/**
* Determines if the ticket must be hilighted in the list, if we're about to miss a SLA for instance
*/
public function GetHilightClass()
{
$sHilightClass = '';
switch($this->GetState())
{
case 'new':
$oEscalationDeadline = $this->Get('tto_escalation_deadline');
if ($oEscalationDeadline != null)
{
// A SLA is running
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
$iEscalationDeadline = AttributeDateTime::GetAsUnixSeconds($oEscalationDeadline);
$ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate);
if ($ratio <= 0)
{
$sHilightClass = HILIGHT_CLASS_CRITICAL;
}
else if ($ratio <= 0.25)
{
$sHilightClass = HILIGHT_CLASS_WARNING;
}
}
break;
case 'assigned':
$oEscalationDeadline = $this->Get('ttr_escalation_deadline');
if ($oEscalationDeadline != null)
{
// A SLA is running
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
$iEscalationDeadline = AttributeDateTime::GetAsUnixSeconds($oEscalationDeadline);
$ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate);
if ($ratio <= 0)
{
$sHilightClass = HILIGHT_CLASS_CRITICAL;
}
else if ($ratio <= 0.25)
{
$sHilightClass = HILIGHT_CLASS_WARNING;
}
}
break;
case 'escalated_tto':
case 'escalated_ttr':
$sHilightClass = HILIGHT_CLASS_CRITICAL;
break;
}
return $sHilightClass;
}
protected function OnInsert()
{
$this->Set('last_update', time());
}
protected function OnUpdate()
{
$this->Set('last_update', time());
}
/*
EXAMPLE: OnInsert....
protected function OnInsert()
{
// Romain: ajouter cette ligne
$oToNotify = $this->Get('contacts_a_notifier');
// Romain: ca c'etait pour verifier que ca fonctionne bien
// $oFirstContact = MetaModel::GetObject('bizPerson', 6);
// $oNewLink = new lnkContactTicket();
// $oNewLink->Set('contact_id', 6);
// $oNewLink->Set('role', 'created before');
// $oToNotify->AddObject($oNewLink);
$oImpactedInfras = DBObjectSet::FromLinkSet($this, 'impacted_infra_manual', 'ci_id');
$aComputed = $oImpactedInfras->GetRelatedObjects('impacts', 10);
if (array_key_exists('logRealObject', $aComputed))
{
foreach($aComputed['logRealObject'] as $iKey => $oObject)
{
if (MetaModel::IsParentClass('bizContact', get_class($oObject)))
{
$oNewLink = new lnkContactTicket();
$oNewLink->Set('contact_id', $iKey);
//$oNewLink->Set('ticket_id', $this->GetKey()); // unkown at that time!
$oNewLink->Set('role', 'contact automatically computed');
// Romain: transformer cette ligne
$oToNotify->AddObject($oNewLink);
}
}
// Romain: supprimer cette ligne
// $this->Set('contacts_a_notifier', $oToNotify);
}
}
*/
}
class ProcessSLAResponseTicket implements iBackgroundProcess
{
public function GetPeriodicity()
{
return 2; // seconds
}
public function Process($iTimeLimit)
{
$oMyChange = new CMDBChange();
$oMyChange->Set("date", time());
$oMyChange->Set("userinfo", "Automatic updates");
$iChangeId = $oMyChange->DBInsertNoReload();
$aReport = array();
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'new\' AND tto_escalation_deadline <= NOW()'));
while ((time() < $iTimeLimit) && $oToEscalate = $oSet->Fetch())
{
$oToEscalate->ApplyStimulus('ev_timeout');
//$oToEscalate->Set('tto_escalation_deadline', null);
$oToEscalate->DBUpdateTracked($oMyChange, true);
$aReport['reached TTO ESCALATION deadline'][] = $oToEscalate->Get('ref');
}
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'assigned\' AND ttr_escalation_deadline <= NOW()'));
while ((time() < $iTimeLimit) && $oToEscalate = $oSet->Fetch())
{
$oToEscalate->ApplyStimulus('ev_timeout');
//$oToEscalate->Set('ttr_escalation_deadline', null);
$oToEscalate->DBUpdateTracked($oMyChange, true);
$aReport['reached TTR ESCALATION deadline'][] = $oToEscalate->Get('ref');
}
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'resolved\' AND closure_deadline <= NOW()'));
while ((time() < $iTimeLimit) && $oToEscalate = $oSet->Fetch())
{
$oToEscalate->ApplyStimulus('ev_close');
//$oToEscalate->Set('closure_deadline', null);
$oToEscalate->DBUpdateTracked($oMyChange, true);
$aReport['reached closure deadline'][] = $oToEscalate->Get('ref');
}
$aStringReport = array();
foreach ($aReport as $sOperation => $aTicketRefs)
{
if (count($aTicketRefs) > 0)
{
$aStringReport[] = $sOperation.': '.count($aTicketRefs).' {'.implode(', ', $aTicketRefs).'}';
}
}
if (count($aStringReport) == 0)
{
return "No ticket to process";
}
else
{
return "Some tickets reached the limit - ".implode('; ', $aStringReport);
}
}
}
?>

View File

@@ -23,6 +23,7 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'model.itop-tickets.php',
'main.itop-tickets.php',
),
'data.struct' => array(
'data.struct.ta-actions.xml',

View File

@@ -21,7 +21,7 @@ SetupWebPage::AddModule(
// Components
//
'datamodel' => array(
'model.itop-welcome-itil.php',
'main.itop-welcome-itil.php',
),
'webservice' => array(
//'webservices.itop-welcome-itil.php',