cmdbchangeop.class.inc.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. <?php
  2. // Copyright (C) 2010 Combodo SARL
  3. //
  4. // This program is free software; you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation; version 3 of the License.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. /**
  17. * Persistent classes (internal) : cmdbChangeOp and derived
  18. *
  19. * @author Erwan Taloc <erwan.taloc@combodo.com>
  20. * @author Romain Quetiez <romain.quetiez@combodo.com>
  21. * @author Denis Flaven <denis.flaven@combodo.com>
  22. * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
  23. */
  24. /**
  25. * Various atomic change operations, to be tracked
  26. *
  27. * @package iTopORM
  28. */
  29. class CMDBChangeOp extends DBObject
  30. {
  31. public static function Init()
  32. {
  33. $aParams = array
  34. (
  35. "category" => "core/cmdb",
  36. "key_type" => "autoincrement",
  37. "name_attcode" => "change",
  38. "state_attcode" => "",
  39. "reconc_keys" => array(),
  40. "db_table" => "priv_changeop",
  41. "db_key_field" => "id",
  42. "db_finalclass_field" => "optype",
  43. );
  44. MetaModel::Init_Params($aParams);
  45. //MetaModel::Init_InheritAttributes();
  46. MetaModel::Init_AddAttribute(new AttributeExternalKey("change", array("allowed_values"=>null, "sql"=>"changeid", "targetclass"=>"CMDBChange", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
  47. MetaModel::Init_AddAttribute(new AttributeExternalField("date", array("allowed_values"=>null, "extkey_attcode"=>"change", "target_attcode"=>"date")));
  48. MetaModel::Init_AddAttribute(new AttributeExternalField("userinfo", array("allowed_values"=>null, "extkey_attcode"=>"change", "target_attcode"=>"userinfo")));
  49. MetaModel::Init_AddAttribute(new AttributeString("objclass", array("allowed_values"=>null, "sql"=>"objclass", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  50. MetaModel::Init_AddAttribute(new AttributeString("objkey", array("allowed_values"=>null, "sql"=>"objkey", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  51. MetaModel::Init_SetZListItems('details', array('change', 'date', 'userinfo')); // Attributes to be displayed for the complete details
  52. MetaModel::Init_SetZListItems('list', array('change', 'date', 'userinfo')); // Attributes to be displayed for the complete details
  53. }
  54. /**
  55. * Describe (as a text string) the modifications corresponding to this change
  56. */
  57. public function GetDescription()
  58. {
  59. return '';
  60. }
  61. }
  62. /**
  63. * Record the creation of an object
  64. *
  65. * @package iTopORM
  66. */
  67. class CMDBChangeOpCreate extends CMDBChangeOp
  68. {
  69. public static function Init()
  70. {
  71. $aParams = array
  72. (
  73. "category" => "core/cmdb",
  74. "key_type" => "",
  75. "name_attcode" => "change",
  76. "state_attcode" => "",
  77. "reconc_keys" => array(),
  78. "db_table" => "priv_changeop_create",
  79. "db_key_field" => "id",
  80. "db_finalclass_field" => "",
  81. );
  82. MetaModel::Init_Params($aParams);
  83. MetaModel::Init_InheritAttributes();
  84. }
  85. /**
  86. * Describe (as a text string) the modifications corresponding to this change
  87. */
  88. public function GetDescription()
  89. {
  90. return Dict::S('Change:ObjectCreated');
  91. }
  92. }
  93. /**
  94. * Record the deletion of an object
  95. *
  96. * @package iTopORM
  97. */
  98. class CMDBChangeOpDelete extends CMDBChangeOp
  99. {
  100. public static function Init()
  101. {
  102. $aParams = array
  103. (
  104. "category" => "core/cmdb",
  105. "key_type" => "",
  106. "name_attcode" => "change",
  107. "state_attcode" => "",
  108. "reconc_keys" => array(),
  109. "db_table" => "priv_changeop_delete",
  110. "db_key_field" => "id",
  111. "db_finalclass_field" => "",
  112. );
  113. MetaModel::Init_Params($aParams);
  114. MetaModel::Init_InheritAttributes();
  115. }
  116. /**
  117. * Describe (as a text string) the modifications corresponding to this change
  118. */
  119. public function GetDescription()
  120. {
  121. return Dict::S('Change:ObjectDeleted');
  122. }
  123. }
  124. /**
  125. * Record the modification of an attribute (abstract)
  126. *
  127. * @package iTopORM
  128. */
  129. class CMDBChangeOpSetAttribute extends CMDBChangeOp
  130. {
  131. public static function Init()
  132. {
  133. $aParams = array
  134. (
  135. "category" => "core/cmdb",
  136. "key_type" => "",
  137. "name_attcode" => "change",
  138. "state_attcode" => "",
  139. "reconc_keys" => array(),
  140. "db_table" => "priv_changeop_setatt",
  141. "db_key_field" => "id",
  142. "db_finalclass_field" => "",
  143. );
  144. MetaModel::Init_Params($aParams);
  145. MetaModel::Init_InheritAttributes();
  146. MetaModel::Init_AddAttribute(new AttributeString("attcode", array("allowed_values"=>null, "sql"=>"attcode", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  147. // Display lists
  148. MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details
  149. MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list
  150. }
  151. }
  152. /**
  153. * Record the modification of a scalar attribute
  154. *
  155. * @package iTopORM
  156. */
  157. class CMDBChangeOpSetAttributeScalar extends CMDBChangeOpSetAttribute
  158. {
  159. public static function Init()
  160. {
  161. $aParams = array
  162. (
  163. "category" => "core/cmdb",
  164. "key_type" => "",
  165. "name_attcode" => "change",
  166. "state_attcode" => "",
  167. "reconc_keys" => array(),
  168. "db_table" => "priv_changeop_setatt_scalar",
  169. "db_key_field" => "id",
  170. "db_finalclass_field" => "",
  171. );
  172. MetaModel::Init_Params($aParams);
  173. MetaModel::Init_InheritAttributes();
  174. MetaModel::Init_AddAttribute(new AttributeString("oldvalue", array("allowed_values"=>null, "sql"=>"oldvalue", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
  175. MetaModel::Init_AddAttribute(new AttributeString("newvalue", array("allowed_values"=>null, "sql"=>"newvalue", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
  176. // Display lists
  177. MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for the complete details
  178. MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for a list
  179. }
  180. /**
  181. * Describe (as a text string) the modifications corresponding to this change
  182. */
  183. public function GetDescription()
  184. {
  185. // Temporary, until we change the options of GetDescription() -needs a more global revision
  186. $bIsHtml = true;
  187. $sResult = '';
  188. $oTargetObjectClass = $this->Get('objclass');
  189. $oTargetObjectKey = $this->Get('objkey');
  190. $oTargetSearch = new DBObjectSearch($oTargetObjectClass);
  191. $oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
  192. $oMonoObjectSet = new DBObjectSet($oTargetSearch);
  193. if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES)
  194. {
  195. $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
  196. $sAttName = $oAttDef->GetLabel();
  197. $sNewValue = $this->Get('newvalue');
  198. $sOldValue = $this->Get('oldvalue');
  199. if ( (($oAttDef->GetType() == 'String') || ($oAttDef->GetType() == 'Text')) &&
  200. (strlen($sNewValue) > strlen($sOldValue)) )
  201. {
  202. // Check if some text was not appended to the field
  203. if (substr($sNewValue,0, strlen($sOldValue)) == $sOldValue) // Text added at the end
  204. {
  205. $sDelta = substr($sNewValue, strlen($sOldValue));
  206. $sResult = Dict::Format('Change:Text_AppendedTo_AttName', $sDelta, $sAttName);
  207. }
  208. else if (substr($sNewValue, -strlen($sOldValue)) == $sOldValue) // Text added at the beginning
  209. {
  210. $sDelta = substr($sNewValue, 0, strlen($sNewValue) - strlen($sOldValue));
  211. $sResult = Dict::Format('Change:Text_AppendedTo_AttName', $sDelta, $sAttName);
  212. }
  213. else
  214. {
  215. if (strlen($sOldValue) == 0)
  216. {
  217. $sResult = Dict::Format('Change:AttName_SetTo', $sAttName, $sNewValue);
  218. }
  219. else
  220. {
  221. $sResult = Dict::Format('Change:AttName_SetTo_NewValue_PreviousValue_OldValue', $sAttName, $sNewValue, $sOldValue);
  222. }
  223. }
  224. }
  225. elseif($bIsHtml && $oAttDef->IsExternalKey())
  226. {
  227. $sTargetClass = $oAttDef->GetTargetClass();
  228. $sFrom = MetaModel::GetHyperLink($sTargetClass, $sOldValue);
  229. $sTo = MetaModel::GetHyperLink($sTargetClass, $sNewValue);
  230. $sResult = "$sAttName set to $sTo (previous: $sFrom)";
  231. if (strlen($sFrom) == 0)
  232. {
  233. $sResult = Dict::Format('Change:AttName_SetTo', $sAttName, $sTo);
  234. }
  235. else
  236. {
  237. $sResult = Dict::Format('Change:AttName_SetTo_NewValue_PreviousValue_OldValue', $sAttName, $sTo, $sFrom);
  238. }
  239. }
  240. elseif ($oAttDef instanceOf AttributeBlob)
  241. {
  242. $sResult = "#@# Issue... found an attribute for which other type of tracking should be made";
  243. }
  244. else
  245. {
  246. if (strlen($sOldValue) == 0)
  247. {
  248. $sResult = Dict::Format('Change:AttName_SetTo', $sAttName, $sNewValue);
  249. }
  250. else
  251. {
  252. $sResult = Dict::Format('Change:AttName_SetTo_NewValue_PreviousValue_OldValue', $sAttName, $sNewValue, $sOldValue);
  253. }
  254. }
  255. }
  256. return $sResult;
  257. }
  258. }
  259. /**
  260. * Record the modification of a blob
  261. *
  262. * @package iTopORM
  263. */
  264. class CMDBChangeOpSetAttributeBlob extends CMDBChangeOpSetAttribute
  265. {
  266. public static function Init()
  267. {
  268. $aParams = array
  269. (
  270. "category" => "core/cmdb",
  271. "key_type" => "",
  272. "name_attcode" => "change",
  273. "state_attcode" => "",
  274. "reconc_keys" => array(),
  275. "db_table" => "priv_changeop_setatt_data",
  276. "db_key_field" => "id",
  277. "db_finalclass_field" => "",
  278. );
  279. MetaModel::Init_Params($aParams);
  280. MetaModel::Init_InheritAttributes();
  281. MetaModel::Init_AddAttribute(new AttributeBlob("prevdata", array("depends_on"=>array())));
  282. // Display lists
  283. MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details
  284. MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list
  285. }
  286. /**
  287. * Describe (as a text string) the modifications corresponding to this change
  288. */
  289. public function GetDescription()
  290. {
  291. // Temporary, until we change the options of GetDescription() -needs a more global revision
  292. $bIsHtml = true;
  293. $sResult = '';
  294. $oTargetObjectClass = $this->Get('objclass');
  295. $oTargetObjectKey = $this->Get('objkey');
  296. $oTargetSearch = new DBObjectSearch($oTargetObjectClass);
  297. $oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
  298. $oMonoObjectSet = new DBObjectSet($oTargetSearch);
  299. if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES)
  300. {
  301. $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
  302. $sAttName = $oAttDef->GetLabel();
  303. $oPrevDoc = $this->Get('prevdata');
  304. $sDocView = $oPrevDoc->GetAsHtml();
  305. $sDocView .= "<br/>".Dict::Format('UI:OpenDocumentInNewWindow_',$oPrevDoc->GetDisplayLink(get_class($this), $this->GetKey(), 'prevdata')).", \n";
  306. $sDocView .= Dict::Format('UI:DownloadDocument_', $oPrevDoc->GetDownloadLink(get_class($this), $this->GetKey(), 'prevdata'))."\n";
  307. //$sDocView = $oPrevDoc->GetDisplayInline(get_class($this), $this->GetKey(), 'prevdata');
  308. $sResult = Dict::Format('Change:AttName_Changed_PreviousValue_OldValue', $sAttName, $sDocView);
  309. }
  310. return $sResult;
  311. }
  312. }
  313. /**
  314. * Safely record the modification of one way encrypted password
  315. */
  316. class CMDBChangeOpSetAttributeOneWayPassword extends CMDBChangeOpSetAttribute
  317. {
  318. public static function Init()
  319. {
  320. $aParams = array
  321. (
  322. "category" => "core/cmdb",
  323. "key_type" => "",
  324. "name_attcode" => "change",
  325. "state_attcode" => "",
  326. "reconc_keys" => array(),
  327. "db_table" => "priv_changeop_setatt_pwd",
  328. "db_key_field" => "id",
  329. "db_finalclass_field" => "",
  330. );
  331. MetaModel::Init_Params($aParams);
  332. MetaModel::Init_InheritAttributes();
  333. MetaModel::Init_AddAttribute(new AttributeOneWayPassword("prev_pwd", array("sql" => 'data', "default_value" => '', "is_null_allowed"=> true, "allowed_values" => null, "depends_on"=>array())));
  334. // Display lists
  335. MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details
  336. MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list
  337. }
  338. /**
  339. * Describe (as a text string) the modifications corresponding to this change
  340. */
  341. public function GetDescription()
  342. {
  343. // Temporary, until we change the options of GetDescription() -needs a more global revision
  344. $bIsHtml = true;
  345. $sResult = '';
  346. $oTargetObjectClass = $this->Get('objclass');
  347. $oTargetObjectKey = $this->Get('objkey');
  348. $oTargetSearch = new DBObjectSearch($oTargetObjectClass);
  349. $oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
  350. $oMonoObjectSet = new DBObjectSet($oTargetSearch);
  351. if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES)
  352. {
  353. $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
  354. $sAttName = $oAttDef->GetLabel();
  355. $sResult = Dict::Format('Change:AttName_Changed', $sAttName);
  356. }
  357. return $sResult;
  358. }
  359. }
  360. /**
  361. * Safely record the modification of an encrypted field
  362. */
  363. class CMDBChangeOpSetAttributeEncrypted extends CMDBChangeOpSetAttribute
  364. {
  365. public static function Init()
  366. {
  367. $aParams = array
  368. (
  369. "category" => "core/cmdb",
  370. "key_type" => "",
  371. "name_attcode" => "change",
  372. "state_attcode" => "",
  373. "reconc_keys" => array(),
  374. "db_table" => "priv_changeop_setatt_encrypted",
  375. "db_key_field" => "id",
  376. "db_finalclass_field" => "",
  377. );
  378. MetaModel::Init_Params($aParams);
  379. MetaModel::Init_InheritAttributes();
  380. MetaModel::Init_AddAttribute(new AttributeEncryptedString("prevstring", array("sql" => 'data', "default_value" => '', "is_null_allowed"=> true, "allowed_values" => null, "depends_on"=>array())));
  381. // Display lists
  382. MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details
  383. MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list
  384. }
  385. /**
  386. * Describe (as a text string) the modifications corresponding to this change
  387. */
  388. public function GetDescription()
  389. {
  390. // Temporary, until we change the options of GetDescription() -needs a more global revision
  391. $bIsHtml = true;
  392. $sResult = '';
  393. $oTargetObjectClass = $this->Get('objclass');
  394. $oTargetObjectKey = $this->Get('objkey');
  395. $oTargetSearch = new DBObjectSearch($oTargetObjectClass);
  396. $oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
  397. $oMonoObjectSet = new DBObjectSet($oTargetSearch);
  398. if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES)
  399. {
  400. $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
  401. $sAttName = $oAttDef->GetLabel();
  402. $sPrevString = $this->Get('prevstring');
  403. $sResult = Dict::Format('Change:AttName_Changed_PreviousValue_OldValue', $sAttName, $sPrevString);
  404. }
  405. return $sResult;
  406. }
  407. }
  408. /**
  409. * Record the modification of a multiline string (text)
  410. *
  411. * @package iTopORM
  412. */
  413. class CMDBChangeOpSetAttributeText extends CMDBChangeOpSetAttribute
  414. {
  415. public static function Init()
  416. {
  417. $aParams = array
  418. (
  419. "category" => "core/cmdb",
  420. "key_type" => "",
  421. "name_attcode" => "change",
  422. "state_attcode" => "",
  423. "reconc_keys" => array(),
  424. "db_table" => "priv_changeop_setatt_text",
  425. "db_key_field" => "id",
  426. "db_finalclass_field" => "",
  427. );
  428. MetaModel::Init_Params($aParams);
  429. MetaModel::Init_InheritAttributes();
  430. MetaModel::Init_AddAttribute(new AttributeText("prevdata", array("allowed_values"=>null, "sql"=>"prevdata", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  431. // Display lists
  432. MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details
  433. MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list
  434. }
  435. /**
  436. * Describe (as a text string) the modifications corresponding to this change
  437. */
  438. public function GetDescription()
  439. {
  440. // Temporary, until we change the options of GetDescription() -needs a more global revision
  441. $bIsHtml = true;
  442. $sResult = '';
  443. $oTargetObjectClass = $this->Get('objclass');
  444. $oTargetObjectKey = $this->Get('objkey');
  445. $oTargetSearch = new DBObjectSearch($oTargetObjectClass);
  446. $oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
  447. $oMonoObjectSet = new DBObjectSet($oTargetSearch);
  448. if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES)
  449. {
  450. $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
  451. $sAttName = $oAttDef->GetLabel();
  452. $sTextView = '<div>'.$this->GetAsHtml('prevdata').'</div>';
  453. //$sDocView = $oPrevDoc->GetDisplayInline(get_class($this), $this->GetKey(), 'prevdata');
  454. $sResult = Dict::Format('Change:AttName_Changed_PreviousValue_OldValue', $sAttName, $sTextView);
  455. }
  456. return $sResult;
  457. }
  458. }
  459. /**
  460. * Record the modification of a caselog (text)
  461. * since the caselog itself stores the history
  462. * of its entries, there is no need to duplicate
  463. * the text here
  464. *
  465. * @package iTopORM
  466. */
  467. class CMDBChangeOpSetAttributeCaseLog extends CMDBChangeOpSetAttribute
  468. {
  469. public static function Init()
  470. {
  471. $aParams = array
  472. (
  473. "category" => "core/cmdb",
  474. "key_type" => "",
  475. "name_attcode" => "change",
  476. "state_attcode" => "",
  477. "reconc_keys" => array(),
  478. "db_table" => "priv_changeop_setatt_log",
  479. "db_key_field" => "id",
  480. "db_finalclass_field" => "",
  481. );
  482. MetaModel::Init_Params($aParams);
  483. MetaModel::Init_InheritAttributes();
  484. MetaModel::Init_AddAttribute(new AttributeInteger("lastentry", array("allowed_values"=>null, "sql"=>"lastentry", "default_value"=>0, "is_null_allowed"=>true, "depends_on"=>array())));
  485. // Display lists
  486. MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details
  487. MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list
  488. }
  489. /**
  490. * Describe (as a text string) the modifications corresponding to this change
  491. */
  492. public function GetDescription()
  493. {
  494. // Temporary, until we change the options of GetDescription() -needs a more global revision
  495. $bIsHtml = true;
  496. $sResult = '';
  497. $oTargetObjectClass = $this->Get('objclass');
  498. $oTargetObjectKey = $this->Get('objkey');
  499. $oTargetSearch = new DBObjectSearch($oTargetObjectClass);
  500. $oTargetSearch->AddCondition('id', $oTargetObjectKey, '=');
  501. $oMonoObjectSet = new DBObjectSet($oTargetSearch);
  502. if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES)
  503. {
  504. $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
  505. $sAttName = $oAttDef->GetLabel();
  506. $sResult = Dict::Format('Change:AttName_EntryAdded', $sAttName);
  507. }
  508. return $sResult;
  509. }
  510. }
  511. ?>