Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TCO): missing ticket_tco field in table object #397

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 1 addition & 1 deletion inc/object.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
];
}

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');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix lint

} 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
Loading