Menu

Adding an attribute through parent class

2011-10-19
2012-12-19
  • Marc Franquesa

    Marc Franquesa - 2011-10-19

    Hi.

    I am following the documentation about customizing iTop and the example about adding a NetworkDeviceType, I installed the iTop toolkit to check the integrity of all changes.

    What I want:
    I need a 'buydate' attribute on some CIs: PC, Servers, NetworkDevice, … so I added the attribute to the common parent class 'Device' adding a line:

    MetaModel::Init_AddAttribute(new AttributeDate("buydate", array("allowed_values"=>null, "sql"=>"buydate", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));

    I tried updating the db table 'device' and tried throught the toolkit too. The toolkit detect correctly the change and propose the SQL commands I apply the commands without error.

    But when I go to new CI the new attribute doesn't appear on the GUI.

    I search for errors on the apache error log and no message appear.

     
  • Anonymous

    Anonymous - 2011-10-27

    You need to make two more modifications. In model.itop-config- mgmt.php, add your new field to the list of displayed attributes for Device:
    MetaModel::Init_SetZListItems('details', array('name', 'status', 'org_id', 'importance', 'brand', 'model', 'serial_number', 'asset_ref', 'buydate','contact_list', 'document_list', 'solution_list', 'contract_list', 'ticket_list', 'nwinterface_list'));

    In en.dict.itop-config-mgmt.php (and/or other language files), add translations to the Class: Device section:

    'Class:Device/Attribute:buydate' => 'Purchase Date',
    'Class:Device/Attribute:buydate+' => 'Date device was purchased',
    

    buydate+ is the tooltip.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.