diff --git a/fields/field.constant.php b/fields/field.constant.php index 368b4a4..7a3f1bf 100644 --- a/fields/field.constant.php +++ b/fields/field.constant.php @@ -116,6 +116,9 @@ $GO_FIELDS['is_helpdesk_visible']['name'] = __("Associable to a ticket"); $GO_FIELDS['is_helpdesk_visible']['input_type'] = 'bool'; +$GO_FIELDS['ticket_tco']['name'] = __("TCO"); +$GO_FIELDS['ticket_tco']['input_type'] = 'decimal'; + $GO_FIELDS['locations_id']['name'] = __("Item location"); $GO_FIELDS['locations_id']['input_type'] = 'dropdown'; diff --git a/inc/object.class.php b/inc/object.class.php index 5dbf3b6..37ee3c9 100644 --- a/inc/object.class.php +++ b/inc/object.class.php @@ -623,7 +623,7 @@ public function showForm($id, $options = [], $previsualisation = false) public static function getFieldsToHide() { return ['id', 'is_recursive', 'is_template', 'template_name', 'is_deleted', - 'entities_id', 'notepad', 'date_mod', 'date_creation' + 'entities_id', 'notepad', 'date_mod', 'date_creation', 'ticket_tco' ]; } diff --git a/inc/type.class.php b/inc/type.class.php index 3440f39..bbcbbf8 100644 --- a/inc/type.class.php +++ b/inc/type.class.php @@ -1101,6 +1101,8 @@ public function checkNecessaryFieldsUpdate() if ($this->canUseTickets()) { //TODO rename is_helpdesk_visible into is_helpdeskvisible PluginGenericobjectField::addNewField($table, 'is_helpdesk_visible', 'comment'); + PluginGenericobjectField::addNewField($table, 'ticket_tco'); + } else { PluginGenericobjectField::deleteField($table, 'is_helpdesk_visible'); } diff --git a/setup.php b/setup.php index ef00d84..33e3d2a 100644 --- a/setup.php +++ b/setup.php @@ -117,12 +117,12 @@ function plugin_init_genericobject() global $PLUGIN_HOOKS, $GO_BLACKLIST_FIELDS, $GENERICOBJECT_PDF_TYPES, $GO_LINKED_TYPES, $GO_READONLY_FIELDS, $CFG_GLPI; - $GO_READONLY_FIELDS = ["is_helpdesk_visible", "comment"]; + $GO_READONLY_FIELDS = ["is_helpdesk_visible", "comment", "ticket_tco"]; $GO_BLACKLIST_FIELDS = ["itemtype", "table", "is_deleted", "id", "entities_id", "is_recursive", "is_template", "notepad", "template_name", "date_mod", "name", "is_helpdesk_visible", "comment", - "date_creation" + "date_creation", "ticket_tco" ]; $GO_LINKED_TYPES = ['Computer', 'Phone', 'Peripheral', 'Software', 'Monitor',