Commit cb52e6e5 authored by Cédric Anne's avatar Cédric Anne Committed by Johan Cwiklinski
Browse files

Fix transfered documents date in ITIL timeline and list view

parent 567cd32b
......@@ -919,7 +919,7 @@ abstract class API extends CommonGLPI {
$doc_iterator = $DB->request([
'SELECT' => [
'glpi_documents_items.id AS assocID',
'glpi_documents_items.date_mod AS assocdate',
'glpi_documents_items.date_creation AS assocdate',
'glpi_entities.id AS entityID',
'glpi_entities.completename AS entity',
'glpi_documentcategories.completename AS headings',
......
......@@ -6356,13 +6356,14 @@ abstract class CommonITILObject extends CommonDBTM {
$document_obj->getFromDB($document_item['documents_id']);
$item = $document_obj->fields;
$item['date'] = $document_item['date_creation'];
// #1476 - set date_mod and owner to attachment ones
$item['date_mod'] = $document_item['date_mod'];
$item['users_id'] = $document_item['users_id'];
$item['timeline_position'] = $document_item['timeline_position'];
$timeline[$document_item['date_mod']."_document_".$document_item['documents_id']]
$timeline[$document_item['date_creation']."_document_".$document_item['documents_id']]
= ['type' => 'Document_Item', 'item' => $item];
}
......
......@@ -734,7 +734,7 @@ class Document_Item extends CommonDBRelation{
$criteria = [
'SELECT' => [
'glpi_documents_items.id AS assocID',
'glpi_documents_items.date_mod AS assocdate',
'glpi_documents_items.date_creation AS assocdate',
'glpi_entities.id AS entityID',
'glpi_entities.completename AS entity',
'glpi_documentcategories.completename AS headings',
......
......@@ -2752,10 +2752,12 @@ CREATE TABLE `glpi_documents_items` (
`date_mod` timestamp NULL DEFAULT NULL,
`users_id` int(11) DEFAULT '0',
`timeline_position` tinyint(1) NOT NULL DEFAULT '0',
`date_creation` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unicity` (`documents_id`,`itemtype`,`items_id`),
KEY `item` (`itemtype`,`items_id`,`entities_id`,`is_recursive`),
KEY `users_id` (`users_id`)
KEY `users_id` (`users_id`),
KEY `date_creation` (`date_creation`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
......
......@@ -221,6 +221,7 @@ function update94to95() {
$ADDTODISPLAYPREF['cluster'] = [31, 19];
/** /Clusters */
/** ITIL templates */
//rename tables
foreach ([
......@@ -282,6 +283,25 @@ function update94to95() {
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$DB->queryOrDie($query, "add table glpi_itilfollowuptemplates");
}
/** /add templates for followups */
/** Add "date_creation" field on document_items */
if (!$DB->fieldExists('glpi_documents_items', 'date_creation')) {
$migration->addField('glpi_documents_items', 'date_creation', 'datetime');
$migration->addPostQuery(
$DB->buildUpdate(
'glpi_documents_items',
[
'date_creation' => new \QueryExpression(
$DB->quoteName('date_mod')
)
],
[true]
)
);
$migration->addKey('glpi_documents_items', 'date_creation');
}
/** /Add "date_creation" field on document_items */
// ************ Keep it at the end **************
foreach ($ADDTODISPLAYPREF as $type => $tab) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment