itop.business.class.inc.php 104 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799
  1. <?php
  2. require_once('../application/cmdbabstract.class.inc.php');
  3. require_once('../application/template.class.inc.php');
  4. /**
  5. * itop.business.class.inc.php
  6. * User defined objects, implements the business need
  7. *
  8. * @package iTopBizModelSamples
  9. * @author Romain Quetiez <romainquetiez@yahoo.fr>
  10. * @author Denis Flaven <denisflave@free.fr>
  11. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
  12. * @link www.itop.com
  13. * @since 1.0
  14. * @version 1.1.1.1 $
  15. */
  16. /**
  17. * Possible values for the statuses of objects
  18. */
  19. $oAllowedStatuses = new ValueSetEnum('production,implementation,obsolete');
  20. /**
  21. * Relation graphs
  22. */
  23. MetaModel::RegisterRelation("impacts", array("description"=>"objects being functionaly impacted", "verb_down"=>"impacts", "verb_up"=>"is impacted by"));
  24. ////////////////////////////////////////////////////////////////////////////////////
  25. /**
  26. * An organization that owns some objects
  27. *
  28. * An organization "owns" some persons (its employees) but also some other objects
  29. * (its assets) like buildings, computers, furniture...
  30. * the services that they provides, the contracts/OLA they have signed as customer
  31. *
  32. * Organization ownership might be used to manage the R/W access to the object
  33. */
  34. ////////////////////////////////////////////////////////////////////////////////////
  35. /**
  36. * itop.business.class.inc.php
  37. * User defined objects, implements the business need
  38. *
  39. * @package iTopBizModelSamples
  40. * @author Erwan Taloc <taloche@yahoo.fr>
  41. * @author Denis Flaven <denisflave@free.fr>
  42. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
  43. * @link www.itop.com
  44. * @since 1.0
  45. * @version 1.1.1.1 $
  46. */
  47. class bizOrganization extends cmdbAbstractObject
  48. {
  49. public static function Init()
  50. {
  51. global $oAllowedStatuses;
  52. $aParams = array
  53. (
  54. "category" => "bizmodel,searchable",
  55. "name" => "Organization",
  56. "description" => "Organizational structure: can be Company and/or Department",
  57. "key_type" => "autoincrement",
  58. "key_label" => "id",
  59. "name_attcode" => "name",
  60. "state_attcode" => "",
  61. "reconc_keys" => array("name"),
  62. "db_table" => "organizations",
  63. "db_key_field" => "id",
  64. "db_finalclass_field" => "",
  65. "display_template" => "../business/templates/default.html",
  66. );
  67. MetaModel::Init_Params($aParams);
  68. MetaModel::Init_AddAttribute(new AttributeString("name", array("label"=>"Name", "description"=>"Common name", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array() )));
  69. MetaModel::Init_AddAttribute(new AttributeString("code", array("label"=>"Code", "description"=>"Organization code (Siret, DUNS,...)", "allowed_values"=>null, "sql"=>"code", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array() )));
  70. MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Lifecycle status", "allowed_values"=>$oAllowedStatuses, "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
  71. MetaModel::Init_AddAttribute(new AttributeExternalKey("parent_id", array("targetclass"=>"bizOrganization", "label"=>"Parent", "description"=>"Parent organization", "allowed_values"=>null, "sql"=>"parent_id", "is_null_allowed"=>true, "depends_on"=>array())));
  72. MetaModel::Init_AddAttribute(new AttributeExternalField("parent_name", array("label"=>"Parent Name", "description"=>"Name of the parent organization", "allowed_values"=>null, "extkey_attcode"=> 'parent_id', "target_attcode"=>"name")));
  73. MetaModel::Init_AddFilterFromAttribute("name");
  74. MetaModel::Init_AddFilterFromAttribute("code");
  75. MetaModel::Init_AddFilterFromAttribute("status");
  76. // Display lists
  77. MetaModel::Init_SetZListItems('details', array('name', 'code', 'status', 'parent_id')); // Attributes to be displayed for the complete details
  78. MetaModel::Init_SetZListItems('list', array('name', 'status', 'parent_id')); // Attributes to be displayed for a list
  79. // Search criteria
  80. MetaModel::Init_SetZListItems('standard_search', array('name', 'code', 'status')); // Criteria of the std search form
  81. MetaModel::Init_SetZListItems('advanced_search', array('name', 'code', 'status')); // Criteria of the advanced search form
  82. }
  83. public function Generate(cmdbDataGenerator $oGenerator)
  84. {
  85. //$this->SetKey($oGenerator->GetOrganizationCode());
  86. $this->Set('name', $oGenerator->GetOrganizationName());
  87. $this->Set('code', $oGenerator->GetOrganizationCode());
  88. $this->Set('status', 'implementation');
  89. $this->Set('parent_id', 1);
  90. }
  91. }
  92. ////////////////////////////////////////////////////////////////////////////////////
  93. /**
  94. * Class of objects owned by some organization
  95. *
  96. * This is the root class of all the objects that can be "owned" by an organization
  97. *
  98. * A Real Object
  99. * can be supported by Contacts, having a specific role (same contact with multiple roles?)
  100. * can be documented by Documents
  101. */
  102. ////////////////////////////////////////////////////////////////////////////////////
  103. /**
  104. * itop.business.class.inc.php
  105. * User defined objects, implements the business need
  106. *
  107. * @package iTopBizModelSamples
  108. * @author Erwan Taloc <taloche@yahoo.fr>
  109. * @author Denis Flaven <denisflave@free.fr>
  110. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
  111. * @link www.itop.com
  112. * @since 1.0
  113. * @version 1.1.1.1 $
  114. */
  115. class logRealObject extends cmdbAbstractObject
  116. {
  117. public static function Init()
  118. {
  119. global $oAllowedStatuses;
  120. $aParams = array
  121. (
  122. "category" => "bizmodel,searchable",
  123. "name" => "Object",
  124. "description" => "Any CMDB object",
  125. "key_type" => "autoincrement",
  126. "key_label" => "id",
  127. "name_attcode" => "name",
  128. "state_attcode" => "",
  129. "reconc_keys" => array("name"),
  130. "db_table" => "objects",
  131. "db_key_field" => "id",
  132. "db_finalclass_field" => "obj_class",
  133. "display_template" => "../business/templates/default.html",
  134. );
  135. MetaModel::Init_Params($aParams);
  136. MetaModel::Init_AddAttribute(new AttributeString("name", array("label"=>"Name", "description"=>"Common name", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  137. MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Lifecycle status", "allowed_values"=>$oAllowedStatuses, "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
  138. MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"bizOrganization", "label"=>"Organization", "description"=>"ID of the object owner organization", "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "depends_on"=>array())));
  139. MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("label"=>"Organization", "description"=>"Company / Department owning this object", "allowed_values"=>null, "extkey_attcode"=> 'org_id', "target_attcode"=>"name")));
  140. MetaModel::Init_AddFilterFromAttribute("name");
  141. MetaModel::Init_AddFilterFromAttribute("status");
  142. MetaModel::Init_AddFilterFromAttribute("org_id");
  143. MetaModel::Init_AddFilterFromAttribute("org_name");
  144. // Display lists
  145. MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id')); // Attributes to be displayed for the complete details
  146. MetaModel::Init_SetZListItems('list', array('finalclass', 'name', 'status', 'org_id')); // Attributes to be displayed for a list
  147. // Search criteria
  148. MetaModel::Init_SetZListItems('standard_search', array('name', 'status')); // Criteria of the std search form
  149. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id')); // Criteria of the advanced search form
  150. }
  151. public function Generate(cmdbDataGenerator $oGenerator)
  152. {
  153. $this->Set('org_id', $oGenerator->GetOrganizationId());
  154. $this->Set('name', "<overload in derived class>");
  155. $this->Set('status', $oGenerator->GenerateString("enum(implementation,production)"));
  156. }
  157. }
  158. ////////////////////////////////////////////////////////////////////////////////////
  159. /**
  160. * Any kind of thing that can be contacted (person, team, hotline...)
  161. * A contact can:
  162. * be linked to any Real Object with a role
  163. * be part of a GroupContact
  164. */
  165. ////////////////////////////////////////////////////////////////////////////////////
  166. class bizContact extends logRealObject
  167. {
  168. public static function Init()
  169. {
  170. $aParams = array
  171. (
  172. "category" => "bizmodel,searchable",
  173. "name" => "Contact",
  174. "description" => "Contact",
  175. "key_type" => "",
  176. "key_label" => "id",
  177. "name_attcode" => "name",
  178. "state_attcode" => "",
  179. "reconc_keys" => array("org_name", "name"), // inherited attributes
  180. "db_table" => "contacts",
  181. "db_key_field" => "id",
  182. "db_finalclass_field" => "",
  183. "display_template" => "../business/templates/default.html",
  184. );
  185. MetaModel::Init_Params($aParams);
  186. MetaModel::Init_InheritAttributes();
  187. MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("label"=>"Organization", "description"=>"Company / Department of the contact", "allowed_values"=>null, "extkey_attcode"=> 'org_id', "target_attcode"=>"name")));
  188. MetaModel::Init_AddAttribute(new AttributeString("email", array("label"=>"eMail", "description"=>"Email address", "allowed_values"=>null, "sql"=>"email", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  189. MetaModel::Init_AddAttribute(new AttributeString("phone", array("label"=>"Phone", "description"=>"Telephone", "allowed_values"=>null, "sql"=>"telephone", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  190. MetaModel::Init_AddAttribute(new AttributeExternalKey("location_id", array("targetclass"=>"bizLocation", "label"=>"Location", "description"=>"Id of the location where the contact is located", "allowed_values"=>null, "sql"=>"location_id", "is_null_allowed"=>true, "depends_on"=>array())));
  191. MetaModel::Init_AddAttribute(new AttributeExternalField("location_name", array("label"=>"Location Name", "description"=>"Name of the location where the contact is located", "allowed_values"=>null, "extkey_attcode"=> 'location_id', "target_attcode"=>"name")));
  192. MetaModel::Init_InheritFilters();
  193. MetaModel::Init_AddFilterFromAttribute("org_name");
  194. MetaModel::Init_AddFilterFromAttribute("email");
  195. MetaModel::Init_AddFilterFromAttribute("phone");
  196. MetaModel::Init_AddFilterFromAttribute("location_id");
  197. MetaModel::Init_AddFilterFromAttribute("location_name");
  198. // Display lists
  199. MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'email', 'location_id', 'phone')); // Attributes to be displayed for the complete details
  200. MetaModel::Init_SetZListItems('list', array('finalclass', 'name', 'status', 'org_id', 'email', 'location_id', 'phone')); // Attributes to be displayed for a list
  201. // Search criteria
  202. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'email', 'location_id', 'phone')); // Criteria of the std search form
  203. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id')); // Criteria of the advanced search form
  204. }
  205. public function Generate(cmdbDataGenerator $oGenerator)
  206. {
  207. $this->Set('org_id', $oGenerator->GetOrganizationId());
  208. $this->Set('name', "<overload in derived classes>");
  209. $this->Set('email', "<overload in derived classes>");
  210. $this->Set('phone', $oGenerator->GenerateString("enum(+1,+33,+44,+49,+421)| |number(100-999)| |number(000-999)"));
  211. $this->Set('location_id', $oGenerator->GenerateKey("bizLocation", array('org_id' =>$oGenerator->GetOrganizationId() )));
  212. }
  213. }
  214. ////////////////////////////////////////////////////////////////////////////////////
  215. /**
  216. * Physical person only
  217. */
  218. ////////////////////////////////////////////////////////////////////////////////////
  219. class bizPerson extends bizContact
  220. {
  221. public static function Init()
  222. {
  223. $oAllowedEmployeeStatuses = new ValueSetEnum('off,left company,available');
  224. $aParams = array
  225. (
  226. "category" => "bizmodel,searchable",
  227. "name" => "Person",
  228. "description" => "Person",
  229. "key_type" => "",
  230. "key_label" => "id",
  231. "name_attcode" => "name",
  232. "state_attcode" => "",
  233. "reconc_keys" => array("org_name", "first_name", "name"), // comment en définir plusieurs
  234. // "reconc_keys" => array("org_name", "employee_number"),
  235. "db_table" => "persons", // Can it use the same physical DB table as any contact ?
  236. "db_key_field" => "id",
  237. "db_finalclass_field" => "",
  238. "display_template" => "../business/templates/person.html",
  239. );
  240. MetaModel::Init_Params($aParams);
  241. MetaModel::Init_InheritAttributes();
  242. MetaModel::Init_AddAttribute(new AttributeString("first_name", array("label"=>"First Name", "description"=>"First name", "allowed_values"=>null, "sql"=>"first_name", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  243. MetaModel::Init_AddAttribute(new AttributeString("employee_number", array("label"=>"Employee Number", "description"=>"employee number", "allowed_values"=>null, "sql"=>"employee_number", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  244. MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Lifecycle status", "allowed_values"=>$oAllowedEmployeeStatuses, "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
  245. MetaModel::Init_InheritFilters();
  246. MetaModel::Init_AddFilterFromAttribute("first_name");
  247. MetaModel::Init_AddFilterFromAttribute("employee_number");
  248. // Display lists
  249. MetaModel::Init_SetZListItems('details', array('first_name', 'name', 'status', 'org_id', 'email', 'location_id', 'phone', 'employee_number')); // Attributes to be displayed for the complete details
  250. MetaModel::Init_SetZListItems('list', array('first_name', 'name', 'status', 'org_id', 'email', 'location_id', 'phone')); // Attributes to be displayed for a list
  251. // Search criteria
  252. MetaModel::Init_SetZListItems('standard_search', array('first_name', 'name', 'status', 'email', 'location_id', 'phone', 'employee_number')); // Criteria of the std search form
  253. MetaModel::Init_SetZListItems('advanced_search', array('first_name', 'name', 'status', 'email', 'location_id', 'phone', 'employee_number')); // Criteria of the advanced search form
  254. }
  255. public function Generate(cmdbDataGenerator $oGenerator)
  256. {
  257. parent::Generate($oGenerator);
  258. $this->Set('name', $oGenerator->GenerateLastName());
  259. $this->Set('first_name', $oGenerator->GenerateFirstName());
  260. $this->Set('email', $oGenerator->GenerateEmail($this->Get('first_name'), $this->Get('name')));
  261. $this->Set('phone', $oGenerator->GenerateString("enum(+1,+33,+44,+49,+421)| |number(100-999)| |number(000-999)"));
  262. }
  263. }
  264. ////////////////////////////////////////////////////////////////////////////////////
  265. /**
  266. * A team is basically a contact which is also a group of contacts
  267. * (and thus a team can contain other teams)
  268. */
  269. ////////////////////////////////////////////////////////////////////////////////////
  270. class bizTeam extends bizContact
  271. {
  272. public static function Init()
  273. {
  274. $aParams = array
  275. (
  276. "category" => "bizmodel,searchable",
  277. "name" => "Team",
  278. "description" => "A group of contacts",
  279. "key_type" => "",
  280. "key_label" => "id",
  281. "name_attcode" => "name",
  282. "state_attcode" => "",
  283. "reconc_keys" => array("org_name", "name"), // inherited attributes
  284. "db_table" => "teams",
  285. "db_key_field" => "id",
  286. "db_finalclass_field" => "",
  287. "display_template" => "../business/templates/team.html",
  288. );
  289. MetaModel::Init_Params($aParams);
  290. MetaModel::Init_InheritAttributes();
  291. MetaModel::Init_InheritFilters();
  292. // Display lists
  293. MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'email', 'location_id', 'phone')); // Attributes to be displayed for the complete details
  294. MetaModel::Init_SetZListItems('list', array('name', 'status', 'org_id', 'email', 'location_id', 'phone')); // Attributes to be displayed for a list
  295. // Search criteria
  296. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'email', 'location_id', 'phone')); // Criteria of the std search form
  297. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id')); // Criteria of the advanced search form
  298. }
  299. }
  300. ////////////////////////////////////////////////////////////////////////////////////
  301. /**
  302. * n-n link between any Object and a contact
  303. */
  304. ////////////////////////////////////////////////////////////////////////////////////
  305. class lnkContactTeam extends cmdbAbstractObject
  306. {
  307. public static function Init()
  308. {
  309. $aParams = array
  310. (
  311. "category" => "bizmodel,searchable",
  312. "name" => "TeamsLinks",
  313. "description" => "A link between a contact and a Team",
  314. "key_type" => "autoincrement",
  315. "key_label" => "link_id",
  316. "name_attcode" => "role",
  317. "state_attcode" => "",
  318. "reconc_keys" => array("contact_name", "team_name"),
  319. "db_table" => "teams_links",
  320. "db_key_field" => "link_id",
  321. "db_finalclass_field" => "",
  322. "display_template" => "../business/templates/default.html",
  323. );
  324. MetaModel::Init_Params($aParams);
  325. MetaModel::Init_AddAttribute(new AttributeExternalKey("contact_id", array("targetclass"=>"bizPerson", "label"=>"Contact", "description"=>"The contact", "allowed_values"=>null, "sql"=>"contact_id", "is_null_allowed"=>false, "depends_on"=>array())));
  326. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("label"=>"Contact Name", "description"=>"name of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"name")));
  327. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_phone", array("label"=>"Phone", "description"=>"Phone number of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"phone")));
  328. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("label"=>"eMail", "description"=>"eMail address of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"email")));
  329. MetaModel::Init_AddAttribute(new AttributeExternalKey("team_id", array("targetclass"=>"bizTeam", "label"=>"Team", "description"=>"Team linked", "allowed_values"=>null, "sql"=>"team_id", "is_null_allowed"=>false, "depends_on"=>array())));
  330. MetaModel::Init_AddAttribute(new AttributeExternalField("team_name", array("label"=>"Team", "description"=>"name of the Team", "allowed_values"=>null, "extkey_attcode"=> 'team_id', "target_attcode"=>"name")));
  331. MetaModel::Init_AddAttribute(new AttributeString("role", array("label"=>"Role", "description"=>"Role of the contact", "allowed_values"=>null, "sql"=>"role", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  332. MetaModel::Init_AddFilterFromAttribute("contact_id");
  333. MetaModel::Init_AddFilterFromAttribute("contact_name");
  334. MetaModel::Init_AddFilterFromAttribute("team_id");
  335. MetaModel::Init_AddFilterFromAttribute("team_name");
  336. MetaModel::Init_AddFilterFromAttribute("role");
  337. // Display lists
  338. MetaModel::Init_SetZListItems('details', array('contact_id', 'contact_phone', 'contact_email', 'team_id', 'role')); // Attributes to be displayed for the complete details
  339. MetaModel::Init_SetZListItems('list', array('contact_id', 'contact_phone', 'contact_email', 'team_id', 'role')); // Attributes to be displayed for a list
  340. }
  341. }
  342. ////////////////////////////////////////////////////////////////////////////////////
  343. /**
  344. * An electronic document, with version tracking
  345. */
  346. ////////////////////////////////////////////////////////////////////////////////////
  347. class bizDocument extends logRealObject
  348. {
  349. public static function Init()
  350. {
  351. $aParams = array
  352. (
  353. "category" => "bizmodel,searchable",
  354. "name" => "Document",
  355. "description" => "Document",
  356. "key_type" => "",
  357. "key_label" => "id",
  358. "name_attcode" => "name",
  359. "state_attcode" => "",
  360. "reconc_keys" => array("org_name", "name"), // inherited attributes
  361. "db_table" => "documents",
  362. "db_key_field" => "id",
  363. "db_finalclass_field" => "",
  364. "display_template" => "../business/templates/document.html",
  365. );
  366. MetaModel::Init_Params($aParams);
  367. MetaModel::Init_InheritAttributes();
  368. MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("label"=>"Organization", "description"=>"Company / Department owning the document", "allowed_values"=>null, "extkey_attcode"=> 'org_id', "target_attcode"=>"name")));
  369. MetaModel::Init_AddAttribute(new AttributeEnum("scope", array("label"=>"scope", "description"=>"Scope of this document", "allowed_values"=>new ValueSetEnum("organization,hardware support"), "sql"=>"scope", "default_value"=>"organization", "is_null_allowed"=>false, "depends_on"=>array())));
  370. MetaModel::Init_AddAttribute(new AttributeString("description", array("label"=>"Description", "description"=>"Service Description", "allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  371. MetaModel::Init_InheritFilters();
  372. MetaModel::Init_AddFilterFromAttribute("scope");
  373. MetaModel::Init_AddFilterFromAttribute("description");
  374. MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'scope','description')); // Attributes to be displayed for the complete details
  375. MetaModel::Init_SetZListItems('list', array('name', 'status', 'org_id', 'scope')); // Attributes to be displayed for a list
  376. // Search criteria
  377. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'scope')); // Criteria of the std search form
  378. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'scope')); // Criteria of the advanced search form
  379. }
  380. }
  381. ////////////////////////////////////////////////////////////////////////////////////
  382. /**
  383. * A version of an electronic document
  384. */
  385. ////////////////////////////////////////////////////////////////////////////////////
  386. class bizDocVersion extends cmdbAbstractObject
  387. {
  388. public static function Init()
  389. {
  390. global $oAllowedStatuses;
  391. $aParams = array
  392. (
  393. "category" => "bizmodel,searchable",
  394. "name" => "DocumentVersion",
  395. "description" => "A version of a document",
  396. "key_type" => "autoincrement",
  397. "key_label" => "id",
  398. "name_attcode" => "version_number",
  399. "state_attcode" => "",
  400. "reconc_keys" => array("docname", "version_number"),
  401. "db_table" => "document_versions",
  402. "db_key_field" => "id",
  403. "db_finalclass_field" => "",
  404. "display_template" => "../business/templates/default.html",
  405. );
  406. MetaModel::Init_Params($aParams);
  407. MetaModel::Init_AddAttribute(new AttributeExternalKey("document", array("targetclass"=>"bizDocument", "label"=>"Document", "description"=>"The main document", "allowed_values"=>null, "sql"=>"document_id", "is_null_allowed"=>false, "depends_on"=>array())));
  408. MetaModel::Init_AddAttribute(new AttributeExternalField("docname", array("label"=>"Document Name", "description"=>"name of the document", "allowed_values"=>null, "extkey_attcode"=> 'document', "target_attcode"=>"name")));
  409. MetaModel::Init_AddAttribute(new AttributeString("version_number", array("label"=>"Version", "description"=>"Version identifier", "allowed_values"=>null, "sql"=>"version_number", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  410. MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Status", "allowed_values"=>$oAllowedStatuses, "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
  411. MetaModel::Init_AddAttribute(new AttributeEnum("type", array("label"=>"Type", "description"=>"Type", "allowed_values"=>new ValueSetEnum("local,draft"), "sql"=>"type", "default_value"=>"local", "is_null_allowed"=>false, "depends_on"=>array())));
  412. MetaModel::Init_AddAttribute(new AttributeURL("url", array("label"=>"URL", "description"=>"Hyperlink to the version", "allowed_values"=>null, "target"=>"_blank", "sql"=>"url", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  413. MetaModel::Init_AddAttribute(new AttributeString("description", array("label"=>"Description", "description"=>"Service Description", "allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  414. MetaModel::Init_AddFilterFromAttribute("document");
  415. MetaModel::Init_AddFilterFromAttribute("docname");
  416. MetaModel::Init_AddFilterFromAttribute("version_number");
  417. MetaModel::Init_AddFilterFromAttribute("status");
  418. MetaModel::Init_AddFilterFromAttribute("type");
  419. MetaModel::Init_AddFilterFromAttribute("description");
  420. MetaModel::Init_SetZListItems('details', array('document', 'status', 'version_number', 'type','url','description')); // Attributes to be displayed for the complete details
  421. MetaModel::Init_SetZListItems('list', array('version_number', 'status', 'type', 'url')); // Attributes to be displayed for a list
  422. // Search criteria
  423. MetaModel::Init_SetZListItems('standard_search', array('docname', 'type')); // Criteria of the std search form
  424. MetaModel::Init_SetZListItems('advanced_search', array('docname', 'type')); // Criteria o
  425. }
  426. }
  427. ////////////////////////////////////////////////////////////////////////////////////
  428. /**
  429. * n-n link between any Object and a Document
  430. */
  431. ////////////////////////////////////////////////////////////////////////////////////
  432. class lnkDocumentRealObject extends cmdbAbstractObject
  433. {
  434. public static function Init()
  435. {
  436. $aParams = array
  437. (
  438. "category" => "bizmodel,searchable",
  439. "name" => "DocumentsLinks",
  440. "description" => "A link between a document and another object",
  441. "key_type" => "autoincrement",
  442. "key_label" => "link_id",
  443. "name_attcode" => "link_type",
  444. "state_attcode" => "",
  445. "reconc_keys" => array("doc_name", "object_name"),
  446. "db_table" => "documents_links",
  447. "db_key_field" => "link_id",
  448. "db_finalclass_field" => "",
  449. "display_template" => "../business/templates/default.html",
  450. );
  451. MetaModel::Init_Params($aParams);
  452. MetaModel::Init_AddAttribute(new AttributeExternalKey("doc_id", array("targetclass"=>"bizDocument", "label"=>"Document", "description"=>"id of the Document", "allowed_values"=>null, "sql"=>"doc_id", "is_null_allowed"=>false, "depends_on"=>array())));
  453. MetaModel::Init_AddAttribute(new AttributeExternalField("doc_name", array("label"=>"Document Name", "description"=>"name of the document", "allowed_values"=>null, "extkey_attcode"=> 'doc_id', "target_attcode"=>"name")));
  454. MetaModel::Init_AddAttribute(new AttributeExternalKey("object_id", array("targetclass"=>"logRealObject", "label"=>"Object", "description"=>"Object linked", "allowed_values"=>null, "sql"=>"object_id", "is_null_allowed"=>false, "depends_on"=>array())));
  455. MetaModel::Init_AddAttribute(new AttributeExternalField("object_name", array("label"=>"Object Name", "description"=>"name of the linked object", "allowed_values"=>null, "extkey_attcode"=> 'object_id', "target_attcode"=>"name")));
  456. MetaModel::Init_AddAttribute(new AttributeString("link_type", array("label"=>"Link Type", "description"=>"More information", "allowed_values"=>null, "sql"=>"link_type", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  457. MetaModel::Init_AddFilterFromAttribute("doc_id");
  458. MetaModel::Init_AddFilterFromAttribute("doc_name");
  459. MetaModel::Init_AddFilterFromAttribute("object_id");
  460. MetaModel::Init_AddFilterFromAttribute("object_name");
  461. MetaModel::Init_AddFilterFromAttribute("link_type");
  462. // Display lists
  463. MetaModel::Init_SetZListItems('details', array('doc_id', 'object_id', 'link_type')); // Attributes to be displayed for the complete details
  464. MetaModel::Init_SetZListItems('list', array('doc_id', 'object_id', 'link_type')); // Attributes to be displayed for a list
  465. }
  466. }
  467. ////////////////////////////////////////////////////////////////////////////////////
  468. /**
  469. * n-n link between any Object and a contact
  470. */
  471. ////////////////////////////////////////////////////////////////////////////////////
  472. class lnkContactRealObject extends cmdbAbstractObject
  473. {
  474. public static function Init()
  475. {
  476. $aParams = array
  477. (
  478. "category" => "bizmodel,searchable",
  479. "name" => "ContactsLinks",
  480. "description" => "A link between a contact and another object",
  481. "key_type" => "autoincrement",
  482. "key_label" => "link_id",
  483. "name_attcode" => "role",
  484. "state_attcode" => "",
  485. "reconc_keys" => array("contact_name", "object_name"),
  486. "db_table" => "contacts_links",
  487. "db_key_field" => "link_id",
  488. "db_finalclass_field" => "",
  489. "display_template" => "../business/templates/default.html",
  490. );
  491. MetaModel::Init_Params($aParams);
  492. MetaModel::Init_AddAttribute(new AttributeExternalKey("contact_id", array("targetclass"=>"bizContact", "label"=>"Contact", "description"=>"The contact", "allowed_values"=>null, "sql"=>"contact_id", "is_null_allowed"=>false, "depends_on"=>array())));
  493. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("label"=>"Contact Name", "description"=>"name of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"name")));
  494. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_phone", array("label"=>"Phone", "description"=>"Phone number of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"phone")));
  495. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("label"=>"eMail", "description"=>"eMail address of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"email")));
  496. MetaModel::Init_AddAttribute(new AttributeExternalKey("object_id", array("targetclass"=>"logRealObject", "label"=>"Object", "description"=>"Object linked", "allowed_values"=>null, "sql"=>"object_id", "is_null_allowed"=>false, "depends_on"=>array())));
  497. MetaModel::Init_AddAttribute(new AttributeExternalField("object_name", array("label"=>"Object Name", "description"=>"name of the linked object", "allowed_values"=>null, "extkey_attcode"=> 'object_id', "target_attcode"=>"name")));
  498. MetaModel::Init_AddAttribute(new AttributeString("role", array("label"=>"Role", "description"=>"Role of the contact", "allowed_values"=>null, "sql"=>"role", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  499. MetaModel::Init_AddFilterFromAttribute("contact_id");
  500. MetaModel::Init_AddFilterFromAttribute("contact_name");
  501. MetaModel::Init_AddFilterFromAttribute("object_id");
  502. MetaModel::Init_AddFilterFromAttribute("object_name");
  503. MetaModel::Init_AddFilterFromAttribute("role");
  504. // Display lists
  505. MetaModel::Init_SetZListItems('details', array('contact_id', 'contact_phone', 'contact_email', 'object_id', 'role')); // Attributes to be displayed for the complete details
  506. MetaModel::Init_SetZListItems('list', array('contact_id', 'contact_phone', 'contact_email', 'object_id', 'role')); // Attributes to be displayed for a list
  507. }
  508. }
  509. ////////////////////////////////////////////////////////////////////////////////////
  510. /**
  511. * Any Infrastructure object (bizLocation, bizDevice, bizApplication, bizCircuit, bizInterface)
  512. * An infrastructure object:
  513. * can be covered by an OLA
  514. * can support the delivery of a Service
  515. * can be part of an GroupInfra
  516. */
  517. ////////////////////////////////////////////////////////////////////////////////////
  518. class logInfra extends logRealObject
  519. {
  520. public static function Init()
  521. {
  522. $aParams = array
  523. (
  524. "category" => "bizmodel,searchable",
  525. "name" => "Infra",
  526. "description" => "Infrastructure real object",
  527. "key_type" => "",
  528. "key_label" => "id",
  529. "name_attcode" => "name",
  530. "state_attcode" => "",
  531. "reconc_keys" => array("org_name", "name"), // inherited attributes
  532. "db_table" => "infra",
  533. "db_key_field" => "id",
  534. "db_finalclass_field" => "",
  535. "display_template" => "../business/templates/default.html",
  536. );
  537. MetaModel::Init_Params($aParams);
  538. MetaModel::Init_InheritAttributes();
  539. MetaModel::Init_AddAttribute(new AttributeEnum("severity", array("label"=>"Business Criticity", "description"=>"Severity for this infrastructure", "allowed_values"=>new ValueSetEnum("high,medium,low"), "sql"=>"severity", "default_value"=>"low", "is_null_allowed"=>false, "depends_on"=>array())));
  540. MetaModel::Init_InheritFilters();
  541. MetaModel::Init_AddFilterFromAttribute("severity");
  542. }
  543. }
  544. ////////////////////////////////////////////////////////////////////////////////////
  545. /**
  546. * n-n link between any Object and a contact
  547. */
  548. ////////////////////////////////////////////////////////////////////////////////////
  549. class lnkContactInfra extends cmdbAbstractObject
  550. {
  551. public static function Init()
  552. {
  553. $aParams = array
  554. (
  555. "category" => "bizmodel,searchable",
  556. "name" => "ContactsInfraLinks",
  557. "description" => "A link between a contact and an infrastructure",
  558. "key_type" => "autoincrement",
  559. "key_label" => "link_id",
  560. "name_attcode" => "role",
  561. "state_attcode" => "",
  562. "reconc_keys" => array("contact_name", "object_name"),
  563. "db_table" => "contacts_infra_links",
  564. "db_key_field" => "link_id",
  565. "db_finalclass_field" => "",
  566. "display_template" => "../business/templates/default.html",
  567. );
  568. MetaModel::Init_Params($aParams);
  569. MetaModel::Init_AddAttribute(new AttributeExternalKey("contact_id", array("targetclass"=>"bizContact", "label"=>"Contact", "description"=>"The contact", "allowed_values"=>null, "sql"=>"contact_id", "is_null_allowed"=>false, "depends_on"=>array())));
  570. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("label"=>"Contact Name", "description"=>"name of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"name")));
  571. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_phone", array("label"=>"Phone", "description"=>"Phone number of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"phone")));
  572. MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("label"=>"eMail", "description"=>"eMail address of the contact", "allowed_values"=>null, "extkey_attcode"=> 'contact_id', "target_attcode"=>"email")));
  573. MetaModel::Init_AddAttribute(new AttributeExternalKey("infra_id", array("targetclass"=>"logInfra", "label"=>"Infrastructure", "description"=>"Infrastructure linked", "allowed_values"=>null, "sql"=>"infra_id", "is_null_allowed"=>false, "depends_on"=>array())));
  574. MetaModel::Init_AddAttribute(new AttributeExternalField("infra_name", array("label"=>"Infrastructure", "description"=>"name of the linked infrastructure", "allowed_values"=>null, "extkey_attcode"=> 'infra_id', "target_attcode"=>"name")));
  575. MetaModel::Init_AddAttribute(new AttributeString("role", array("label"=>"Role", "description"=>"Role of the contact", "allowed_values"=>null, "sql"=>"role", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  576. MetaModel::Init_AddFilterFromAttribute("contact_id");
  577. MetaModel::Init_AddFilterFromAttribute("contact_name");
  578. MetaModel::Init_AddFilterFromAttribute("infra_id");
  579. MetaModel::Init_AddFilterFromAttribute("infra_name");
  580. MetaModel::Init_AddFilterFromAttribute("role");
  581. // Display lists
  582. MetaModel::Init_SetZListItems('details', array('contact_id', 'contact_phone', 'contact_email', 'infra_id', 'role')); // Attributes to be displayed for the complete details
  583. MetaModel::Init_SetZListItems('list', array('contact_id', 'contact_phone', 'contact_email', 'infra_id', 'role')); // Attributes to be displayed for a list
  584. }
  585. }
  586. ////////////////////////////////////////////////////////////////////////////////////
  587. /**
  588. * bizLocation (Region, Country, City, Site, Building, Floor, Room, Rack,...)
  589. * pourrait être mis en plusieurs sous objects, puisqu'une adresse sur region n'a pas trop de sens
  590. *
  591. */
  592. ////////////////////////////////////////////////////////////////////////////////////
  593. class bizLocation extends logInfra
  594. {
  595. public static function Init()
  596. {
  597. $aParams = array
  598. (
  599. "category" => "bizmodel,searchable",
  600. "name" => "Location",
  601. "description" => "Any type of location: Region, Country, City, Site, Building, Floor, Room, Rack,...",
  602. "key_type" => "",
  603. "key_label" => "id",
  604. "name_attcode" => "name",
  605. "state_attcode" => "",
  606. "reconc_keys" => array("org_name", "name"), // inherited attributes
  607. "db_table" => "location",
  608. "db_key_field" => "id",
  609. "db_finalclass_field" => "",
  610. "display_template" => "../business/templates/location.html",
  611. );
  612. MetaModel::Init_Params($aParams);
  613. MetaModel::Init_InheritAttributes();
  614. MetaModel::Init_AddAttribute(new AttributeText("address", array("label"=>"Address", "description"=>"The postal address of the location", "allowed_values"=>null, "sql"=>"address", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  615. MetaModel::Init_AddAttribute(new AttributeString("country", array("label"=>"Country", "description"=>"Country of the location", "allowed_values"=>null, "sql"=>"country", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  616. MetaModel::Init_AddAttribute(new AttributeExternalKey("parent_location_id", array("targetclass"=>"bizLocation", "label"=>"Parent Location", "description"=>"where is the real object physically located", "allowed_values"=>null, "sql"=>"parent_location_id", "is_null_allowed"=>true, "depends_on"=>array())));
  617. MetaModel::Init_AddAttribute(new AttributeExternalField("parent_location_name", array("label"=>"Parent location (Name)", "description"=>"name of the parent location", "allowed_values"=>null, "extkey_attcode"=> 'parent_location_id', "target_attcode"=>"name")));
  618. // on veut pouvoir rechercher une location qui soit un descendant (pas obligatoirement direct) d'une Location, on fait comment ?
  619. MetaModel::Init_InheritFilters();
  620. MetaModel::Init_AddFilterFromAttribute("country");
  621. MetaModel::Init_AddFilterFromAttribute("address");
  622. MetaModel::Init_AddFilterFromAttribute("parent_location_id");
  623. MetaModel::Init_AddFilterFromAttribute("parent_location_name");
  624. // Display lists
  625. MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'address', 'country', 'parent_location_id')); // Attributes to be displayed for the complete details
  626. MetaModel::Init_SetZListItems('list', array('name', 'status', 'org_id', 'country')); // Attributes to be displayed for a list
  627. // Search criteria
  628. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'country', 'parent_location_name')); // Criteria of the std search form
  629. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'address', 'country', 'parent_location_id', 'org_id')); // Criteria of the advanced search form
  630. }
  631. public function ComputeValues()
  632. {
  633. /*
  634. $this->Set("location_id", $this->GetKey());
  635. // Houston, I've got an issue, as this field is calculated, I should reload the object... ?
  636. $this->Set("location_name", "abc (to be finalized)");
  637. */
  638. }
  639. function DisplayDetails(web_page $oPage)
  640. {
  641. parent::DisplayDetails($oPage);
  642. /*
  643. parent::DisplayDetails($oPage);
  644. $oSearchFilter = new CMDBSearchFilter('bizServer');
  645. $oSearchFilter->AddCondition('location_id', $this->GetKey(), '=');
  646. $oSet = new CMDBObjectSet($oSearchFilter);
  647. $count = $oSet->Count();
  648. if ($count > 0)
  649. {
  650. $oPage->SetCurrentTab("Servers");
  651. $oPage->p("$count server(s) at this location:");
  652. $this->DisplaySet($oPage, $oSet);
  653. }
  654. $oSearchFilter = new CMDBSearchFilter('bizNetworkDevice');
  655. $oSearchFilter->AddCondition('location_id', $this->GetKey(), '=');
  656. $oSet = new CMDBObjectSet($oSearchFilter);
  657. $count = $oSet->Count();
  658. if ($count > 0)
  659. {
  660. $oPage->SetCurrentTab("Network Devices");
  661. $oPage->p("$count Network Device(s) at this location:");
  662. $this->DisplaySet($oPage, $oSet);
  663. }
  664. $oSearchFilter = new CMDBSearchFilter('bizPC');
  665. $oSearchFilter->AddCondition('location_id', $this->GetKey(), '=');
  666. $oSet = new CMDBObjectSet($oSearchFilter);
  667. $count = $oSet->Count();
  668. if ($count > 0)
  669. {
  670. $oPage->SetCurrentTab("PCs");
  671. $oPage->p("$count PC(s) at this location:");
  672. $this->DisplaySet($oPage, $oSet);
  673. }
  674. $oSearchFilter = new CMDBSearchFilter('bizPerson');
  675. $oSearchFilter->AddCondition('location_id', $this->GetKey(), '=');
  676. $oSet = new CMDBObjectSet($oSearchFilter);
  677. $count = $oSet->Count();
  678. if ($count > 0)
  679. {
  680. $oPage->SetCurrentTab("Contacts");
  681. $oPage->p("$count person(s) located to this location:");
  682. $this->DisplaySet($oPage, $oSet);
  683. }
  684. $oSearchFilter = new CMDBSearchFilter('lnkDocumentRealObject');
  685. $oSearchFilter->AddCondition('object_id', $this->GetKey(), '=');
  686. $oSet = new CMDBObjectSet($oSearchFilter);
  687. $count = $oSet->Count();
  688. if ($count > 0)
  689. {
  690. $oPage->SetCurrentTab("Details");
  691. $oPage->p("$count Document(s) linked to this location:");
  692. $this->DisplaySet($oPage, $oSet);
  693. }
  694. */
  695. }
  696. public function Generate(cmdbDataGenerator $oGenerator)
  697. {
  698. parent::Generate($oGenerator);
  699. $sLastName = $oGenerator->GenerateLastName();
  700. $sCityName = $oGenerator->GenerateCityName();
  701. $this->Set('name', $sCityName);
  702. $this->Set('country', $oGenerator->GenerateCountryName());
  703. $this->Set('address', $oGenerator->GenerateString("number(1-999)| |enum(rue,rue,rue,place,avenue,av.,route de)| |$sLastName| |number(0000-9999)|0 |$sCityName"));
  704. $this->Set('parent_location_id', 1);
  705. }
  706. }
  707. ////////////////////////////////////////////////////////////////////////////////////
  708. /**
  709. * Circuit (one end only)
  710. */
  711. ////////////////////////////////////////////////////////////////////////////////////
  712. class bizCircuit extends logInfra
  713. {
  714. public static function Init()
  715. {
  716. $aParams = array
  717. (
  718. "category" => "bizmodel,searchable",
  719. "name" => "Circuit",
  720. "description" => "Any type of circuit",
  721. "key_type" => "",
  722. "key_label" => "id",
  723. "name_attcode" => "name",
  724. "state_attcode" => "",
  725. "reconc_keys" => array("org_name", "carrier_name", "carrier_ref", "name"), // inherited attributes
  726. "db_table" => "circuits",
  727. "db_key_field" => "id",
  728. "db_finalclass_field" => "",
  729. "display_template" => "../business/templates/Circuits.html",
  730. );
  731. MetaModel::Init_Params($aParams);
  732. MetaModel::Init_InheritAttributes();
  733. MetaModel::Init_AddAttribute(new AttributeString("speed", array("label"=>"speed", "description"=>"speed of the circuit", "allowed_values"=>null, "sql"=>"speed", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  734. MetaModel::Init_AddAttribute(new AttributeExternalKey("location_id", array("targetclass"=>"bizLocation", "label"=>"Location ID", "description"=>"Id of the location", "allowed_values"=>null, "sql"=>"location_id", "is_null_allowed"=>false, "depends_on"=>array())));
  735. MetaModel::Init_AddAttribute(new AttributeExternalField("location_name", array("label"=>"Location", "description"=>"Name of the location", "allowed_values"=>null, "extkey_attcode"=> 'location_id', "target_attcode"=>"name")));
  736. MetaModel::Init_AddAttribute(new AttributeExternalKey("interface_id", array("targetclass"=>"bizInterface", "label"=>"Interface Id", "description"=>"id of the interface", "allowed_values"=>null, "sql"=>"interface_id", "is_null_allowed"=>false, "depends_on"=>array())));
  737. MetaModel::Init_AddAttribute(new AttributeExternalField("interface_name", array("label"=>"Interface", "description"=>"Name of the interface", "allowed_values"=>null, "extkey_attcode"=> 'interface_id', "target_attcode"=>"name")));
  738. MetaModel::Init_AddAttribute(new AttributeExternalKey("provider_id", array("targetclass"=>"bizOrganization", "label"=>"Carrier ID", "description"=>"Organization ID of the provider of the Circuit", "allowed_values"=>null, "sql"=>"provider_id", "is_null_allowed"=>false, "depends_on"=>array())));
  739. MetaModel::Init_AddAttribute(new AttributeExternalField("carrier_name", array("label"=>"Carrier", "description"=>"Name of the carrier", "allowed_values"=>null, "extkey_attcode"=> 'provider_id', "target_attcode"=>"name")));
  740. MetaModel::Init_AddAttribute(new AttributeString("carrier_ref", array("label"=>"Carrier reference", "description"=>"reference of the circuit used by the carrier", "allowed_values"=>null, "sql"=>"carrier_ref", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  741. MetaModel::Init_InheritFilters();
  742. MetaModel::Init_AddFilterFromAttribute("speed");
  743. MetaModel::Init_AddFilterFromAttribute("location_id");
  744. MetaModel::Init_AddFilterFromAttribute("location_name");
  745. MetaModel::Init_AddFilterFromAttribute("interface_id");
  746. MetaModel::Init_AddFilterFromAttribute("provider_id");
  747. MetaModel::Init_AddFilterFromAttribute("carrier_ref");
  748. // Display lists
  749. MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'speed', 'provider_id', 'carrier_ref', 'location_id')); // Attributes to be displayed for the complete details
  750. MetaModel::Init_SetZListItems('list', array('name', 'status', 'org_id', 'provider_id', 'carrier_ref', 'speed')); // Attributes to be displayed for a list
  751. // Search criteria
  752. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'carrier_ref', 'speed', 'provider_id')); // Criteria of the std search form
  753. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'carrier_ref', 'speed', 'provider_id')); // Criteria of the advanced search form
  754. }
  755. public function ComputeValues()
  756. {
  757. /*
  758. $oLocatedObject = MetaModel::GetObject("Located Object", $this->Get("located_object_id"));
  759. $this->Set("location_id", $oLocatedObject->Get("location_id"));
  760. // Houston, I've got an issue, as this field is calculated, I should reload the object...
  761. $this->Set("location_name", "abc (to be finalized)");
  762. $this->Set("device_id", $oLocatedObject->Get("device_id"));
  763. // Houston, I've got an issue, as this field is calculated, I should reload the object...
  764. $this->Set("device_name", "abc (to be finalized)");
  765. $this->Set("interface_id", $oLocatedObject->Get("interface_id"));
  766. // Houston, I've got an issue, as this field is calculated, I should reload the object...
  767. $this->Set("interface_name", "abc (to be finalized)");
  768. */
  769. }
  770. }
  771. ////////////////////////////////////////////////////////////////////////////////////
  772. /**
  773. * Any Device Network Interface
  774. */
  775. ////////////////////////////////////////////////////////////////////////////////////
  776. class bizInterface extends logInfra
  777. {
  778. public static function Init()
  779. {
  780. $aParams = array
  781. (
  782. "category" => "bizmodel,searchable",
  783. "name" => "Interface",
  784. "description" => "Interface",
  785. "key_type" => "",
  786. "key_label" => "id",
  787. "name_attcode" => "name",
  788. "state_attcode" => "",
  789. "reconc_keys" => array("org_name", "device_name", "name"),
  790. "db_table" => "interfaces",
  791. "db_key_field" => "id",
  792. "db_finalclass_field" => "",
  793. "display_template" => "../business/templates/interface.html",
  794. );
  795. MetaModel::Init_Params($aParams);
  796. MetaModel::Init_InheritAttributes();
  797. MetaModel::Init_AddAttribute(new AttributeExternalKey("device_id", array("targetclass"=>"bizDevice", "label"=>"Device", "description"=>"Device on which the interface is physically located", "allowed_values"=>null, "sql"=>"device_id", "is_null_allowed"=>false, "depends_on"=>array())));
  798. MetaModel::Init_AddAttribute(new AttributeExternalField("device_name", array("label"=>"Device", "description"=>"name of the device on which the interface is located", "allowed_values"=>null, "extkey_attcode"=> 'device_id', "target_attcode"=>"name")));
  799. MetaModel::Init_AddAttribute(new AttributeExternalField("device_location_id", array("label"=>"Device location", "description"=>"location of the device on which the interface is located", "allowed_values"=>null, "extkey_attcode"=> 'device_id', "target_attcode"=>"location_id")));
  800. MetaModel::Init_AddAttribute(new AttributeExternalField("device_location_name", array("label"=>"Device location", "description"=>"name of the location of the device on which the interface is located", "allowed_values"=>null, "extkey_attcode"=> 'device_id', "target_attcode"=>"location_name")));
  801. MetaModel::Init_AddAttribute(new AttributeEnum("logical_type", array("label"=>"Logical type", "description"=>"Logical type of interface", "allowed_values"=>new ValueSetEnum("primary,secondary,backup,port,logical"), "sql"=>"logical_type", "default_value"=>"port", "is_null_allowed"=>false, "depends_on"=>array())));
  802. MetaModel::Init_AddAttribute(new AttributeEnum("physical_type", array("label"=>"Physical type", "description"=>"Physical type of interface", "allowed_values"=>new ValueSetEnum("ethernet,framerelay,atm,vlan"), "sql"=>"physical_type", "default_value"=>"ethernet", "is_null_allowed"=>false, "depends_on"=>array())));
  803. MetaModel::Init_AddAttribute(new AttributeString("ip_address", array("label"=>"IP address", "description"=>"address IP for this interface", "allowed_values"=>null, "sql"=>"ip_address", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  804. MetaModel::Init_AddAttribute(new AttributeString("mask", array("label"=>"Subnet Mask", "description"=>"Subnet mask for this interface", "allowed_values"=>null, "sql"=>"mask", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  805. MetaModel::Init_AddAttribute(new AttributeString("mac", array("label"=>"MAC address", "description"=>"MAC address for this interface", "allowed_values"=>null, "sql"=>"mac", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  806. MetaModel::Init_AddAttribute(new AttributeString("speed", array("label"=>"Speed (Kb/s)", "description"=>"speed of this interface", "allowed_values"=>null, "sql"=>"speed", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  807. MetaModel::Init_AddAttribute(new AttributeEnum("duplex", array("label"=>"Duplex", "description"=>"Duplex configured for this interface", "allowed_values"=>new ValueSetEnum("half,full,unknown"), "sql"=>"duplex", "default_value"=>"unknown", "is_null_allowed"=>true, "depends_on"=>array())));
  808. MetaModel::Init_InheritFilters();
  809. MetaModel::Init_AddFilterFromAttribute("device_id");
  810. MetaModel::Init_AddFilterFromAttribute("device_name");
  811. MetaModel::Init_AddFilterFromAttribute("device_location_id");
  812. MetaModel::Init_AddFilterFromAttribute("logical_type");
  813. MetaModel::Init_AddFilterFromAttribute("physical_type");
  814. MetaModel::Init_AddFilterFromAttribute("ip_address");
  815. MetaModel::Init_AddFilterFromAttribute("mac");
  816. // Display lists
  817. MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'device_id', 'device_location_id','severity','logical_type','physical_type','ip_address','mask','mac','speed','duplex')); // Attributes to be displayed for the complete details
  818. MetaModel::Init_SetZListItems('list', array('name', 'status', 'org_id', 'device_id','severity')); // Attributes to be displayed for a list
  819. // Search criteria
  820. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'ip_address','mac','device_id')); // Criteria of the std search form
  821. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'device_id', 'org_id')); // Criteria of the advanced search form
  822. }
  823. function DisplayDetails(web_page $oPage)
  824. {
  825. parent::DisplayDetails($oPage);
  826. /*
  827. $oSearchFilter = new CMDBSearchFilter('lnkInterfaces');
  828. $oSearchFilter->AddCondition('interface1_id', $this->GetKey(), '=');
  829. $oSet = new CMDBObjectSet($oSearchFilter);
  830. $count = $oSet->Count();
  831. if ($count > 0)
  832. {
  833. $oPage->SetCurrentTab("Connected interfaces");
  834. $oPage->p("$count interface(s) connected to this device:");
  835. $this->DisplaySet($oPage, $oSet);
  836. }
  837. */
  838. }
  839. public function ComputeValues()
  840. {
  841. /*
  842. // my location is the location of my device
  843. $oDevice = MetaModel::GetObject("bizDevice", $this->Get("device_id"));
  844. $this->Set("location_id", $oDevice->Get("location_id"));
  845. // Houston, I've got an issue, as this field is calculated, I should reload the object...
  846. $this->Set("location_name", "abc (to be finalized)");
  847. // my device is given by my Creator
  848. // my interface is myself
  849. $this->Set("interface_id", $this->GetKey());
  850. // Houston, I've got an issue, as this field is calculated, I should reload the object...
  851. $this->Set("interface_name", "abc (to be finalized)");
  852. */
  853. }
  854. }
  855. ////////////////////////////////////////////////////////////////////////////////////
  856. /**
  857. * n-n link between any Interfaces
  858. */
  859. ////////////////////////////////////////////////////////////////////////////////////
  860. class lnkInterfaces extends cmdbAbstractObject
  861. {
  862. public static function Init()
  863. {
  864. $aParams = array
  865. (
  866. "category" => "bizmodel,searchable",
  867. "name" => "InterfacesLinks",
  868. "description" => "A link between two interfaces",
  869. "key_type" => "autoincrement",
  870. "key_label" => "link_id",
  871. "name_attcode" => "link_type",
  872. "state_attcode" => "",
  873. "reconc_keys" => array("interface1_id", "interface2_id"),
  874. "db_table" => "interfaces_links",
  875. "db_key_field" => "link_id",
  876. "db_finalclass_field" => "",
  877. "display_template" => "../business/templates/default.html",
  878. );
  879. MetaModel::Init_Params($aParams);
  880. MetaModel::Init_AddAttribute(new AttributeExternalKey("interface1_id", array("targetclass"=>"bizInterface", "label"=>"Interface", "description"=>"The interface1", "sql"=>"interface1_id", "allowed_values"=> null, "is_null_allowed"=>false, "depends_on"=>array())));
  881. MetaModel::Init_AddAttribute(new AttributeExternalField("interface1_name", array("label"=>"Interface1 Name", "description"=>"name of the interface1", "extkey_attcode"=> 'interface1_id', "allowed_values"=> null, "target_attcode"=>"name")));
  882. MetaModel::Init_AddAttribute(new AttributeExternalKey("interface2_id", array("targetclass"=>"bizInterface", "label"=>"Interface", "description"=>"The interface2", "sql"=>"interface2_id", "allowed_values"=> null, "is_null_allowed"=>false, "depends_on"=>array())));
  883. MetaModel::Init_AddAttribute(new AttributeExternalField("interface2_name", array("label"=>"Interface2 Name", "description"=>"name of the interface2", "extkey_attcode"=> 'interface2_id', "allowed_values"=> null, "target_attcode"=>"name")));
  884. MetaModel::Init_AddAttribute(new AttributeExternalField("interface1_device_id", array("label"=>"Device", "description"=>"device", "extkey_attcode"=> 'interface1_id', "allowed_values"=> null, "target_attcode"=>"device_id")));
  885. MetaModel::Init_AddAttribute(new AttributeExternalField("interface1_device_name", array("label"=>"Device Name", "description"=>"name of the device", "extkey_attcode"=> 'interface1_id', "allowed_values"=> null, "target_attcode"=>"device_name")));
  886. MetaModel::Init_AddAttribute(new AttributeExternalField("interface2_device_id", array("label"=>"Device", "description"=>"device", "extkey_attcode"=> 'interface2_id', "allowed_values"=> null, "target_attcode"=>"device_id")));
  887. MetaModel::Init_AddAttribute(new AttributeExternalField("interface2_device_name", array("label"=>"Device Name", "description"=>"name of the device", "extkey_attcode"=> 'interface2_id', "allowed_values"=> null, "target_attcode"=>"device_name")));
  888. MetaModel::Init_AddAttribute(new AttributeString("link_type", array("label"=>"Link Type", "description"=>"More information", "sql"=>"link_type", "default_value"=>"", "allowed_values"=> null, "is_null_allowed"=>false, "depends_on"=>array())));
  889. MetaModel::Init_AddFilterFromAttribute("interface1_id");
  890. MetaModel::Init_AddFilterFromAttribute("interface1_name");
  891. MetaModel::Init_AddFilterFromAttribute("interface2_id");
  892. MetaModel::Init_AddFilterFromAttribute("interface2_name");
  893. MetaModel::Init_AddFilterFromAttribute("interface2_device_name");
  894. MetaModel::Init_AddFilterFromAttribute("link_type");
  895. // Display lists
  896. MetaModel::Init_SetZListItems('details', array('interface1_id', 'interface2_id', 'link_type')); // Attributes to be displayed for the complete details
  897. MetaModel::Init_SetZListItems('list', array('interface1_id', 'interface1_device_id', 'interface2_id', 'interface2_device_id', 'link_type')); // Attributes to be displayed for the complete details
  898. }
  899. }
  900. ////////////////////////////////////////////////////////////////////////////////////
  901. /**
  902. * A subnet
  903. */
  904. ////////////////////////////////////////////////////////////////////////////////////
  905. class bizSubnet extends logInfra
  906. {
  907. public static function Init()
  908. {
  909. $aParams = array
  910. (
  911. "category" => "bizmodel,searchable",
  912. "name" => "Subnet",
  913. "description" => "Logical or physical subnet",
  914. "key_type" => "",
  915. "key_label" => "id",
  916. "name_attcode" => "name",
  917. "state_attcode" => "",
  918. "reconc_keys" => array("org_name", "name"), // inherited attributes
  919. "db_table" => "subnets",
  920. "db_key_field" => "id",
  921. "db_finalclass_field" => "",
  922. "display_template" => "",
  923. );
  924. MetaModel::Init_Params($aParams);
  925. MetaModel::Init_InheritAttributes();
  926. MetaModel::Init_AddAttribute(new AttributeString("ip", array("label"=>"IP", "description"=>"IP", "allowed_values"=>null, "sql"=>"ip", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  927. MetaModel::Init_AddAttribute(new AttributeString("mask", array("label"=>"IP mask", "description"=>"IP mask", "allowed_values"=>null, "sql"=>"mask", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  928. MetaModel::Init_InheritFilters();
  929. MetaModel::Init_AddFilterFromAttribute("ip");
  930. MetaModel::Init_AddFilterFromAttribute("mask");
  931. // Display lists
  932. MetaModel::Init_SetZListItems('details', array('name', 'ip','mask')); // Attributes to be displayed for the complete details
  933. MetaModel::Init_SetZListItems('list', array('name', 'ip', 'mask')); // Attributes to be displayed for a list
  934. // Search criteria
  935. MetaModel::Init_SetZListItems('standard_search', array('name', 'ip','mask')); // Criteria of the std search form
  936. MetaModel::Init_SetZListItems('advanced_search', array('name', 'ip','mask')); // Criteria of the advanced search form
  937. }
  938. function DisplayBareRelations(web_page $oPage)
  939. {
  940. parent::DisplayBareRelations($oPage);
  941. $oPage->SetCurrentTabContainer('Related Objects');
  942. $oPage->SetCurrentTab('IP Usage');
  943. $bit_ip = ip2long($this->Get('ip'));
  944. $bit_mask = ip2long($this->Get('mask'));
  945. $sIPMin = long2ip($bit_ip & $bit_mask);
  946. $sIPMax = long2ip(($bit_ip | (~$bit_mask)) - 1);
  947. $oPage->p("Interfaces having an IP in the range: <em>$sIPMin</em> to <em>$sIPMax</em>");
  948. $oIfSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT bizInterface AS if WHERE INET_ATON(if.ip_address) >= INET_ATON('$sIPMin') AND INET_ATON(if.ip_address) <= INET_ATON('$sIPMax')"));
  949. self::DisplaySet($oPage, $oIfSet);
  950. $iCountUsed = $oIfSet->Count();
  951. $iCountRange = ip2long($sIPMax) - ip2long($sIPMin);
  952. $iFreeCount = $iCountRange - $iCountUsed;
  953. $oPage->SetCurrentTab('Free IPs');
  954. $oPage->p("Free IPs: $iFreeCount");
  955. $oPage->p("Here is an extract of 10 free IP addresses");
  956. $aUsedIPs = $oIfSet->GetColumnAsArray('ip_address', false);
  957. $i = 0;
  958. while ($i < min($iFreeCount, 10))
  959. {
  960. $i++;
  961. $iAnIP = ip2long($sIPMin) + $i;
  962. if (in_array($iAnIP, $aUsedIPs)) continue;
  963. $sAnIP = long2ip($iAnIP);
  964. $oPage->p($sAnIP);
  965. }
  966. }
  967. }
  968. ////////////////////////////////////////////////////////////////////////////////////
  969. /**
  970. * Any electronic device
  971. */
  972. ////////////////////////////////////////////////////////////////////////////////////
  973. class bizDevice extends logInfra
  974. {
  975. public static function Init()
  976. {
  977. $aParams = array
  978. (
  979. "category" => "bizmodel,searchable",
  980. "name" => "Device",
  981. "description" => "Electronic devices",
  982. "key_type" => "",
  983. "key_label" => "id",
  984. "name_attcode" => "name",
  985. "state_attcode" => "",
  986. "reconc_keys" => array("org_name", "name"), // inherited attributes
  987. "db_table" => "devices",
  988. "db_key_field" => "id",
  989. "db_finalclass_field" => "",
  990. "display_template" => "../business/templates/default.html",
  991. );
  992. MetaModel::Init_Params($aParams);
  993. MetaModel::Init_InheritAttributes();
  994. MetaModel::Init_AddAttribute(new AttributeExternalKey("location_id", array("targetclass"=>"bizLocation", "label"=>"Location", "description"=>"where is the located object physically located", "allowed_values"=>null, "sql"=>"location_id", "is_null_allowed"=>false, "depends_on"=>array())));
  995. MetaModel::Init_AddAttribute(new AttributeExternalField("location_name", array("label"=>"Location Name", "description"=>"name of the location", "allowed_values"=>null, "extkey_attcode"=> 'location_id', "target_attcode"=>"name")));
  996. MetaModel::Init_AddAttribute(new AttributeExternalField("country", array("label"=>"Country", "description"=>"country where the device is located", "allowed_values"=>null, "extkey_attcode"=> 'location_id', "target_attcode"=>"country")));
  997. MetaModel::Init_AddAttribute(new AttributeString("brand", array("label"=>"Brand", "description"=>"The manufacturer of the device", "allowed_values"=>null, "sql"=>"brand", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  998. MetaModel::Init_AddAttribute(new AttributeString("model", array("label"=>"Model", "description"=>"The model number of the device", "allowed_values"=>null, "sql"=>"model", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  999. MetaModel::Init_AddAttribute(new AttributeString("serial_number", array("label"=>"Serial Number", "description"=>"The serial number of the device", "allowed_values"=>null, "sql"=>"serial_number", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1000. MetaModel::Init_AddAttribute(new AttributeString("mgmt_ip", array("label"=>"Mgmt IP", "description"=>"Management IP", "allowed_values"=>null, "sql"=>"mgmt_ip", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1001. MetaModel::Init_InheritFilters();
  1002. MetaModel::Init_AddFilterFromAttribute("location_id");
  1003. MetaModel::Init_AddFilterFromAttribute("country");
  1004. MetaModel::Init_AddFilterFromAttribute("brand");
  1005. MetaModel::Init_AddFilterFromAttribute("model");
  1006. MetaModel::Init_AddFilterFromAttribute("serial_number");
  1007. MetaModel::Init_AddFilterFromAttribute("mgmt_ip");
  1008. }
  1009. public static function GetRelationQueries($sRelCode)
  1010. {
  1011. switch ($sRelCode)
  1012. {
  1013. case "impacts":
  1014. $aRels = array(
  1015. "connected device" => array("sQuery"=>"bizDevice: PKEY IS device_id IN (bizInterface: PKEY IS interface2_id IN (lnkInterfaces: interface1_id IN (bizInterface: device_id = \$[this.pkey::])))", "bPropagate"=>true, "iDistance"=>3),
  1016. "hosted app" => array("sQuery"=>"bizApplication: infra_id = \$[this.pkey::]", "bPropagate"=>true, "iDistance"=>3),
  1017. );
  1018. return array_merge($aRels, parent::GetRelationQueries($sRelCode));
  1019. }
  1020. }
  1021. public function ComputeValues()
  1022. {
  1023. /*
  1024. // my location is the location of my device (external field)
  1025. $this->Set("location_id", $this->Get("device_location_id"));
  1026. // Houston, I've got an issue, as this field is calculated, I should reload the object...
  1027. $this->Set("location_name", "abc (to be finalized)");
  1028. // my device is myself
  1029. $this->Set("device_id", $this->GetKey());
  1030. // my interface is "nothing"
  1031. $this->Set("interface_id", null);
  1032. */
  1033. }
  1034. }
  1035. ////////////////////////////////////////////////////////////////////////////////////
  1036. /**
  1037. * A personal computer
  1038. */
  1039. ////////////////////////////////////////////////////////////////////////////////////
  1040. class bizPC extends bizDevice
  1041. {
  1042. public static function Init()
  1043. {
  1044. $aParams = array
  1045. (
  1046. "category" => "bizmodel,searchable",
  1047. "name" => "PC",
  1048. "description" => "Personal Computers",
  1049. "key_type" => "",
  1050. "key_label" => "id",
  1051. "name_attcode" => "name",
  1052. "state_attcode" => "",
  1053. "reconc_keys" => array("org_name", "name"), // inherited attributes
  1054. "db_table" => "pcs",
  1055. "db_key_field" => "id",
  1056. "db_finalclass_field" => "",
  1057. "display_template" => "../business/templates/pc.html",
  1058. );
  1059. MetaModel::Init_Params($aParams);
  1060. MetaModel::Init_InheritAttributes();
  1061. MetaModel::Init_AddAttribute(new AttributeEnum("type", array("label"=>"Type", "description"=>"Type of computer", "allowed_values"=>new ValueSetEnum("desktop PC,laptop"), "sql"=>"type", "default_value"=>"desktop PC", "is_null_allowed"=>false, "depends_on"=>array())));
  1062. MetaModel::Init_AddAttribute(new AttributeString("memory_size", array("label"=>"Memory Size", "description"=>"Size of the memory", "allowed_values"=>null, "sql"=>"memory_size", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1063. MetaModel::Init_AddAttribute(new AttributeString("cpu", array("label"=>"CPU", "description"=>"CPU type", "allowed_values"=>null, "sql"=>"cpu_type", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1064. MetaModel::Init_AddAttribute(new AttributeString("hdd_size", array("label"=>"HDD Size", "description"=>"Size of the hard drive", "allowed_values"=>null, "sql"=>"hdd_size", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1065. MetaModel::Init_AddAttribute(new AttributeString("os_family", array("label"=>"OS Family", "description"=>"Type of operating system", "allowed_values"=>null, "sql"=>"os_family", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1066. MetaModel::Init_AddAttribute(new AttributeString("os_version", array("label"=>"OS Version", "description"=>"Detailed version number of the operating system", "allowed_values"=>null, "sql"=>"os_version", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1067. MetaModel::Init_AddAttribute(new AttributeString("shipment_number", array("label"=>"Shipment Code", "description"=>"Number for tracking shipment", "allowed_values"=>null, "sql"=>"shipment_number", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1068. MetaModel::Init_AddAttribute(new AttributeString("default_gateway", array("label"=>"Default Gateway", "description"=>"Default Gateway for this device", "allowed_values"=>null, "sql"=>"default_gateway", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1069. MetaModel::Init_InheritFilters();
  1070. MetaModel::Init_AddFilterFromAttribute("type");
  1071. MetaModel::Init_AddFilterFromAttribute("memory_size");
  1072. MetaModel::Init_AddFilterFromAttribute("cpu");
  1073. MetaModel::Init_AddFilterFromAttribute("hdd_size");
  1074. MetaModel::Init_AddFilterFromAttribute("os_family");
  1075. MetaModel::Init_AddFilterFromAttribute("os_version");
  1076. // Display lists
  1077. MetaModel::Init_SetZListItems('details', array('name', 'status','severity', 'org_id', 'location_id', 'brand', 'model','os_family','os_version','mgmt_ip','default_gateway','shipment_number','serial_number', 'type', 'cpu', 'memory_size', 'hdd_size')); // Attributes to be displayed for the complete details
  1078. MetaModel::Init_SetZListItems('list', array('name', 'status', 'severity', 'org_id', 'location_id', 'brand', 'model', 'type')); // Attributes to be displayed for a list
  1079. // Search criteria
  1080. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'severity','type', 'brand', 'model','os_family','mgmt_ip')); // Criteria of the std search form
  1081. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'type', 'brand', 'model', 'cpu', 'memory_size', 'hdd_size')); // Criteria of the advanced search form
  1082. }
  1083. function DisplayDetails(web_page $oPage)
  1084. {
  1085. parent::DisplayDetails($oPage);
  1086. /*
  1087. parent::DisplayDetails($oPage);
  1088. $oSearchFilter = new CMDBSearchFilter('lnkContactRealObject');
  1089. $oSearchFilter->AddCondition('object_id', $this->GetKey(), '=');
  1090. $oSet = new CMDBObjectSet($oSearchFilter);
  1091. $count = $oSet->Count();
  1092. if ($count > 0)
  1093. {
  1094. $oPage->SetCurrentTab("Contacts");
  1095. $oPage->p("$count contact(s) linked to this PC:");
  1096. $this->DisplaySet($oPage, $oSet);
  1097. }
  1098. $oSearchFilter = new CMDBSearchFilter('bizInterface');
  1099. $oSearchFilter->AddCondition('device_id', $this->GetKey(), '=');
  1100. $oSet = new CMDBObjectSet($oSearchFilter);
  1101. $count = $oSet->Count();
  1102. if ($count > 0)
  1103. {
  1104. $oPage->SetCurrentTab("Interfaces");
  1105. $oPage->p("$count interface(s) for this device:");
  1106. $this->DisplaySet($oPage, $oSet);
  1107. }
  1108. */
  1109. }
  1110. public function Generate(cmdbDataGenerator $oGenerator)
  1111. {
  1112. $this->Set('org_id', $oGenerator->GetOrganizationId());
  1113. $this->Set('location_id', $oGenerator->GenerateKey("bizLocation", array('org_id' =>$oGenerator->GetOrganizationId() )));
  1114. $this->Set('name', $oGenerator->GenerateString("enum(pc,pc,pc,pc,pc,win,redhat,linux,srv,workstation)|number(000-999)|.|domain()"));
  1115. $this->Set('brand', $oGenerator->GenerateString("enum(Hewlett-Packard,Dell,Compaq,Siemens,Packard Bell,IBM,Gateway,Medion,Sony)"));
  1116. $this->Set('model', $oGenerator->GenerateString("enum(Vectra,Deskpro,Dimension,Optiplex,Latitude,Precision,Vaio)"));
  1117. $this->Set('serial_number', $oGenerator->GenerateString("enum(FR,US,TW,CH)|number(000000-999999)"));
  1118. $this->Set('memory_size', $oGenerator->GenerateString("enum(128,256,384,512,768,1024,1536,2048)"));
  1119. $this->Set('cpu', $oGenerator->GenerateString("enum(Pentium III,Pentium 4, Pentium M,Core Duo,Core 2 Duo,Celeron,Opteron,Thurion,Athlon)"));
  1120. $this->Set('hdd_size', $oGenerator->GenerateString("enum(40,60,80,120,200,300)"));
  1121. }
  1122. }
  1123. ////////////////////////////////////////////////////////////////////////////////////
  1124. /**
  1125. * A server
  1126. */
  1127. ////////////////////////////////////////////////////////////////////////////////////
  1128. class bizServer extends bizDevice
  1129. {
  1130. public static function Init()
  1131. {
  1132. $aParams = array
  1133. (
  1134. "category" => "bizmodel,searchable",
  1135. "name" => "Server",
  1136. "description" => "Computer Servers",
  1137. "key_type" => "",
  1138. "key_label" => "id",
  1139. "name_attcode" => "name",
  1140. "state_attcode" => "status",
  1141. "reconc_keys" => array("org_name", "name"), // inherited attributes
  1142. "db_table" => "servers",
  1143. "db_key_field" => "id",
  1144. "db_finalclass_field" => "",
  1145. "display_template" => "../business/templates/server.html",
  1146. );
  1147. MetaModel::Init_Params($aParams);
  1148. MetaModel::Init_InheritAttributes();
  1149. MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Status of the server", "allowed_values"=>new ValueSetEnum("In Store,Shipped,Plugged,Production Candidate,In Production,Being Deconfigured,Obsolete"), "sql"=>"status", "default_value"=>"In Store", "is_null_allowed"=>false, "depends_on"=>array())));
  1150. MetaModel::Init_AddAttribute(new AttributeString("memory_size", array("label"=>"Memory Size", "description"=>"Size of the memory", "allowed_values"=>null, "sql"=>"memory_size", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1151. MetaModel::Init_AddAttribute(new AttributeString("cpu", array("label"=>"Model", "description"=>"CPU type", "allowed_values"=>null, "sql"=>"cpu_type", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1152. MetaModel::Init_AddAttribute(new AttributeString("number_of_cpus", array("label"=>"Number of CPUs", "description"=>"Number of CPUs", "allowed_values"=>null, "sql"=>"number_of_cpus", "default_value"=>"1", "is_null_allowed"=>false, "depends_on"=>array())));
  1153. MetaModel::Init_AddAttribute(new AttributeString("hdd_size", array("label"=>"HDD Size", "description"=>"Size of the hard drive", "allowed_values"=>null, "sql"=>"hdd_size", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1154. MetaModel::Init_AddAttribute(new AttributeString("hdd_free_size", array("label"=>"Free HDD Size", "description"=>"Size of the free space on the hard drive(s)", "allowed_values"=>null, "sql"=>"hdd_free_size", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1155. MetaModel::Init_AddAttribute(new AttributeString("os_family", array("label"=>"OS Family", "description"=>"Type of operating system", "allowed_values"=>null, "sql"=>"os_family", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1156. MetaModel::Init_AddAttribute(new AttributeString("os_version", array("label"=>"OS Version", "description"=>"Detailed version number of the operating system", "allowed_values"=>null, "sql"=>"os_version", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1157. MetaModel::Init_AddAttribute(new AttributeString("shipment_number", array("label"=>"Shipment number", "description"=>"Number for tracking shipment", "allowed_values"=>null, "sql"=>"shipment_number", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1158. MetaModel::Init_AddAttribute(new AttributeString("default_gateway", array("label"=>"Default Gateway", "description"=>"Default Gateway for this device", "allowed_values"=>null, "sql"=>"default_gateway", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1159. MetaModel::Init_InheritFilters();
  1160. MetaModel::Init_AddFilterFromAttribute("memory_size");
  1161. MetaModel::Init_AddFilterFromAttribute("cpu");
  1162. MetaModel::Init_AddFilterFromAttribute("number_of_cpus");
  1163. MetaModel::Init_AddFilterFromAttribute("hdd_size");
  1164. MetaModel::Init_AddFilterFromAttribute("hdd_free_size");
  1165. MetaModel::Init_AddFilterFromAttribute("os_family");
  1166. MetaModel::Init_AddFilterFromAttribute("os_version");
  1167. // Life cycle
  1168. MetaModel::Init_DefineState("In Store", array("label"=>"InStore", "description"=>"Device in store", "attribute_inherit"=>null,
  1169. "attribute_list"=>array()));
  1170. MetaModel::Init_DefineState("Shipped", array("label"=>"Shipped", "description"=>"The device had been shipped to future location", "attribute_inherit"=>null,
  1171. "attribute_list"=>array("location_id"=>OPT_ATT_MANDATORY,"serial_number"=>OPT_ATT_MANDATORY,"shipment_number"=>OPT_ATT_MANDATORY)));
  1172. MetaModel::Init_DefineState("Plugged", array("label"=>"Plugged", "description"=>"The device is connected to the network", "attribute_inherit"=>null,
  1173. "attribute_list"=>array("location_id"=>OPT_ATT_MANDATORY,"mgmt_ip"=>OPT_ATT_MANDATORY,"name"=>OPT_ATT_MANDATORY)));
  1174. MetaModel::Init_DefineState("Production Candidate", array("label"=>"Pre-Production", "description"=>"The device is ready to be move to production", "attribute_inherit"=>null,
  1175. "attribute_list"=>array()));
  1176. MetaModel::Init_DefineState("In Production", array("label"=>"Production", "description"=>"The device is on production", "attribute_inherit"=>null,
  1177. "attribute_list"=>array()));
  1178. MetaModel::Init_DefineState("Being Deconfigured", array("label"=>"BeingDeconfigured", "description"=>"The device is about to be removed from is current location", "attribute_inherit"=>null,
  1179. "attribute_list"=>array()));
  1180. MetaModel::Init_DefineState("Obsolete", array("label"=>"Obsolete", "description"=>"The device is no more used", "attribute_inherit"=>null,
  1181. "attribute_list"=>array()));
  1182. MetaModel::Init_DefineStimulus("ev_store", new StimulusUserAction(array("label"=>"Store this server", "description"=>"This server is move to storage")));
  1183. MetaModel::Init_DefineStimulus("ev_ship", new StimulusUserAction(array("label"=>"Ship this server", "description"=>"This server is shipped to futur location")));
  1184. MetaModel::Init_DefineStimulus("ev_plug", new StimulusUserAction(array("label"=>"Plug this server", "description"=>"The server is pluuged on the network")));
  1185. MetaModel::Init_DefineStimulus("ev_configuration_finished", new StimulusUserAction(array("label"=>"Configuration finished", "description"=>"The device is ready to move to production evaluation")));
  1186. MetaModel::Init_DefineStimulus("ev_val_failed", new StimulusUserAction(array("label"=>"Review configuration", "description"=>"The configuration for this server is not completed")));
  1187. MetaModel::Init_DefineStimulus("ev_mtp", new StimulusUserAction(array("label"=>"Move to Production", "description"=>"The server is moved to production")));
  1188. MetaModel::Init_DefineStimulus("ev_decommission", new StimulusUserAction(array("label"=>"Decommission", "description"=>"The server is being decommissioned")));
  1189. MetaModel::Init_DefineStimulus("ev_obsolete", new StimulusUserAction(array("label"=>"Obsolete", "description"=>"The server is no more used")));
  1190. MetaModel::Init_DefineStimulus("ev_recycle", new StimulusUserAction(array("label"=>"Recycle this server", "description"=>"The server is move back to deconfiguration")));
  1191. MetaModel::Init_DefineTransition("In Store", "ev_ship", array("target_state"=>"Shipped", "actions"=>array(), "user_restriction"=>null));
  1192. MetaModel::Init_DefineTransition("In Store", "ev_plug", array("target_state"=>"Plugged", "actions"=>array(), "user_restriction"=>null));
  1193. MetaModel::Init_DefineTransition("Shipped", "ev_store", array("target_state"=>"In Store", "actions"=>array(), "user_restriction"=>null));
  1194. MetaModel::Init_DefineTransition("Shipped", "ev_plug", array("target_state"=>"Plugged", "actions"=>array(), "user_restriction"=>null));
  1195. MetaModel::Init_DefineTransition("Plugged", "ev_ship", array("target_state"=>"Shipped", "actions"=>array(), "user_restriction"=>null));
  1196. MetaModel::Init_DefineTransition("Plugged", "ev_store", array("target_state"=>"In Store", "actions"=>array(), "user_restriction"=>null));
  1197. MetaModel::Init_DefineTransition("Plugged", "ev_configuration_finished", array("target_state"=>"Production Candidate", "actions"=>array(), "user_restriction"=>null));
  1198. MetaModel::Init_DefineTransition("Production Candidate", "ev_val_failed", array("target_state"=>"Plugged", "actions"=>array(), "user_restriction"=>null));
  1199. MetaModel::Init_DefineTransition("Production Candidate", "ev_mtp", array("target_state"=>"In Production", "actions"=>array(), "user_restriction"=>null));
  1200. MetaModel::Init_DefineTransition("In Production", "ev_obsolete", array("target_state"=>"Obsolete", "actions"=>array(), "user_restriction"=>null));
  1201. MetaModel::Init_DefineTransition("In Production", "ev_decommission", array("target_state"=>"Being Deconfigured", "actions"=>array(), "user_restriction"=>null));
  1202. MetaModel::Init_DefineTransition("Being Deconfigured", "ev_ship", array("target_state"=>"Shipped", "actions"=>array(), "user_restriction"=>null));
  1203. MetaModel::Init_DefineTransition("Being Deconfigured", "ev_plug", array("target_state"=>"Plugged", "actions"=>array(), "user_restriction"=>null));
  1204. MetaModel::Init_DefineTransition("Being Deconfigured", "ev_store", array("target_state"=>"In Store", "actions"=>array(), "user_restriction"=>null));
  1205. MetaModel::Init_DefineTransition("Being Deconfigured", "ev_obsolete", array("target_state"=>"Obsolete", "actions"=>array(), "user_restriction"=>null));
  1206. MetaModel::Init_DefineTransition("Obsolete", "ev_recycle", array("target_state"=>"Being Deconfigured", "actions"=>array(), "user_restriction"=>null));
  1207. // Display lists
  1208. MetaModel::Init_SetZListItems('details', array('name', 'mgmt_ip','default_gateway','status', 'severity','org_id', 'location_id', 'brand', 'model', 'os_family', 'os_version','serial_number','shipment_number', 'cpu', 'number_of_cpus', 'memory_size', 'hdd_size', 'hdd_free_size')); // Attributes to be displayed for the complete details
  1209. MetaModel::Init_SetZListItems('list', array('name', 'status','severity', 'org_id', 'location_id', 'brand', 'model', 'os_family', 'os_version')); // Attributes to be displayed for a list
  1210. // Search criteria
  1211. MetaModel::Init_SetZListItems('standard_search', array('name', 'status','severity', 'brand', 'model', 'os_family', 'location_id')); // Criteria of the std search form
  1212. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status','brand', 'model', 'os_family', 'os_version', 'location_id', 'cpu', 'number_of_cpus', 'memory_size', 'hdd_size', 'hdd_free_size')); // Criteria of the advanced search form
  1213. }
  1214. function DisplayDetails(web_page $oPage)
  1215. {
  1216. parent::DisplayDetails($oPage);
  1217. /*
  1218. parent::DisplayDetails($oPage);
  1219. $oSearchFilter = new CMDBSearchFilter('lnkContactRealObject');
  1220. $oSearchFilter->AddCondition('object_id', $this->GetKey(), '=');
  1221. $oSet = new CMDBObjectSet($oSearchFilter);
  1222. $count = $oSet->Count();
  1223. if ($count > 0)
  1224. {
  1225. $oPage->SetCurrentTab("Contacts");
  1226. $oPage->p("$count contact(s) for this server:");
  1227. $this->DisplaySet($oPage, $oSet);
  1228. }
  1229. $oSearchFilter = new CMDBSearchFilter('bizInterface');
  1230. $oSearchFilter->AddCondition('device_id', $this->GetKey(), '=');
  1231. $oSet = new CMDBObjectSet($oSearchFilter);
  1232. $count = $oSet->Count();
  1233. if ($count > 0)
  1234. {
  1235. $oPage->SetCurrentTab("Interfaces");
  1236. $oPage->p("$count interface(s) for this server:");
  1237. $this->DisplaySet($oPage, $oSet);
  1238. }
  1239. $oSearchFilter = new CMDBSearchFilter('Application');
  1240. $oSearchFilter->AddCondition('infra_id', $this->GetKey(), '=');
  1241. $oSet = new CMDBObjectSet($oSearchFilter);
  1242. $count = $oSet->Count();
  1243. if ($count > 0)
  1244. {
  1245. $oPage->SetCurrentTab("Installed applications");
  1246. $oPage->p("$count application(s) installed on this server:");
  1247. $this->DisplaySet($oPage, $oSet);
  1248. }
  1249. $oSearchFilter = new CMDBSearchFilter('bizPatch');
  1250. $oSearchFilter->AddCondition('infra_id', $this->GetKey(), '=');
  1251. $oSet = new CMDBObjectSet($oSearchFilter);
  1252. $count = $oSet->Count();
  1253. if ($count > 0)
  1254. {
  1255. $oPage->SetCurrentTab("Installed patches");
  1256. $oPage->p("$count patch(s) installed on this server:");
  1257. $this->DisplaySet($oPage, $oSet);
  1258. }
  1259. */
  1260. }
  1261. public function Generate(cmdbDataGenerator $oGenerator)
  1262. {
  1263. $this->Set('org_id', $oGenerator->GetOrganizationId());
  1264. $this->Set('location_id', $oGenerator->GenerateKey("bizLocation", array('org_id' =>$oGenerator->GetOrganizationId() )));
  1265. $this->Set('name', $oGenerator->GenerateString("enum(pc,pc,pc,pc,pc,win,redhat,linux,srv,workstation)|number(000-999)|.|domain()"));
  1266. $this->Set('brand', $oGenerator->GenerateString("enum(Hewlett-Packard,Dell,Compaq,Siemens,Packard Bell,IBM,Gateway,Medion,Sony)"));
  1267. $this->Set('model', $oGenerator->GenerateString("enum(Vectra,Deskpro,Dimension,Optiplex,Latitude,Precision,Vaio)"));
  1268. $this->Set('serial_number', $oGenerator->GenerateString("enum(FR,US,TW,CH)|number(000000-999999)"));
  1269. $this->Set('memory_size', $oGenerator->GenerateString("enum(512,1024,2048,4096,2048,4096,8192,8192,8192,16384,32768)"));
  1270. $this->Set('cpu', $oGenerator->GenerateString("enum(Pentium III,Pentium 4,Pentium M,Core Duo,Core 2 Duo,Celeron,Opteron,Thurion,Athlon)"));
  1271. $this->Set('number_of_cpu', $oGenerator->GenerateString("enum(1,1,2,2,2,2,2,4,4,8)"));
  1272. $this->Set('hdd_size', $oGenerator->GenerateString("enum(500,1024,500,1024,500,1024,2048)"));
  1273. $this->Set('hdd_free_size', $this->Get('hdd_size')*$oGenerator->GenerateString("number(20-80)"));
  1274. $this->Set('os_family', $oGenerator->GenerateString("enum(Windows,Windows,Windows,Linux,Windows,Linux,Windows,Linux,Linux,HP-UX,Solaris,AIX)"));
  1275. $this->Set('os_version', $oGenerator->GenerateString("enum(XP,XP,XP,RH EL 4,RH EL 5,SuSE 10.3,SuSE 10.4,11.11,11.11i)"));
  1276. }
  1277. }
  1278. ////////////////////////////////////////////////////////////////////////////////////
  1279. /**
  1280. * A network device
  1281. */
  1282. ////////////////////////////////////////////////////////////////////////////////////
  1283. class bizNetworkDevice extends bizDevice
  1284. {
  1285. public static function Init()
  1286. {
  1287. $aParams = array
  1288. (
  1289. "category" => "bizmodel,searchable",
  1290. "name" => "Network Device",
  1291. "description" => "A network device",
  1292. "key_type" => "",
  1293. "key_label" => "id",
  1294. "name_attcode" => "name",
  1295. "state_attcode" => "",
  1296. "reconc_keys" => array("org_name", "name"), // inherited attributes
  1297. "db_table" => "network_devices",
  1298. "db_key_field" => "id",
  1299. "db_finalclass_field" => "",
  1300. "display_template" => "../business/templates/network.device.html",
  1301. );
  1302. MetaModel::Init_Params($aParams);
  1303. MetaModel::Init_InheritAttributes();
  1304. MetaModel::Init_AddAttribute(new AttributeEnum("type", array("label"=>"Type", "description"=>"Type of device", "allowed_values"=>new ValueSetEnum("switch,router,firewall,load balancer,hub,WAN accelerator"), "sql"=>"type", "default_value"=>"switch", "is_null_allowed"=>false, "depends_on"=>array())));
  1305. MetaModel::Init_AddAttribute(new AttributeString("default_gateway", array("label"=>"Default Gateway", "description"=>"Default Gateway for this device", "allowed_values"=>null, "sql"=>"default_gateway", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1306. MetaModel::Init_AddAttribute(new AttributeString("ios_version", array("label"=>"IOS version", "description"=>"IOS (software) version", "allowed_values"=>null, "sql"=>"ios_version", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1307. MetaModel::Init_AddAttribute(new AttributeString("memory", array("label"=>"Memory", "description"=>"Memory description", "allowed_values"=>null, "sql"=>"memory", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1308. MetaModel::Init_AddAttribute(new AttributeString("snmp_read", array("label"=>"SNMP Community (Read)", "description"=>"SNMP Read Community String", "allowed_values"=>null, "sql"=>"snmp_read", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1309. MetaModel::Init_AddAttribute(new AttributeString("snmp_write", array("label"=>"SNMP Community (Write)", "description"=>"SNMP Write Community String", "allowed_values"=>null, "sql"=>"snmp_write", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1310. MetaModel::Init_InheritFilters();
  1311. MetaModel::Init_AddFilterFromAttribute("type");
  1312. MetaModel::Init_AddFilterFromAttribute("ios_version");
  1313. // Display lists
  1314. MetaModel::Init_SetZListItems('details', array('name', 'status','severity','org_id', 'location_id', 'brand','model','type','mgmt_ip','default_gateway','serial_number','ios_version','memory','snmp_read','snmp_write')); // Attributes to be displayed for the complete details
  1315. MetaModel::Init_SetZListItems('list', array('name', 'status','brand','model','type','mgmt_ip')); // Attributes to be displayed for a list
  1316. // Search criteria
  1317. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'location_id', 'brand','model','type','mgmt_ip')); // Criteria of the std search form
  1318. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'org_id', 'location_id', 'brand','model','type','mgmt_ip','serial_number','ios_version','snmp_read','snmp_write')); // Criteria of the advanced search form
  1319. }
  1320. public function Generate(cmdbDataGenerator $oGenerator)
  1321. {
  1322. $this->Set('org_id', $oGenerator->GetOrganizationId());
  1323. $this->Set('location_id', $oGenerator->GenerateKey("bizLocation", array('org_id' =>$oGenerator->GetOrganizationId() )));
  1324. $this->Set('name', $oGenerator->GenerateString("enum(sw,swi,switch,rout,rtr,gw)|number(000-999)|.|domain()"));
  1325. $this->Set('brand', $oGenerator->GenerateString("enum(Hewlett-Packard,Cisco,3Com,Avaya,Alcatel,Cabletron,Extrem Networks,Juniper,Netgear,Synopitcs,Xylan)"));
  1326. $this->Set('model', $oGenerator->GenerateString("enum(Procurve ,Catalyst ,Multiswitch ,C)|enum(25,26,36,40,65)|enum(00,09,10,50)"));
  1327. $this->Set('serial_number', $oGenerator->GenerateString("enum(FAA,AGA,PAD,COB,DFE)|number(0000-9999)|enum(M,X,L)"));
  1328. $this->Set('ip_address', $oGenerator->GenerateString("number(10-248)|.|number(1-254)|.|number(1-254)|.|number(1-254)"));
  1329. $this->Set('ios_version', $oGenerator->GenerateString("enum(9,10,12)|.|enum(0,1,2)|enum(,,,,XP,.5.1)"));
  1330. $this->Set('snmp_read', $oGenerator->GenerateString("enum(Ew,+0,**,Ps)|number(00-99)|enum(+,=,],;, )|enum(Aze,Vbn,Bbn,+9+,-9-,#)"));
  1331. $this->Set('snmp_write', $oGenerator->GenerateString("enum(M3,l3,$,*,Zz,Ks,jh)|number(00-99)|enum(A*e,V%n,Bbn,+,-,#)|number(0-9)"));
  1332. }
  1333. }
  1334. ////////////////////////////////////////////////////////////////////////////////////
  1335. /**
  1336. * A "Solution"
  1337. */
  1338. ////////////////////////////////////////////////////////////////////////////////////
  1339. class bizInfraGroup extends logInfra
  1340. {
  1341. public static function Init()
  1342. {
  1343. $aParams = array
  1344. (
  1345. "category" => "bizmodel,searchable",
  1346. "name" => "Infra Group",
  1347. "description" => "A group of infrastructure elements",
  1348. "key_type" => "",
  1349. "key_label" => "id",
  1350. "name_attcode" => "name",
  1351. "state_attcode" => "",
  1352. "reconc_keys" => array("org_name", "name"), // inherited attributes
  1353. "db_table" => "infra_group",
  1354. "db_key_field" => "id",
  1355. "db_finalclass_field" => "",
  1356. "display_template" => "../business/templates/group.html",
  1357. );
  1358. MetaModel::Init_Params($aParams);
  1359. MetaModel::Init_InheritAttributes();
  1360. MetaModel::Init_AddAttribute(new AttributeEnum("type", array("label"=>"Type", "description"=>"Type of groupe", "allowed_values"=>new ValueSetEnum("Monitoring,Reporting,list"), "sql"=>"type", "default_value"=>"list", "is_null_allowed"=>true, "depends_on"=>array())));
  1361. MetaModel::Init_AddAttribute(new AttributeString("description", array("label"=>"Description", "description"=>"usage of the Group", "allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1362. MetaModel::Init_AddAttribute(new AttributeExternalKey("parent_group_id", array("targetclass"=>"bizInfraGroup", "label"=>"Parent Group", "description"=>"including group", "allowed_values"=>null, "sql"=>"parent_group_id", "is_null_allowed"=>true, "depends_on"=>array())));
  1363. MetaModel::Init_AddAttribute(new AttributeExternalField("parent_group_name", array("label"=>"Parent Group (Name)", "description"=>"name of the parent group", "allowed_values"=>null, "extkey_attcode"=> 'parent_group_id', "target_attcode"=>"name")));
  1364. MetaModel::Init_InheritFilters();
  1365. MetaModel::Init_AddFilterFromAttribute("type");
  1366. MetaModel::Init_AddFilterFromAttribute("parent_group_id");
  1367. MetaModel::Init_AddFilterFromAttribute("parent_group_name");
  1368. // Display lists
  1369. MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'type', 'description','parent_group_id')); // Attributes to be displayed for a list
  1370. MetaModel::Init_SetZListItems('list', array('name', 'status', 'org_id', 'type', 'description')); // Attributes to be displayed for a list
  1371. // Search criteria
  1372. MetaModel::Init_SetZListItems('standard_search', array('name', 'status', 'type')); // Criteria of the std search form
  1373. MetaModel::Init_SetZListItems('advanced_search', array('name', 'status', 'type', 'description', 'org_id')); // Criteria of the advanced search form
  1374. }
  1375. function DisplayDetails(web_page $oPage)
  1376. {
  1377. parent::DisplayDetails($oPage);
  1378. /*
  1379. $oSearchFilter = new CMDBSearchFilter('lnkInfraGrouping');
  1380. $oSearchFilter->AddCondition('infra_group_id', $this->GetKey(), '=');
  1381. $oSet = new CMDBObjectSet($oSearchFilter);
  1382. $count = $oSet->Count();
  1383. if ($count > 0)
  1384. {
  1385. $oPage->SetCurrentTab("RelatedInfrastructure");
  1386. $oPage->p("Infrastructure Link to this group:");
  1387. $this->DisplaySet($oPage, $oSet);
  1388. }
  1389. $oSearchFilter = new CMDBSearchFilter('lnkContactRealObject');
  1390. $oSearchFilter->AddCondition('object_id', $this->GetKey(), '=');
  1391. $oSet = new CMDBObjectSet($oSearchFilter);
  1392. $count = $oSet->Count();
  1393. if ($count > 0)
  1394. {
  1395. $oPage->SetCurrentTab("TeamLinks");
  1396. $oPage->p("People concerned by this group:");
  1397. $this->DisplaySet($oPage, $oSet);
  1398. }
  1399. */
  1400. }
  1401. public function Generate(cmdbDataGenerator $oGenerator)
  1402. {
  1403. $this->Set('org_id', $oGenerator->GetOrganizationId());
  1404. $this->Set('name', $oGenerator->GenerateString("enum(ov_nnm_,ovpi_,vitalnet_,datacenter_,web_farm_)|number(000-999)"));
  1405. $this->Set('type', $oGenerator->GenerateString("enum(Application,Infrastructure)"));
  1406. }
  1407. }
  1408. ////////////////////////////////////////////////////////////////////////////////////
  1409. //**
  1410. //* An application is an instance of a software install on a PC or Server
  1411. //*
  1412. ////////////////////////////////////////////////////////////////////////////////////
  1413. class bizApplication extends logInfra
  1414. {
  1415. public static function Init()
  1416. {
  1417. $aParams = array
  1418. (
  1419. "category" => "bizmodel,searchable",
  1420. "name" => "Application",
  1421. "description" => "General application",
  1422. "key_type" => "",
  1423. "key_label" => "id",
  1424. "name_attcode" => "name",
  1425. "state_attcode" => "",
  1426. "reconc_keys" => array("device_name", "name"), // inherited attributes
  1427. "db_table" => "applications",
  1428. "db_key_field" => "id",
  1429. "db_finalclass_field" => "",
  1430. "display_template" => "../business/templates/application.html",
  1431. );
  1432. MetaModel::Init_Params($aParams);
  1433. MetaModel::Init_InheritAttributes();
  1434. MetaModel::Init_AddAttribute(new AttributeExternalKey("device_id", array("targetclass"=>"bizDevice", "jointype"=> '', "label"=>"Hosting device", "description"=>"The device where application is installed", "allowed_values"=>null, "sql"=>"device_id", "is_null_allowed"=>false, "depends_on"=>array())));
  1435. MetaModel::Init_AddAttribute(new AttributeExternalField("device_name", array("label"=>"Hosting device", "description"=>"Name of the device where application is installed", "allowed_values"=>null, "extkey_attcode"=> 'device_id', "target_attcode"=>"name")));
  1436. MetaModel::Init_AddAttribute(new AttributeDate("install_date", array("label"=>"Installation Date", "description"=>"Date when application was installed", "allowed_values"=>null, "sql"=>"install_date", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1437. MetaModel::Init_AddAttribute(new AttributeString("version", array("label"=>"Version", "description"=>"Application version", "allowed_values"=>null, "sql"=>"version", "default_value"=>"undefined", "is_null_allowed"=>false, "depends_on"=>array())));
  1438. MetaModel::Init_AddAttribute(new AttributeString("function", array("label"=>"Function", "description"=>"Function provided by this application", "allowed_values"=>null, "sql"=>"function", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1439. MetaModel::Init_InheritFilters();
  1440. MetaModel::Init_AddFilterFromAttribute("function");
  1441. MetaModel::Init_AddFilterFromAttribute("version");
  1442. MetaModel::Init_AddFilterFromAttribute("device_id");
  1443. MetaModel::Init_AddFilterFromAttribute("device_name");
  1444. // Display lists
  1445. MetaModel::Init_SetZListItems('details', array('name','device_id','org_id','status','install_date', 'version','function')); // Attributes to be displayed for the complete details
  1446. MetaModel::Init_SetZListItems('list', array('name','device_id', 'version', 'function')); // Attributes to be displayed for a list
  1447. // Search criteria
  1448. MetaModel::Init_SetZListItems('standard_search', array('name', 'device_id','version','function')); // Criteria of the std search form
  1449. MetaModel::Init_SetZListItems('advanced_search', array('name', 'device_id','version','function')); // Criteria of the advanced search form
  1450. }
  1451. public static function GetRelationQueries($sRelCode)
  1452. {
  1453. switch ($sRelCode)
  1454. {
  1455. case "impacts":
  1456. $aRels = array(
  1457. "client app" => array("sQuery"=>"bizApplication: PKEY IS client_id IN (lnkClientServer: server_id = \$[this.pkey::])", "bPropagate"=>true, "iDistance"=>3),
  1458. );
  1459. return array_merge($aRels, parent::GetRelationQueries($sRelCode));
  1460. }
  1461. }
  1462. function DisplayDetails(web_page $oPage)
  1463. {
  1464. parent::DisplayDetails($oPage);
  1465. /*
  1466. $oSearchFilter = new CMDBSearchFilter('lnkClientServer');
  1467. $oSearchFilter->AddCondition('server_id', $this->GetKey(), '=');
  1468. $oSet = new CMDBObjectSet($oSearchFilter);
  1469. $count = $oSet->Count();
  1470. if ($count > 0)
  1471. {
  1472. $oPage->SetCurrentTab("Connected clients");
  1473. $oPage->p("Client applications impacted when down:");
  1474. $this->DisplaySet($oPage, $oSet);
  1475. }
  1476. */
  1477. }
  1478. }
  1479. ////////////////////////////////////////////////////////////////////////////////////
  1480. /**
  1481. * n-n link between any Infra and a Group
  1482. */
  1483. ////////////////////////////////////////////////////////////////////////////////////
  1484. class lnkInfraGrouping extends cmdbAbstractObject
  1485. {
  1486. public static function Init()
  1487. {
  1488. $aParams = array
  1489. (
  1490. "category" => "bizmodel,searchable",
  1491. "name" => "Infra Grouping",
  1492. "description" => "Infra part of an Infra Group",
  1493. "key_type" => "autoincrement",
  1494. "key_label" => "link_id",
  1495. "name_attcode" => "impact",
  1496. "state_attcode" => "",
  1497. "reconc_keys" => array(""),
  1498. "db_table" => "infra_grouping",
  1499. "db_key_field" => "link_id",
  1500. "db_finalclass_field" => "",
  1501. "display_template" => "../business/templates/default.html",
  1502. );
  1503. MetaModel::Init_Params($aParams);
  1504. MetaModel::Init_AddAttribute(new AttributeExternalKey("infra_id", array("targetclass"=>"logInfra", "jointype"=> '', "label"=>"Infrastructure", "description"=>"Infrastructure part of the group", "allowed_values"=>null, "sql"=>"infra_id", "is_null_allowed"=>false, "depends_on"=>array())));
  1505. MetaModel::Init_AddAttribute(new AttributeExternalField("infra_name", array("label"=>"Infrastructure Name", "description"=>"Name of the impacted infrastructure", "allowed_values"=>null, "extkey_attcode"=> 'infra_id', "target_attcode"=>"name")));
  1506. MetaModel::Init_AddAttribute(new AttributeExternalField("infra_status", array("label"=>"Status", "description"=>"Status of the impacted infrastructure", "allowed_values"=>null, "extkey_attcode"=> 'infra_id', "target_attcode"=>"status")));
  1507. MetaModel::Init_AddAttribute(new AttributeExternalKey("infra_group_id", array("targetclass"=>"bizInfraGroup", "jointype"=> '', "label"=>"Group", "description"=>"Name of the group", "allowed_values"=>null, "sql"=>"infra_group_id", "is_null_allowed"=>false, "depends_on"=>array())));
  1508. MetaModel::Init_AddAttribute(new AttributeExternalField("group_name", array("label"=>"Group Name", "description"=>"Name of the group containing infrastructure", "allowed_values"=>null, "extkey_attcode"=> 'infra_group_id', "target_attcode"=>"name")));
  1509. MetaModel::Init_AddAttribute(new AttributeString("impact", array("label"=>"Relation", "description"=>"Relation between this group and infra", "allowed_values"=>null, "sql"=>"impact", "default_value"=>"none", "is_null_allowed"=>true, "depends_on"=>array())));
  1510. // impact should modelized: enum (eg: if the group si dead when infra is dead)
  1511. MetaModel::Init_AddFilterFromAttribute("infra_id");
  1512. MetaModel::Init_AddFilterFromAttribute("infra_group_id");
  1513. MetaModel::Init_AddFilterFromAttribute("impact");
  1514. // Display lists
  1515. MetaModel::Init_SetZListItems('details', array('infra_id','infra_status', 'impact', 'infra_group_id')); // Attributes to be displayed for a list
  1516. MetaModel::Init_SetZListItems('list', array('infra_id','infra_status', 'impact', 'infra_group_id')); // Attributes to be displayed for a list
  1517. // Search criteria
  1518. MetaModel::Init_SetZListItems('standard_search', array('infra_id', 'infra_group_id', 'impact')); // Criteria of the std search form
  1519. MetaModel::Init_SetZListItems('advanced_search', array('infra_id', 'infra_group_id', 'impact')); // Criteria of the advanced search form
  1520. }
  1521. public function Generate(cmdbDataGenerator $oGenerator)
  1522. {
  1523. $this->Set('infra_id', $oGenerator->GenerateKey("logInfra", array('org_id' =>$oGenerator->GetOrganizationId() )));
  1524. $this->Set('infra_group_id', $oGenerator->GenerateKey("bizInfraGroup", array('org_id' =>$oGenerator->GetOrganizationId() )));
  1525. $this->Set('impact', $oGenerator->GenerateString("enum(none,mandatory,partial)"));
  1526. }
  1527. }
  1528. ////////////////////////////////////////////////////////////////////////////////////
  1529. /**
  1530. * n-n link between two applications, one is the server side and the scond one the client*/
  1531. ////////////////////////////////////////////////////////////////////////////////////
  1532. class lnkClientServer extends logRealObject
  1533. {
  1534. public static function Init()
  1535. {
  1536. $aParams = array
  1537. (
  1538. "category" => "bizmodel,searchable",
  1539. "name" => "ClientServerLinks",
  1540. "description" => "Link between client server application",
  1541. "key_type" => "autoincrement",
  1542. "key_label" => "link_id",
  1543. "name_attcode" => "relation", // ????
  1544. "state_attcode" => "",
  1545. "reconc_keys" => array("relation"), // ????
  1546. "db_table" => "clientserver_links",
  1547. "db_key_field" => "link_id",
  1548. "db_finalclass_field" => "",
  1549. "display_template" => "../business/templates/default.html",
  1550. );
  1551. MetaModel::Init_Params($aParams);
  1552. MetaModel::Init_AddAttribute(new AttributeExternalKey("client_id", array("targetclass"=>"bizApplication", "jointype"=> '', "label"=>"Client", "description"=>"The client part of the link", "allowed_values"=>null, "sql"=>"client_id", "is_null_allowed"=>false, "depends_on"=>array())));
  1553. MetaModel::Init_AddAttribute(new AttributeExternalField("client_name", array("label"=>"Client", "description"=>"Name of the client", "allowed_values"=>null, "extkey_attcode"=> 'client_id', "target_attcode"=>"name")));
  1554. MetaModel::Init_AddAttribute(new AttributeExternalKey("server_id", array("targetclass"=>"bizApplication", "jointype"=> '', "label"=>"Server", "description"=>"the server part of the link", "allowed_values"=>null, "sql"=>"server_id", "is_null_allowed"=>false, "depends_on"=>array())));
  1555. MetaModel::Init_AddAttribute(new AttributeExternalField("server_name", array("label"=>"Server", "description"=>"Name of the server", "allowed_values"=>null, "extkey_attcode"=> 'server_id', "target_attcode"=>"name")));
  1556. MetaModel::Init_AddAttribute(new AttributeString("relation", array("label"=>"Relation", "description"=>"Type of relation between both application", "allowed_values"=>null, "sql"=>"relation", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1557. MetaModel::Init_AddFilterFromAttribute("client_id");
  1558. MetaModel::Init_AddFilterFromAttribute("server_id");
  1559. // Display lists
  1560. MetaModel::Init_SetZListItems('details', array('client_id', 'server_id', 'relation')); // Attributes to be displayed for a list
  1561. MetaModel::Init_SetZListItems('list', array('client_id', 'server_id', 'relation')); // Attributes to be displayed for a list
  1562. // Search criteria
  1563. MetaModel::Init_SetZListItems('standard_search', array('client_id', 'server_id')); // Criteria of the std search form
  1564. MetaModel::Init_SetZListItems('advanced_search', array('client_id', 'server_id')); // Criteria of the advanced search form
  1565. }
  1566. }
  1567. ////////////////////////////////////////////////////////////////////////////////////
  1568. //**
  1569. //* A patch is an application or OS fixe for an infrastructure
  1570. //*
  1571. ////////////////////////////////////////////////////////////////////////////////////
  1572. class bizPatch extends logRealObject
  1573. {
  1574. public static function Init()
  1575. {
  1576. $aParams = array
  1577. (
  1578. "category" => "bizmodel,searchable",
  1579. "name" => "Patch",
  1580. "description" => "Patch installed on infrastucture",
  1581. "key_type" => "",
  1582. "key_label" => "id",
  1583. "name_attcode" => "name",
  1584. "state_attcode" => "",
  1585. "reconc_keys" => array("device_name", "name"), // inherited attributes
  1586. "db_table" => "patches",
  1587. "db_key_field" => "id",
  1588. "db_finalclass_field" => "",
  1589. "display_template" => "../business/templates/default.html",
  1590. );
  1591. MetaModel::Init_Params($aParams);
  1592. MetaModel::Init_InheritAttributes();
  1593. MetaModel::Init_AddAttribute(new AttributeExternalKey("device_id", array("targetclass"=>"bizDevice", "jointype"=> '', "label"=>"Device", "description"=>"The Device where patch is installed", "allowed_values"=>null, "sql"=>"device_id", "is_null_allowed"=>false, "depends_on"=>array())));
  1594. MetaModel::Init_AddAttribute(new AttributeExternalField("device_name", array("label"=>"Device Name", "description"=>"Name of the impacted device", "allowed_values"=>null, "extkey_attcode"=> 'device_id', "target_attcode"=>"name")));
  1595. MetaModel::Init_AddAttribute(new AttributeDate("install_date", array("label"=>"Installation Date", "description"=>"Date when application was installed", "allowed_values"=>null, "sql"=>"install_date", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  1596. MetaModel::Init_AddAttribute(new AttributeText("description", array("label"=>"Description", "description"=>"description du patch", "allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  1597. MetaModel::Init_AddAttribute(new AttributeString("patch_type", array("label"=>"Type", "description"=>"type de patch", "allowed_values"=>new ValueSetEnum("OS,Application"), "sql"=>"patch_type", "default_value"=>"OS", "is_null_allowed"=>false, "depends_on"=>array())));
  1598. MetaModel::Init_InheritFilters();
  1599. MetaModel::Init_AddFilterFromAttribute("patch_type");
  1600. MetaModel::Init_AddFilterFromAttribute("device_id");
  1601. // Display lists
  1602. MetaModel::Init_SetZListItems('details', array('name','device_id', 'install_date', 'patch_type','description')); // Attributes to be displayed for the complete details
  1603. MetaModel::Init_SetZListItems('list', array('name','device_id', 'patch_type','install_date')); // Attributes to be displayed for a list
  1604. // Search criteria
  1605. MetaModel::Init_SetZListItems('standard_search', array('name', 'device_id','patch_type')); // Criteria of the std search form
  1606. MetaModel::Init_SetZListItems('advanced_search', array('name', 'device_id','patch_type')); // Criteria of the advanced search form
  1607. }
  1608. }
  1609. /*** Insert here all modules requires for ITOP application ***/
  1610. require_once('incidentMgmt.business.php');
  1611. require_once('ServiceMgmt.business.php');
  1612. require_once('ChangeMgmt.business.php');
  1613. require_once('KEDB.business.php');
  1614. require_once('ServiceDesk.business.php');
  1615. ?>