Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Improve global performance when using many genericobject
- The `TCO` (Total Cost of Ownership) is now correctly updated based on the costs associated with an item.

## [2.14.11] - 2024-12-27

Expand Down
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 @@ -638,7 +638,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
9 changes: 9 additions & 0 deletions inc/type.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ 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 Expand Up @@ -2485,6 +2486,14 @@ public static function install(Migration $migration)
$preference->add($tmp);
}
}

$types = new self();
$object_use_infocoms = $types->find(['use_infocoms' => 1]);
foreach ($object_use_infocoms as $object) {
$object_table = $object['itemtype']::getTable();
$migration->addField($object_table, "ticket_tco", "decimal");
$migration->migrationOneTable($object_table);
}
}


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