Pārlūkot izejas kodu

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1764 a333f486-631f-4898-b8df-5754b55c2be0
romainq 13 gadi atpakaļ
vecāks
revīzija
2e4edcbe9a
43 mainītis faili ar 466 papildinājumiem un 4778 dzēšanām
  1. 96 0
      modules/itop-attachments/datamodel.itop-attachments.xml
  2. 0 141
      modules/itop-attachments/main.attachments.php
  3. 2 1
      modules/itop-attachments/module.attachments.php
  4. 0 52
      modules/itop-basic-1.0.0/disabled.module.itop-basic.php
  5. 0 51
      modules/itop-basic-1.0.0/en.dict.itop-basic.php
  6. 0 51
      modules/itop-basic-1.0.0/es_cr.dict.itop-basic.php
  7. 0 51
      modules/itop-basic-1.0.0/pt_br.dict.itop-basic.php
  8. 8 0
      modules/itop-change-mgmt-1.0.0/datamodel.itop-change-mgmt.xml
  9. 30 0
      modules/itop-change-mgmt-1.0.0/main.itop-change-mgmt.php
  10. 0 589
      modules/itop-change-mgmt-1.0.0/model.itop-change-mgmt.php
  11. 1 0
      modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php
  12. 8 0
      modules/itop-config-mgmt-1.0.0/datamodel.itop-config-mgmt.xml
  13. 72 0
      modules/itop-config-mgmt-1.0.0/main.itop-config-mgmt.php
  14. 0 1646
      modules/itop-config-mgmt-1.0.0/model.itop-config-mgmt.php
  15. 1 0
      modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php
  16. 8 0
      modules/itop-incident-mgmt-1.0.0/datamodel.itop-incident-mgmt.xml
  17. 29 0
      modules/itop-incident-mgmt-1.0.0/main.itop-incident-mgmt.php
  18. 0 251
      modules/itop-incident-mgmt-1.0.0/model.itop-incident-mgmt.php
  19. 1 0
      modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php
  20. 3 0
      modules/itop-knownerror-mgmt-1.0.0/datamodel.itop-knownerror-mgmt.xml
  21. 6 8
      modules/itop-knownerror-mgmt-1.0.0/main.itop-knownerror-mgmt.php
  22. 0 175
      modules/itop-knownerror-mgmt-1.0.0/model.itop-knownerror-mgmt.php
  23. 1 0
      modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php
  24. 8 0
      modules/itop-problem-mgmt-1.0.0/datamodel.itop-problem-mgmt.xml
  25. 26 0
      modules/itop-problem-mgmt-1.0.0/main.itop-problem-mgmt.php
  26. 0 254
      modules/itop-problem-mgmt-1.0.0/model.itop-problem-mgmt.php
  27. 1 0
      modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php
  28. 8 0
      modules/itop-request-mgmt-1.0.0/datamodel.itop-request-mgmt.xml
  29. 30 0
      modules/itop-request-mgmt-1.0.0/main.itop-request-mgmt.php
  30. 0 213
      modules/itop-request-mgmt-1.0.0/model.itop-request-mgmt.php
  31. 1 0
      modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php
  32. 8 0
      modules/itop-service-mgmt-1.0.0/datamodel.itop-service-mgmt.xml
  33. 27 0
      modules/itop-service-mgmt-1.0.0/main.itop-service-mgmt.php
  34. 0 619
      modules/itop-service-mgmt-1.0.0/model.itop-service-mgmt.php
  35. 1 0
      modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php
  36. 0 0
      modules/itop-sla-computation/main.itop-sla-computation.php
  37. 1 1
      modules/itop-sla-computation/module.itop-sla-computation.php
  38. 8 0
      modules/itop-tickets-1.0.0/datamodel.itop-tickets.xml
  39. 79 0
      modules/itop-tickets-1.0.0/main.itop-tickets.php
  40. 0 674
      modules/itop-tickets-1.0.0/model.itop-tickets.php
  41. 1 0
      modules/itop-tickets-1.0.0/module.itop-tickets.php
  42. 0 0
      modules/itop-welcome-itil/main.itop-welcome-itil.php
  43. 1 1
      modules/itop-welcome-itil/module.itop-welcome-itil.php

+ 96 - 0
modules/itop-attachments/datamodel.itop-attachments.xml

@@ -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>

+ 0 - 141
modules/itop-attachments/model.attachments.php → modules/itop-attachments/main.attachments.php

@@ -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)

+ 2 - 1
modules/itop-attachments/module.attachments.php

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

+ 0 - 52
modules/itop-basic-1.0.0/disabled.module.itop-basic.php

@@ -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(
-		),
-	)
-);
-
-?>

+ 0 - 51
modules/itop-basic-1.0.0/en.dict.itop-basic.php

@@ -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>+
-
-?>

+ 0 - 51
modules/itop-basic-1.0.0/es_cr.dict.itop-basic.php

@@ -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>+
-
-?>

+ 0 - 51
modules/itop-basic-1.0.0/pt_br.dict.itop-basic.php

@@ -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>+
-
-?>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 8 - 0
modules/itop-change-mgmt-1.0.0/datamodel.itop-change-mgmt.xml


+ 30 - 0
modules/itop-change-mgmt-1.0.0/main.itop-change-mgmt.php

@@ -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'));
+?>

+ 0 - 589
modules/itop-change-mgmt-1.0.0/model.itop-change-mgmt.php

@@ -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'));
-?>

+ 1 - 0
modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php

@@ -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',

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 8 - 0
modules/itop-config-mgmt-1.0.0/datamodel.itop-config-mgmt.xml


+ 72 - 0
modules/itop-config-mgmt-1.0.0/main.itop-config-mgmt.php

@@ -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 */);
+
+?>

+ 0 - 1646
modules/itop-config-mgmt-1.0.0/model.itop-config-mgmt.php

