Skip to content

Commit

Permalink
fix(TCO): missing ticket_tco field in table object
Browse files Browse the repository at this point in the history
  • Loading branch information
MyvTsv committed Oct 25, 2024
1 parent 2436496 commit 7f9fab1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions fields/field.constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 2 additions & 0 deletions inc/type.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
4 changes: 2 additions & 2 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 7f9fab1

Please sign in to comment.