Adding or changing to status property

2013-05-21
2015-06-04
  • Keith Brown
    Keith Brown
    2013-05-21

    Currently, the status property for equipment is relatively static; being just production, stock, obsolete or implementation. Is there any way to add status levels? If you have multiple branches of equipment, the stock ones just don't seem to cut it.

     
    • I'm sure you've already figured this out but I'm posting because this is the first thread that comes up with my question when I search status and I couldn't find any other thread with the solution.

      You need to edit web\env-production\itop-config-mgmt\model.itop-config-mgmt.PHP

      search for the item you want to add the status to. add .png to it and it will take you right there. IE if you want to add the status to server search for server.png in the file and it will take you to where the server class is defined.

      -find this line-
      MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum("production,implementation,stock,obsolete"), "display_style"=>'list', "sql"=>'status', "default_value"=>'production', "is_null_allowed"=>true, "depends_on"=>array(), "always_load_in_tables"=>false)));

      where it says "allowed values" in the () following it add a , and the new status you want. eg ("production,implementation,stock,obsolete,your_status_here")

      you will then need to log into the database, find the table physicaldevice and edit the "status" column adding a ,'your_status_here' to the end of the length/values.

      you should now be able to assign your new status to the object type you edited this for.

      there may be an easier or more correct way to do this and i'd be interested to see if there was but I couldn't find any posts with this question answered and found this solution myself after an hour of digging through the web files to try and figure out where everything is defined.

       
  • dlp
    dlp
    2015-06-04

    Do not edit the core files. You will loose your modification in case of updates.
    You need to create an extention of the datamodel.
    I let you look at the wiki to find the toolkit and the extention exemples if you want more informations.
    For exemple in my case I wanted to add a status "stolen" to the physical devices.
    You can do it like this : Adding the value stolen to the list, and also the entry in the dictonary.

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
        <classes>
            <class id="PhysicalDevice" _delta="merge">
                <fields>
                    <field id="status" xsi:type="AttributeEnum" _delta="merge">
                        <values _delta="merge">
                            <value id="stolen" _delta="define">stolen</value>
                        </values>
                    </field>
                </fields>
            </class>
        </classes>
        <dictionaries>
            <dictionary id="EN US">
                <entries>
                    <entry id="Class:PhysicalDevice/Attribute:status/Value:stolen" _delta="define"><![CDATA[Stolen]]></entry>
                </entries>
            </dictionary>
        </dictionaries>
    </itop_design>
    
     
    Last edit: dlp 2015-06-04
  • Hi dlp, i was typing the same answer my self to this thread but after seeing yours, i didn't post it ;-)

    I always use an extension for iTop modifications but i have this problem which seems that, even defining everything in the extension, the files in *web\env-production* are missing some of my changes. Could you give a look, please ?
    Thank you

     
  • dlp
    dlp
    2015-06-04

    I have post something. This case is less complicated because there is no stimuli actions in the class phisicalDevices. Anyway i will try to look at your datamodel.

     
  • Thank you being so helpful dlp but finally i resolved my problem!
    As always, trying to explain the problem to another person, many times drives you to the solution of the problem ;-)
    The problem was some _delta="redefine" and _delta="define_if_not_exists" missing, like in

    <stimulus id="ev_progress" xsi:type="StimulusUserAction" _delta="define_if_not_exists" />