@@ -1,1646 +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
- */
-
-
-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"));
-
-class Organization extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,structure",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name"),
-			"db_table" => "organization",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-		);
-		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 AttributeString("code", array("allowed_values"=>null, "sql"=>"code", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('active,inactive'), "sql"=>"status", "default_value"=>"active", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeHierarchicalKey("parent_id", array("allowed_values"=>null, "sql"=>"parent_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("parent_name", array("allowed_values"=>null, "extkey_attcode"=>"parent_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'code', 'status', 'parent_id'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'code', 'status'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'code', 'status', 'parent_id'));
-		MetaModel::Init_SetZListItems('list', array('status', 'parent_id'));
-	}
-}
-class Location extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,structure",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name", "org_id", "org_name"),
-			"db_table" => "location",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/location.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 AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('active,inactive'), "sql"=>"status", "default_value"=>"active", "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_MANUAL, "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 AttributeText("address", array("allowed_values"=>null, "sql"=>"address", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("postal_code", array("allowed_values"=>null, "sql"=>"postal_code", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("city", array("allowed_values"=>null, "sql"=>"city", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("country", array("allowed_values"=>null, "sql"=>"country", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeHierarchicalKey("parent_id", array("allowed_values"=>new ValueSetObjects('SELECT Location AS L WHERE L.org_id = :this->org_id'), "sql"=>"parent_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("parent_name", array("allowed_values"=>null, "extkey_attcode"=>"parent_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("contact_list", array("linked_class"=>"Contact", "ext_key_to_me"=>"location_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("infra_list", array("linked_class"=>"InfrastructureCI", "ext_key_to_me"=>"location_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'address', 'postal_code', 'city', 'country', 'parent_id', 'contact_list', 'infra_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'country'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'city', 'country', 'parent_id'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'city', 'country'));
-	}
-}
-abstract class Contact extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,structure",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id", "org_name", "email"),
-			"db_table" => "contact",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/team.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 AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('active,inactive'), "sql"=>"status", "default_value"=>"active", "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_MANUAL, "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 AttributeEmailAddress("email", array("allowed_values"=>null, "sql"=>"email", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("phone", array("allowed_values"=>null, "sql"=>"phone", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("location_id", array("targetclass"=>"Location", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Location AS L WHERE L.org_id = :this->org_id'), "sql"=>"location_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array('org_id'))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("location_name", array("allowed_values"=>null, "extkey_attcode"=>"location_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("contract_list", array("linked_class"=>"lnkContractToContact", "ext_key_to_me"=>"contact_id", "ext_key_to_remote"=>"contract_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("service_list", array("linked_class"=>"lnkServiceToContact", "ext_key_to_me"=>"contact_id", "ext_key_to_remote"=>"service_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ticket_list", array("linked_class"=>"lnkTicketToContact", "ext_key_to_me"=>"contact_id", "ext_key_to_remote"=>"ticket_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ci_list", array("linked_class"=>"lnkCIToContact", "ext_key_to_me"=>"contact_id", "ext_key_to_remote"=>"ci_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("team_list", array("linked_class"=>"lnkTeamToContact", "ext_key_to_me"=>"contact_id", "ext_key_to_remote"=>"team_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'email', 'phone', 'location_id', 'contract_list', 'service_list', 'ticket_list', 'ci_list', 'team_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'email', 'phone', 'location_id'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'email', 'phone', 'location_id'));
-		MetaModel::Init_SetZListItems('list', array('finalclass', 'status', 'org_id', 'email', 'phone', 'location_id'));
-	}
-}
-class Person extends Contact
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,structure",
-			"key_type" => "autoincrement",
-			"name_attcode" => array('first_name', 'name'),
-			"state_attcode" => "",
-			"reconc_keys" => array("name","first_name","org_id","email"),
-			"db_table" => "person",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/person.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeString("first_name", array("allowed_values"=>null, "sql"=>"first_name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("employee_id", array("allowed_values"=>null, "sql"=>"employee_id", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name','first_name', 'org_id', 'status', 'location_id', 'email', 'phone', 'employee_id','team_list', 'contract_list', 'service_list', 'ticket_list', 'ci_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'email', 'phone', 'location_id', 'first_name', 'employee_id'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'email', 'phone', 'location_id', 'first_name', 'employee_id'));
-		MetaModel::Init_SetZListItems('list', array('name','first_name','status', 'org_id', 'email', 'phone', 'location_id'));
-	}
-}
-class Team extends Contact
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,structure",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name", "org_id"),
-			"db_table" => "team",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/team.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("member_list", array("linked_class"=>"lnkTeamToContact", "ext_key_to_me"=>"team_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', 'status', 'org_id', 'location_id', 'email', 'phone', 'member_list', 'contract_list', 'service_list', 'ticket_list', 'ci_list', 'team_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'email', 'phone', 'location_id'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'email', 'phone', 'location_id'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'email', 'phone', 'location_id'));
-	}
-}
-class lnkTeamToContact extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,structure",
-			"key_type" => "autoincrement",
-			"name_attcode" => "team_id",
-			"state_attcode" => "",
-			"reconc_keys" => array(),
-			"db_table" => "lnkteamtocontact",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("team_id", array("targetclass"=>"Team", "jointype"=>null, "allowed_values"=>null, "sql"=>"team_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("team_name", array("allowed_values"=>null, "extkey_attcode"=>"team_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_location_id", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"location_id", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("contact_location_name", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"location_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 AttributeExternalField("contact_phone", array("allowed_values"=>null, "extkey_attcode"=>"contact_id", "target_attcode"=>"phone", "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('team_id', 'contact_id', 'role'));
-		MetaModel::Init_SetZListItems('advanced_search', array('team_id', 'contact_id', 'role'));
-		MetaModel::Init_SetZListItems('standard_search', array('team_id', 'contact_id', 'role'));
-		MetaModel::Init_SetZListItems('list', array('team_id', 'contact_id', 'contact_location_id', 'contact_email', 'contact_phone', 'role'));
-	}
-}
-abstract class Document extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,documentation",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","org_name"),
-			"db_table" => "document",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/document.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", "jointype"=>null, "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "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 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('contract,networkmap,presentation,training,whitePaper,workinginstructions'), "sql"=>"type", "default_value"=>"presentation", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('draft,published,obsolete'), "sql"=>"status", "default_value"=>"draft", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("contract_list", array("linked_class"=>"lnkContractToDoc", "ext_key_to_me"=>"document_id", "ext_key_to_remote"=>"contract_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("service_list", array("linked_class"=>"lnkServiceToDoc", "ext_key_to_me"=>"document_id", "ext_key_to_remote"=>"service_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ticket_list", array("linked_class"=>"lnkTicketToDoc", "ext_key_to_me"=>"document_id", "ext_key_to_remote"=>"ticket_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ci_list", array("linked_class"=>"lnkCIToDoc", "ext_key_to_me"=>"document_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', 'org_id', 'description', 'type', 'status', 'contract_list', 'service_list', 'ticket_list', 'ci_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'org_id', 'description', 'type', 'status'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'org_id', 'description', 'type', 'status'));
-		MetaModel::Init_SetZListItems('list', array('org_id', 'type', 'status'));
-	}
-}
-class WebDoc extends Document
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,documentation",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","org_name"),
-			"db_table" => "externaldoc",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/document.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeURL("url", array("target"=>"_blank", "allowed_values"=>null, "sql"=>"url", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'org_id', 'description', 'type', 'status', 'contract_list', 'service_list', 'ticket_list', 'ci_list', 'url'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'org_id', 'description', 'type', 'status', 'url'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'org_id', 'description', 'type', 'status', 'url'));
-		MetaModel::Init_SetZListItems('list', array('org_id', 'type', 'status', 'url'));
-	}
-}
-class Note extends Document
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,documentation",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","org_name"),
-			"db_table" => "note",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/document.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeText("note", array("allowed_values"=>null, "sql"=>"note", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'org_id', 'description', 'type', 'status', 'contract_list', 'service_list', 'ticket_list', 'ci_list', 'note'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'org_id', 'description', 'type', 'status', 'note'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'org_id', 'description', 'type', 'status', 'note'));
-		MetaModel::Init_SetZListItems('list', array('org_id', 'type', 'status', 'note'));
-	}
-}
-class FileDoc extends Document
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,documentation",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","org_name"),
-			"db_table" => "filedoc",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/document.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeBlob("contents", array("depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'org_id', 'description', 'type', 'status', 'contract_list', 'service_list', 'ticket_list', 'ci_list', 'contents'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'org_id', 'description', 'type', 'status'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'org_id', 'description', 'type', 'status'));
-		MetaModel::Init_SetZListItems('list', array('org_id', 'type', 'status', 'contents'));
-	}
-	
-	/**
-	 * Overload the display of the properties to add a tab (the first one)
-	 * with the preview of the document
-	 */
-	public function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array())
-	{
-		if (!$bEditMode)
-		{
-			$oPage->SetCurrentTab(Dict::S('Class:Document:PreviewTab'));
-			$oPage->add($this->DisplayDocumentInline($oPage, 'contents'));
-			$oPage->SetCurrentTab(Dict::S('UI:PropertiesTab'));
-		}
-		parent::DisplayBareProperties($oPage, $bEditMode, $sPrefix, $aExtraParams);
-		
-	}
-}
-class Licence extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id", "org_name"),
-			"db_table" => "licence",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/licence.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeString("provider", array("allowed_values"=>null, "sql"=>"provider", "default_value"=>"", "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_MANUAL, "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 AttributeString("product", array("allowed_values"=>null, "sql"=>"product", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
-		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 AttributeDate("start", array("allowed_values"=>null, "sql"=>"start", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeDate("end", array("allowed_values"=>null, "sql"=>"end", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("licence_key", array("allowed_values"=>null, "sql"=>"licence_key", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeText("scope", array("allowed_values"=>null, "sql"=>"scope", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeInteger("usage_limit", array("allowed_values"=>null, "sql"=>"usage_limit", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("usage_list", array("linked_class"=>"SoftwareInstance", "ext_key_to_me"=>"licence_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name','org_id','provider', 'product', 'start', 'end', 'licence_key', 'scope', 'usage_limit', 'usage_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('provider', 'product', 'name', 'start', 'end', 'licence_key', 'scope'));
-		MetaModel::Init_SetZListItems('standard_search', array('org_id','provider', 'product', 'name', 'start', 'end', 'licence_key', 'scope'));
-		MetaModel::Init_SetZListItems('list', array('org_id','provider', 'product',  'start', 'end'));
-	}
-}
-class Subnet extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => array('ip', 'ip_mask'),
-			"state_attcode" => "",
-			"reconc_keys" => array("ip", "ip_mask","org_id", "org_name"),
-			"db_table" => "subnet",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/subnet.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 AttributeText("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "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_MANUAL, "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 AttributeIPAddress("ip", array("allowed_values"=>null, "sql"=>"ip", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeIPAddress("ip_mask", array("allowed_values"=>null, "sql"=>"ip_mask", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('ip', 'ip_mask', 'org_id', 'description'));
-		MetaModel::Init_SetZListItems('advanced_search', array('ip', 'ip_mask', 'org_id', 'description'));
-		MetaModel::Init_SetZListItems('standard_search', array('ip', 'ip_mask', 'org_id', 'description'));
-		MetaModel::Init_SetZListItems('list', array('ip', 'ip_mask', 'org_id'));
-	}
-
-	function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
-	{
-		parent::DisplayBareRelations($oPage, $bEditMode);
-
-		if (!$bEditMode)
-		{
-			$oPage->SetCurrentTab(Dict::S('Class:Subnet/Tab:IPUsage'));
-	
-			$bit_ip = ip2long($this->Get('ip'));
-			$bit_mask = ip2long($this->Get('ip_mask'));
-	
-			$iIPMin = sprintf('%u', ($bit_ip & $bit_mask) | 1); // exclude the first one: identifies the subnet itself
-			$iIPMax = sprintf('%u', (($bit_ip | (~$bit_mask))) & 0xfffffffe); // exclude the last one : broadcast address
-			
-			$sIPMin = long2ip($iIPMin);
-			$sIPMax = long2ip($iIPMax);
-	
-			$oPage->p(Dict::Format('Class:Subnet/Tab:IPUsage-explain', $sIPMin, $sIPMax));
-			
-			$oIfFilter = DBObjectSearch::FromOQL("SELECT NetworkInterface AS if WHERE INET_ATON(if.ip_address) >= INET_ATON('$sIPMin') AND INET_ATON(if.ip_address) <= INET_ATON('$sIPMax')");
-			$oIfSet = new CMDBObjectSet($oIfFilter);
-			$oBlock = new DisplayBlock($oIfFilter, 'list', false);
-			$oBlock->Display($oPage, 'nwif', array('menu' => false));
-	
-			$iCountUsed = $oIfSet->Count();
-			$iCountRange = $iIPMax - $iIPMin; // On 32-bit systems the substraction will be computed using floats for values greater than PHP_MAX_INT;
-			$iFreeCount =  $iCountRange - $iCountUsed;
-	
-			$oPage->SetCurrentTab(Dict::S('Class:Subnet/Tab:FreeIPs'));
-			$oPage->p(Dict::Format('Class:Subnet/Tab:FreeIPs-count', $iFreeCount));
-			$oPage->p(Dict::S('Class:Subnet/Tab:FreeIPs-explain'));
-	
-			$aUsedIPs = $oIfSet->GetColumnAsArray('ip_address', false);
-			$iAnIP = $iIPMin;
-			$iFound = 0;
-			while (($iFound < min($iFreeCount, 10)) && ($iAnIP <= $iIPMax))
-			{
-				$sAnIP = long2ip($iAnIP);
-				if (!in_array($sAnIP, $aUsedIPs))
-				{
-					$iFound++;
-					$oPage->p($sAnIP);
-				}
-				else
-				{
-				}
-				$iAnIP++;
-			}
-		}
-	}
-}
-class Patch extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name"),
-			"db_table" => "patch",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/patch.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 AttributeString("target_sw", array("allowed_values"=>null, "sql"=>"target_sw", "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 AttributeEnum("type", array("allowed_values"=>new ValueSetEnum('application,os,security,servicepack'), "sql"=>"type", "default_value"=>"security", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ci_list", array("linked_class"=>"lnkPatchToCI", "ext_key_to_me"=>"patch_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', 'target_sw', 'version', 'type', 'ci_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'target_sw', 'version', 'type'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'target_sw', 'version', 'type','description'));
-		MetaModel::Init_SetZListItems('list', array('target_sw', 'version', 'type'));
-	}
-}
-abstract class Software extends cmdbAbstractObject
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name"),
-			"db_table" => "software",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/software.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_SetZListItems('details', array('name', 'description'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'description'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'description'));
-		MetaModel::Init_SetZListItems('list', array('description'));
-	}
-}
-class Application extends Software
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name"),
-			"db_table" => "software_app",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/software.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("instance_list", array("linked_class"=>"ApplicationInstance", "ext_key_to_me"=>"software_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'description', 'instance_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'description'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'description'));
-		MetaModel::Init_SetZListItems('list', array('description'));
-	}
-}
-class DBServer extends Software
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name"),
-			"db_table" => "software_db",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/software.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("instance_list", array("linked_class"=>"DBServerInstance", "ext_key_to_me"=>"software_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'description', 'instance_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'description'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'description'));
-		MetaModel::Init_SetZListItems('list', array('description'));
-	}
-}
-class lnkPatchToCI extends cmdbAbstractObject
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "patch_id",
-			"state_attcode" => "",
-			"reconc_keys" => array("patch_id","ci_id"),
-			"db_table" => "lnkpatchtoci",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("patch_id", array("targetclass"=>"Patch", "jointype"=>null, "allowed_values"=>null, "sql"=>"patch_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("patch_name", array("allowed_values"=>null, "extkey_attcode"=>"patch_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("ci_id", array("targetclass"=>"Device", "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('patch_id', 'ci_id', 'ci_status'));
-		MetaModel::Init_SetZListItems('advanced_search', array('patch_id', 'ci_id'));
-		MetaModel::Init_SetZListItems('standard_search', array('patch_id', 'ci_id'));
-		MetaModel::Init_SetZListItems('list', array('patch_id', 'ci_id', 'ci_status'));
-	}
-}
-abstract class FunctionalCI extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id", "owner_name"),
-			"db_table" => "functionalci",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/server.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 AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('implementation,production,obsolete'), "sql"=>"status", "default_value"=>"implementation", "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_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("owner_name", array("allowed_values"=>null, "extkey_attcode"=>"org_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("importance", array("allowed_values"=>new ValueSetEnum('low,medium,high'), "sql"=>"importance", "default_value"=>"medium", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("contact_list", array("linked_class"=>"lnkCIToContact", "ext_key_to_me"=>"ci_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"=>"lnkCIToDoc", "ext_key_to_me"=>"ci_id", "ext_key_to_remote"=>"document_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("solution_list", array("linked_class"=>"lnkSolutionToCI", "ext_key_to_me"=>"ci_id", "ext_key_to_remote"=>"solution_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("contract_list", array("linked_class"=>"lnkContractToCI", "ext_key_to_me"=>"ci_id", "ext_key_to_remote"=>"contract_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ticket_list", array("linked_class"=>"lnkTicketToCI", "ext_key_to_me"=>"ci_id", "ext_key_to_remote"=>"ticket_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance'));
-		MetaModel::Init_SetZListItems('list', array('finalclass', 'status', 'org_id', 'importance'));
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		switch ($sRelCode)
-		{
-		case "impacts":
-			$aRels = array(
-				"contact" => array("sQuery"=>"SELECT Contact AS c JOIN lnkCIToContact AS l1 ON l1.contact_id = c.id WHERE l1.ci_id = :this->id", "bPropagate"=>true, "iDistance"=>3),
-				"solution" => array("sQuery"=>"SELECT ApplicationSolution AS s JOIN lnkSolutionToCI AS l1 ON l1.solution_id = s.id WHERE l1.ci_id = :this->id", "bPropagate"=>true, "iDistance"=>2),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-		default:
-			return parent::GetRelationQueries($sRelCode);
-		}
-	}
-	
-}
-abstract class SoftwareInstance extends FunctionalCI
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => array('name', 'device_id_friendlyname'),
-			"state_attcode" => "",
-			"reconc_keys" => array("name", "device_id", "device_name", "org_id", "owner_name"),
-			"db_table" => "softwareinstance",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/application.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("device_id", array("targetclass"=>"Device", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Device WHERE org_id = :this->org_id'), "sql"=>"device_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("device_name", array("allowed_values"=>null, "extkey_attcode"=>"device_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("licence_id", array("targetclass"=>"Licence", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Licence WHERE org_id = :this->org_id'), "sql"=>"licence_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("licence_name", array("allowed_values"=>null, "extkey_attcode"=>"licence_id", "target_attcode"=>"name", "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 AttributeText("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'device_id', 'licence_id', 'version', 'description', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('status', 'org_id', 'importance', 'device_id', 'licence_id',  'version'));
-		MetaModel::Init_SetZListItems('standard_search', array('status', 'org_id', 'importance', 'device_id', 'licence_id', 'version'));
-		MetaModel::Init_SetZListItems('list', array('finalclass', 'status', 'org_id', 'importance', 'device_id', 'version'));
-	}
-
-	public function ComputeValues()
-	{
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		switch ($sRelCode)
-		{
-			case "impacts":
-			$aRels = array(
-				// Actually this should be limited to the Software instances based on a DBServer Application type...
-				"db_instances" => array("sQuery"=>"SELECT DatabaseInstance AS db WHERE db.db_server_instance_id = :this->id", "bPropagate"=>true, "iDistance"=>5),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-			
-			case 'depends on':
-			$aRels = array(
-				"applications" => array("sQuery"=>"SELECT Device JOIN SoftwareInstance AS app ON app.device_id = Device.id WHERE app.id = :this->id", "bPropagate"=>true, "iDistance"=>5),			
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-			
-			default:
-			return parent::GetRelationQueries($sRelCode);			
-		}
-	}
-}
-class DBServerInstance extends SoftwareInstance
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => array('name', 'device_id_friendlyname'),
-			"state_attcode" => "",
-			"reconc_keys" => array("name","software_id","software_name","device_id","device_name","org_id","owner_name"),
-			"db_table" => "softwareinstance_dbserver",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/database.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("software_id", array("targetclass"=>"DBServer", "jointype"=>null, "allowed_values"=>null, "sql"=>"software_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("software_name", array("allowed_values"=>null, "extkey_attcode"=>"software_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("dbinstance_list", array("linked_class"=>"DatabaseInstance", "ext_key_to_me"=>"db_server_instance_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'device_id', 'licence_id', 'software_id', 'version', 'description', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'dbinstance_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('status', 'org_id', 'importance', 'device_id', 'licence_id', 'software_id', 'version'));
-		MetaModel::Init_SetZListItems('standard_search', array('status', 'org_id', 'importance', 'device_id', 'licence_id', 'software_id', 'version'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'device_id', 'software_id', 'version'));
-	}
-}
-class ApplicationInstance extends SoftwareInstance
-{
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => array('name', 'device_id_friendlyname'),
-			"state_attcode" => "",
-			"reconc_keys" => array("name","software_id","software_name","device_id","device_name","org_id","owner_name"),
-			"db_table" => "softwareinstance_application",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/application.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("software_id", array("targetclass"=>"Application", "jointype"=>null, "allowed_values"=>null, "sql"=>"software_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("software_name", array("allowed_values"=>null, "extkey_attcode"=>"software_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'device_id', 'licence_id', 'software_id', 'version', 'description', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('status', 'org_id', 'importance', 'device_id', 'licence_id', 'software_id', 'version'));
-		MetaModel::Init_SetZListItems('standard_search', array('status', 'org_id', 'importance', 'device_id', 'licence_id', 'software_id', 'version'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'device_id', 'software_id', 'version'));
-	}
-}
-
-class DatabaseInstance extends FunctionalCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => array('name', 'db_server_instance_id_friendlyname'),
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name","db_server_instance_id","db_server_instance_name"),
-			"db_table" => "databaseinstance",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/database-instance.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("db_server_instance_id", array("targetclass"=>"DBServerInstance", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT DBServerInstance WHERE org_id = :this->org_id'), "sql"=>"db_server_instance_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("db_server_instance_name", array("allowed_values"=>null, "extkey_attcode"=>"db_server_instance_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("db_server_instance_version", array("allowed_values"=>null, "extkey_attcode"=>"db_server_instance_id", "target_attcode"=>"version", "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_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'db_server_instance_id', 'db_server_instance_version', 'description', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'db_server_instance_id', 'db_server_instance_version'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'db_server_instance_id', 'db_server_instance_version'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'db_server_instance_id', 'db_server_instance_version'));
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		switch ($sRelCode)
-		{
-			case "depends on":
-			$aRels = array(
-				"db_instances" => array("sQuery"=>"SELECT DBServerInstance AS db_server_inst JOIN DatabaseInstance AS db ON  db.db_server_instance_id = db_server_inst.id WHERE db.id = :this->id", "bPropagate"=>true, "iDistance"=>5),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-						
-			default:
-			return parent::GetRelationQueries($sRelCode);			
-		}
-	}
-}
-class Group extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name"),
-			"db_table" => "group",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/group.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 AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('production,implementation,obsolete'), "sql"=>"status", "default_value"=>"implementation", "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_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("owner_name", array("allowed_values"=>null, "extkey_attcode"=>"org_id", "target_attcode"=>"name", "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 AttributeString("type", array("allowed_values"=>null, "sql"=>"type", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeHierarchicalKey("parent_id", array("allowed_values"=>null, "sql"=>"parent_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("parent_name", array("allowed_values"=>null, "extkey_attcode"=>"parent_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("ci_list", array("linked_class"=>"lnkGroupToCI", "ext_key_to_me"=>"group_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', 'status', 'org_id', 'type','description', 'parent_id', 'ci_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'type'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'type'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'type','parent_id'));
-	}
-}
-class lnkGroupToCI extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "group_id",
-			"state_attcode" => "",
-			"reconc_keys" => array("group_id","ci_id"),
-			"db_table" => "lnkgrouptoci",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("group_id", array("targetclass"=>"Group", "jointype"=>null, "allowed_values"=>null, "sql"=>"group_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("group_name", array("allowed_values"=>null, "extkey_attcode"=>"group_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_MANUAL, "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("reason", array("allowed_values"=>null, "sql"=>"reason", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('group_id', 'ci_id', 'ci_status', 'reason'));
-		MetaModel::Init_SetZListItems('advanced_search', array('group_id', 'ci_id', 'reason'));
-		MetaModel::Init_SetZListItems('standard_search', array('group_id', 'ci_id', 'reason'));
-		MetaModel::Init_SetZListItems('list', array('group_id', 'ci_id', 'ci_status', 'reason'));
-	}
-}
-class ApplicationSolution extends FunctionalCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name"),
-			"db_table" => "applicationsolution",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/solution.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		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 AttributeLinkedSetIndirect("ci_list", array("linked_class"=>"lnkSolutionToCI", "ext_key_to_me"=>"solution_id", "ext_key_to_remote"=>"ci_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("process_list", array("linked_class"=>"lnkProcessToSolution", "ext_key_to_me"=>"solution_id", "ext_key_to_remote"=>"process_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'description', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'ci_list', 'process_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance'));
-	}
-	
-	public static function GetRelationQueries($sRelCode)
-	{
-		switch ($sRelCode)
-		{
-			case "impacts":
-			$aRels = array(
-				"process" => array("sQuery"=>"SELECT BusinessProcess AS p JOIN lnkProcessToSolution AS l1 ON l1.process_id = p.id WHERE l1.solution_id = :this->id", "bPropagate"=>true, "iDistance"=>3),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-			
-			case "depends on":
-			$aRels = array(
-				"solution" => array("sQuery"=>"SELECT FunctionalCI AS ci JOIN lnkSolutionToCI AS l1 ON l1.ci_id = ci.id WHERE l1.solution_id = :this->id", "bPropagate"=>true, "iDistance"=>2),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-						
-			default:
-			return parent::GetRelationQueries($sRelCode);			
-		}
-	}
-}
-class BusinessProcess extends FunctionalCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name"),
-			"db_table" => "businessprocess",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/business-process.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		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 AttributeLinkedSetIndirect("used_solution_list", array("linked_class"=>"lnkProcessToSolution", "ext_key_to_me"=>"process_id", "ext_key_to_remote"=>"solution_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'description', 'contact_list', 'document_list', 'contract_list', 'ticket_list', 'used_solution_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'description'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'description'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance'));
-	}
-	
-	public static function GetRelationQueries($sRelCode)
-	{
-		switch ($sRelCode)
-		{
-			case "depends on":
-			$aRels = array(
-				"solution" => array("sQuery"=>"SELECT ApplicationSolution AS app JOIN lnkProcessToSolution AS l1 ON l1.solution_id = app.id WHERE l1.process_id = :this->id", "bPropagate"=>true, "iDistance"=>3),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-			
-			default:
-			return parent::GetRelationQueries($sRelCode);			
-		}
-	}
-}
-abstract class ConnectableCI extends FunctionalCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name"),
-			"db_table" => "connectableci",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeString("brand", array("allowed_values"=>null, "sql"=>"brand", "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("serial_number", array("allowed_values"=>null, "sql"=>"serial_number", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("asset_ref", array("allowed_values"=>null, "sql"=>"asset_ref", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref'));
-		MetaModel::Init_SetZListItems('list', array('finalclass', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref'));
-	}
-}
-class NetworkInterface extends ConnectableCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => array('device_id_friendlyname', 'name'),
-			"state_attcode" => "",
-			"reconc_keys" => array("name","device_id","device_name","org_id"),
-			"db_table" => "networkinterface",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/interface.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("device_id", array("targetclass"=>"Device", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Device WHERE org_id = :this->org_id'), "sql"=>"device_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array("org_id"))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("device_name", array("allowed_values"=>null, "extkey_attcode"=>"device_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("logical_type", array("allowed_values"=>new ValueSetEnum('backup,logical,port,primary,secondary'), "sql"=>"logical_type", "default_value"=>"primary", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("physical_type", array("allowed_values"=>new ValueSetEnum('atm,ethernet,framerelay,vlan'), "sql"=>"physical_type", "default_value"=>"ethernet", "is_null_allowed"=>false, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeIPAddress("ip_address", array("allowed_values"=>null, "sql"=>"ip_address", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeIPAddress("ip_mask", array("allowed_values"=>null, "sql"=>"ip_mask", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-//		With a validation pattern for '00:1a:4b:68:e3:97'
-//		MetaModel::Init_AddAttribute(new AttributeString("mac_address", array("allowed_values"=>null, "sql"=>"mac_address", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array(), "validation_pattern"=>"^[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}$")));
-		MetaModel::Init_AddAttribute(new AttributeString("mac_address", array("allowed_values"=>null, "sql"=>"mac_address", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array(), "validation_pattern"=>"")));
-		MetaModel::Init_AddAttribute(new AttributeInteger("speed", array("allowed_values"=>null, "sql"=>"speed", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("duplex", array("allowed_values"=>new ValueSetEnum('full,half,auto,unknown'), "sql"=>"duplex", "default_value"=>"full", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("connected_if", array("targetclass"=>"NetworkInterface", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT NetworkInterface WHERE org_id = :this->org_id'), "sql"=>"connected_if", "is_null_allowed"=>true, "on_target_delete"=>DEL_AUTO, "depends_on"=>array("org_id"))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("connected_name", array("allowed_values"=>null, "extkey_attcode"=>"connected_if", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("connected_if_device_id", array("allowed_values"=>null, "extkey_attcode"=>"connected_if", "target_attcode"=>"device_id", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("connected_if_device_id_name", array("allowed_values"=>null, "extkey_attcode"=>"connected_if", "target_attcode"=>"device_name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("link_type", array("allowed_values"=>new ValueSetEnum('uplink,downlink'), "sql"=>"link_type", "default_value"=>"uplink", "is_null_allowed"=>false, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'device_id', 'logical_type', 'physical_type', 'ip_address', 'ip_mask', 'mac_address', 'speed', 'duplex', 'link_type', 'connected_if', 'connected_if_device_id', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'device_id', 'logical_type', 'physical_type', 'ip_address', 'ip_mask', 'mac_address', 'speed', 'duplex', 'connected_if', 'connected_if_device_id'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'device_id', 'logical_type', 'physical_type', 'ip_address', 'ip_mask', 'mac_address', 'connected_if_device_id'));
-		MetaModel::Init_SetZListItems('list', array('status', 'ip_address', 'importance', 'device_id', 'logical_type', 'physical_type', 'link_type', 'connected_if_device_id'));
-	}
-
-	public static function GetRelationQueries($sRelCode)
-	{
-		switch ($sRelCode)
-		{
-			case "impacts":
-			$aRels = array(
-				"connected_devices" => array("sQuery"=>"SELECT Device AS dev JOIN NetworkInterface AS if1 ON if1.device_id = dev.id JOIN NetworkInterface AS if2 ON if2.connected_if = if1.id WHERE if2.id = :this->id AND if2.link_type='downlink'", "bPropagate"=>true, "iDistance"=>5),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-			
-			default:
-			return parent::GetRelationQueries($sRelCode);			
-		}
-	}
-
-	protected function UpdateConnectedInterface()
-	{
-		$iPrevTargetIf = $this->m_aOrigValues['connected_if']; // The interface this interface was connected to
- 			
-		if ($iPrevTargetIf != 0)
-		{
-			// The interface was previosuly connected to another interface. Make sure that we reset this 'previously connected interface'
-			$oPrevConnectedIf = MetaModel::GetObject('NetworkInterface', $iPrevTargetIf, false);
-			if (!is_null($oPrevConnectedIf))
-			{
-				$oPrevConnectedIf->Set('connected_if', 0);			
-				// Need to backup the current change, because it is reset when DBUpdateTracked is complete
-				$oCurrChange = self::$m_oCurrChange;
-				$oPrevConnectedIf->DBUpdateTracked($oCurrChange);
-				self::$m_oCurrChange = $oCurrChange;
-			}
-		}
-
-		$oConnIf = MetaModel::GetObject('NetworkInterface', $this->Get('connected_if'), false /* no exception if not found */);
-		if (!is_null($oConnIf))
-		{
-			$sLink = $this->Get('link_type');
-			$sConnLink = ($sLink == 'uplink') ? 'downlink' : 'uplink';
-  
- 			if (($oConnIf->Get('connected_if') != $this->GetKey()) || ($sConnLink != $oConnIf->Get('link_type')))
-			{
-				// Something has to be changed on the connected interface...
-				if ($oConnIf->Get('connected_if') != $this->GetKey())
-				{
-					// It is connected to another interface: reset that third one...
-					$oThirdIf = MetaModel::GetObject('NetworkInterface', $oConnIf->Get('connected_if'), false);
-					if (!is_null($oThirdIf))
-					{
-						$oThirdIf->Set('connected_if', 0);			
-						// Need to backup the current change, because it is reset when DBUpdateTracked is complete
-						$oCurrChange = self::$m_oCurrChange;
-						$oThirdIf->DBUpdateTracked($oCurrChange);
-						self::$m_oCurrChange = $oCurrChange;
-					}
-				}
-				// Connect the remote interface to the current one
-				$oConnIf->Set('connected_if', $this->GetKey());
-				$oConnIf->Set('link_type', $sConnLink);
-
-				// Need to backup the current change, because it is reset when DBUpdateTracked is complete
-				$oCurrChange = self::$m_oCurrChange;
-				$oConnIf->DBUpdateTracked($oCurrChange);
-				self::$m_oCurrChange = $oCurrChange;
-			}
-		}
-	}
-
-	protected function AfterInsert()
-	{
-		$this->UpdateConnectedInterface();
-		parent::AfterInsert();
-	}
-
-	protected function AfterUpdate()
-	{
-		$this->UpdateConnectedInterface();
-		parent::AfterUpdate();
-	}
-
-}
-abstract class Device extends ConnectableCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name"),
-			"db_table" => "device",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/server.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("nwinterface_list", array("linked_class"=>"NetworkInterface", "ext_key_to_me"=>"device_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref'));
-		MetaModel::Init_SetZListItems('list', array('finalclass', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref'));
-	}
-	
-	public static function GetRelationQueries($sRelCode)
-	{
-		switch ($sRelCode)
-		{
-			case "impacts":
-			$aRels = array(
-				"applications" => array("sQuery"=>"SELECT SoftwareInstance AS app WHERE app.device_id = :this->id", "bPropagate"=>true, "iDistance"=>5),
-				"connected_devices" => array("sQuery"=>"SELECT Device AS dev JOIN NetworkInterface AS if1 ON if1.device_id = dev.id JOIN NetworkInterface AS if2 ON if2.connected_if = if1.id WHERE if2.device_id = :this->id AND if2.link_type='downlink'", "bPropagate"=>true, "iDistance"=>5),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-			
-			case "depends on":
-			$aRels = array(
-				"connected_devices" => array("sQuery"=>"SELECT Device AS dev JOIN NetworkInterface AS if1 ON if1.device_id = dev.id JOIN NetworkInterface AS if2 ON if2.connected_if = if1.id WHERE if2.device_id = :this->id AND if2.link_type='uplink'", "bPropagate"=>true, "iDistance"=>5),
-			);
-			return array_merge($aRels, parent::GetRelationQueries($sRelCode));
-			break;
-
-			default:
-			return parent::GetRelationQueries($sRelCode);			
-		}
-	}
-}
-class PC extends Device
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name"),
-			"db_table" => "pc",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/laptop.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeString("cpu", array("allowed_values"=>null, "sql"=>"cpu", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("ram", array("allowed_values"=>null, "sql"=>"ram", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("hdd", array("allowed_values"=>null, "sql"=>"hdd", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("os_family", array("allowed_values"=>null, "sql"=>"os_family", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("os_version", array("allowed_values"=>null, "sql"=>"os_version", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("application_list", array("linked_class"=>"SoftwareInstance", "ext_key_to_me"=>"device_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("patch_list", array("linked_class"=>"lnkPatchToCI", "ext_key_to_me"=>"ci_id", "ext_key_to_remote"=>"patch_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'cpu', 'ram', 'hdd', 'os_family', 'os_version', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list', 'application_list', 'patch_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'cpu', 'ram', 'hdd', 'os_family', 'os_version'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'os_family', 'os_version'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'brand', 'model', 'os_family'));
-	}
-}
-abstract class MobileCI extends Device
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name"),
-			"db_table" => "mobileci",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/mobile-phone.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'brand', 'model'));
-	}
-}
-class MobilePhone extends MobileCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name"),
-			"db_table" => "mobilephone",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/mobile-phone.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeString("number", array("allowed_values"=>null, "sql"=>"number", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("imei", array("allowed_values"=>null, "sql"=>"IMIE", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("hw_pin", array("allowed_values"=>null, "sql"=>"hw_pin", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'number', 'imei', 'hw_pin', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'number', 'imei'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'number', 'imei'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'brand', 'model'));
-	}
-}
-abstract class InfrastructureCI extends Device
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name","location_id","location_name"),
-			"db_table" => "infrastructureci",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/server.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		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 AttributeExternalKey("location_id", array("targetclass"=>"Location", "jointype"=>null, "allowed_values"=>new ValueSetObjects('SELECT Location AS l WHERE l.org_id = :this->org_id'), "sql"=>"location_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array("org_id"))));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("location_name", array("allowed_values"=>null, "extkey_attcode"=>"location_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeText("location_details", array("allowed_values"=>null, "sql"=>"location_details", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeIPAddress("management_ip", array("allowed_values"=>null, "sql"=>"management_ip", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("default_gateway", array("allowed_values"=>null, "sql"=>"default_gateway", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref','location_id','management_ip', 'default_gateway'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'brand', 'model', 'location_id'));
-	}
-}
-class NetworkDevice extends InfrastructureCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name","location_id","location_name"),
-			"db_table" => "networkdevice",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/switch.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeEnum("type", array("allowed_values"=>new ValueSetEnum('wanaccelerator,firewall,hub,loadbalancer,router,switch'), "sql"=>"type", "default_value"=>"switch", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("ios_version", array("allowed_values"=>null, "sql"=>"ios_version", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("ram", array("allowed_values"=>null, "sql"=>"ram", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("snmp_read", array("allowed_values"=>null, "sql"=>"snmp_read", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("snmp_write", array("allowed_values"=>null, "sql"=>"snmp_write", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway', 'type', 'ios_version', 'ram', 'snmp_read', 'snmp_write', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway', 'type', 'ios_version', 'ram'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'location_id','management_ip', 'default_gateway', 'type', 'ios_version'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'brand', 'model', 'location_id', 'type'));
-	}
-}
-class Server extends InfrastructureCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name","location_id","location_name"),
-			"db_table" => "server",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/server.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeString("cpu", array("allowed_values"=>null, "sql"=>"cpu", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("ram", array("allowed_values"=>null, "sql"=>"ram", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("hdd", array("allowed_values"=>null, "sql"=>"hdd", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("os_family", array("allowed_values"=>null, "sql"=>"os_family", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeString("os_version", array("allowed_values"=>null, "sql"=>"os_version", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSet("application_list", array("linked_class"=>"SoftwareInstance", "ext_key_to_me"=>"device_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("patch_list", array("linked_class"=>"lnkPatchToCI", "ext_key_to_me"=>"ci_id", "ext_key_to_remote"=>"patch_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway', 'cpu', 'ram', 'hdd', 'os_family', 'os_version', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list', 'application_list', 'patch_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway', 'cpu', 'ram', 'hdd', 'os_family', 'os_version'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'location_id', 'management_ip', 'default_gateway', 'os_family', 'os_version'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'brand', 'model', 'location_id', 'os_family'));
-	}
-}
-class Printer extends InfrastructureCI
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,searchable,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "name",
-			"state_attcode" => "",
-			"reconc_keys" => array("name","org_id","owner_name","location_id","location_name"),
-			"db_table" => "printer",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/printer.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeEnum("type", array("allowed_values"=>new ValueSetEnum('mopier,printer'), "sql"=>"type", "default_value"=>"printer", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeEnum("technology", array("allowed_values"=>new ValueSetEnum('laser,inkjet,tracer'), "sql"=>"technology", "default_value"=>"laser", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway', 'type', 'technology', 'contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list'));
-		MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway', 'type', 'technology'));
-		MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'description', 'location_id', 'location_details', 'management_ip', 'default_gateway', 'type', 'technology'));
-		MetaModel::Init_SetZListItems('list', array('status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'location_id',  'management_ip', 'default_gateway', 'type', 'technology'));
-	}
-}
-class lnkCIToDoc extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "ci_id",
-			"state_attcode" => "",
-			"reconc_keys" => array("ci_id","document_id"),
-			"db_table" => "lnkcitodoc",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		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 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('ci_id', 'ci_status', 'document_id', 'document_type', 'document_status'));
-		MetaModel::Init_SetZListItems('advanced_search', array('ci_id', 'document_id'));
-		MetaModel::Init_SetZListItems('standard_search', array('ci_id', 'document_id'));
-		MetaModel::Init_SetZListItems('list', array('ci_id', 'ci_status', 'document_id', 'document_type', 'document_status'));
-	}
-}
-class lnkCIToContact extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "ci_id",
-			"state_attcode" => "",
-			"reconc_keys" => array("ci_id","contact_id"),
-			"db_table" => "lnkcitocontact",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"icon" => "../modules/itop-config-mgmt-1.0.0/images/contact.png",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		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 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('ci_id', 'ci_status', 'contact_id', 'contact_email', 'role'));
-		MetaModel::Init_SetZListItems('advanced_search', array('ci_id', 'contact_id', 'role'));
-		MetaModel::Init_SetZListItems('standard_search', array('ci_id', 'contact_id', 'role'));
-		MetaModel::Init_SetZListItems('list', array('ci_id', 'ci_status', 'contact_id', 'contact_email', 'role'));
-	}
-}
-class lnkSolutionToCI extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "solution_id",
-			"state_attcode" => "",
-			"reconc_keys" => array("solution_id","ci_id"),
-			"db_table" => "lnksolutiontoci",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("solution_id", array("targetclass"=>"ApplicationSolution", "jointype"=>null, "allowed_values"=>null, "sql"=>"solution_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("solution_name", array("allowed_values"=>null, "extkey_attcode"=>"solution_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_AddAttribute(new AttributeString("utility", array("allowed_values"=>null, "sql"=>"utility", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
-
-		MetaModel::Init_SetZListItems('details', array('solution_id', 'ci_id', 'ci_status', 'utility'));
-		MetaModel::Init_SetZListItems('advanced_search', array('solution_id', 'ci_id', 'utility'));
-		MetaModel::Init_SetZListItems('standard_search', array('solution_id', 'ci_id', 'utility'));
-		MetaModel::Init_SetZListItems('list', array('solution_id', 'ci_id', 'ci_status', 'utility'));
-	}
-}
-class lnkProcessToSolution extends cmdbAbstractObject
-{
-
-	public static function Init()
-	{
-		$aParams = array
-		(
-			"category" => "bizmodel,configmgmt",
-			"key_type" => "autoincrement",
-			"name_attcode" => "solution_id",
-			"state_attcode" => "",
-			"reconc_keys" => array("solution_id","process_id"),
-			"db_table" => "lnkprocesstosolution",
-			"db_key_field" => "id",
-			"db_finalclass_field" => "",
-			"display_template" => "",
-		);
-		MetaModel::Init_Params($aParams);
-		MetaModel::Init_InheritAttributes();
-
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("solution_id", array("targetclass"=>"ApplicationSolution", "jointype"=>null, "allowed_values"=>null, "sql"=>"solution_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("solution_name", array("allowed_values"=>null, "extkey_attcode"=>"solution_id", "target_attcode"=>"name", "is_null_allowed"=>true, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalKey("process_id", array("targetclass"=>"BusinessProcess", "jointype"=>null, "allowed_values"=>null, "sql"=>"process_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
-		MetaModel::Init_AddAttribute(new AttributeExternalField("process_name", array("allowed_values"=>null, "extkey_attcode"=>"process_id", "target_attcode"=>"name", "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('solution_id', 'process_id', 'reason'));
-		MetaModel::Init_SetZListItems('advanced_search', array('solution_id', 'process_id', 'reason'));
-		MetaModel::Init_SetZListItems('standard_search', array('solution_id', 'process_id', 'reason'));
-		MetaModel::Init_SetZListItems('list', array('solution_id', 'process_id', 'reason'));
-	}
-}
-
-
-
-//////////////////////////////////////////////////////////////////////////////
-// Menu:
-//   +----------------------------------------+
-//   | My Module                              |
-//   +----------------------------------------+
-//		+ All items
-//			+ ...
-//			+ ...
-////////////////////////////////////////////////////////////////////////////////////
-// Create the top-level group. fRank = 1, means it will be inserted after the group '0', which is usually 'Welcome'
-
-
-// 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 */);
-
-?>

+ 1 - 0
modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php

@@ -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',

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 8 - 0
modules/itop-incident-mgmt-1.0.0/datamodel.itop-incident-mgmt.xml


+ 29 - 0
modules/itop-incident-mgmt-1.0.0/main.itop-incident-mgmt.php

@@ -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'));
+
+?>

+ 0 - 251
modules/itop-incident-mgmt-1.0.0/model.itop-incident-mgmt.php

@@ -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'));
-
-?>

+ 1 - 0
modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php

@@ -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',

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 0
modules/itop-knownerror-mgmt-1.0.0/datamodel.itop-knownerror-mgmt.xml


+ 6 - 8
modules/itop-basic-1.0.0/model.itop-basic.php → modules/itop-knownerror-mgmt-1.0.0/main.itop-knownerror-mgmt.php

@@ -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 */);
 
 ?>

+ 0 - 175
modules/itop-knownerror-mgmt-1.0.0/model.itop-knownerror-mgmt.php

@@ -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 */);
-
-?>

+ 1 - 0
modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php

@@ -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',

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 8 - 0
modules/itop-problem-mgmt-1.0.0/datamodel.itop-problem-mgmt.xml


+ 26 - 0
modules/itop-problem-mgmt-1.0.0/main.itop-problem-mgmt.php

@@ -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 */);
+
+?>

+ 0 - 254
modules/itop-problem-mgmt-1.0.0/model.itop-problem-mgmt.php

@@ -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 */);
-
-?>

+ 1 - 0
modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php

@@ -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',

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 8 - 0
modules/itop-request-mgmt-1.0.0/datamodel.itop-request-mgmt.xml


+ 30 - 0
modules/itop-request-mgmt-1.0.0/main.itop-request-mgmt.php

@@ -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'));
+
+?>

+ 0 - 213
modules/itop-request-mgmt-1.0.0/model.itop-request-mgmt.php

@@ -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'));
-
-?>

+ 1 - 0
modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php

@@ -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',

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 8 - 0
modules/itop-service-mgmt-1.0.0/datamodel.itop-service-mgmt.xml


+ 27 - 0
modules/itop-service-mgmt-1.0.0/main.itop-service-mgmt.php

@@ -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 */);
+
+?>

+ 0 - 619
modules/itop-service-mgmt-1.0.0/model.itop-service-mgmt.php

@@ -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 */);
-
-?>

+ 1 - 0
modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php

@@ -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',

+ 0 - 0
modules/itop-sla-computation/model.itop-sla-computation.php → modules/itop-sla-computation/main.itop-sla-computation.php


+ 1 - 1
modules/itop-sla-computation/module.itop-sla-computation.php

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

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 8 - 0
modules/itop-tickets-1.0.0/datamodel.itop-tickets.xml


+ 79 - 0
modules/itop-tickets-1.0.0/main.itop-tickets.php

@@ -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);
+		}
+	}
+}
+
+?>

+ 0 - 674
modules/itop-tickets-1.0.0/model.itop-tickets.php

@@ -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);
-		}
-	}
-}
-
-?>

+ 1 - 0
modules/itop-tickets-1.0.0/module.itop-tickets.php

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

+ 0 - 0
modules/itop-welcome-itil/model.itop-welcome-itil.php → modules/itop-welcome-itil/main.itop-welcome-itil.php


+ 1 - 1
modules/itop-welcome-itil/module.itop-welcome-itil.php

@@ -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',

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels