From f729d46478fbfbb258262888941a6aa42da04d70 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 7 Feb 2023 23:14:43 +0000 Subject: [PATCH] Bug 31212: Change datelastseen from date to datetime field Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/Items.pm | 2 ++ installer/data/mysql/kohastructure.sql | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 2 +- .../intranet-tmpl/prog/en/modules/catalogue/moredetail.tt | 2 +- .../intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 6 +++++- .../intranet-tmpl/prog/en/modules/reports/itemslost.tt | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt | 4 ++-- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index de776d5dfe..b96b7a56bc 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -403,6 +403,7 @@ The last optional parameter allows for passing skip_record_index through to the sub ModDateLastSeen { my ( $itemnumber, $leave_item_lost, $params ) = @_; + my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 0 }); my $item = Koha::Items->find($itemnumber); $item->datelastseen(dt_from_string->ymd); @@ -587,6 +588,7 @@ sub GetItemsForInventory { } if ($datelastseen) { + $datelastseen = output_pref({ str => $datelastseen, dateformat => 'iso', dateonly => 0 }); push @where_strings, '(datelastseen < ? OR datelastseen IS NULL)'; push @bind_params, $datelastseen; } diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ad14050de7..10c4b2ae76 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2666,7 +2666,7 @@ CREATE TABLE `deleteditems` ( `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)', `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)', `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out', - `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)', + `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)', `stack` tinyint(1) DEFAULT NULL, `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)', `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)', @@ -3636,7 +3636,7 @@ CREATE TABLE `items` ( `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)', `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)', `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued', - `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)', + `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)', `stack` tinyint(1) DEFAULT NULL, `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)', `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)', diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 565fd00910..2d71b20a19 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -556,7 +556,7 @@ [% END %] - [% item.datelastseen | $KohaDates %] + [% item.datelastseen | $KohaDates with_hours => 1 %] [% item.issues || 0 | html %] [% item.renewals || 0 | html %] [% item.dateaccessioned | $KohaDates %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 06ba28827d..72e796bf2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -386,7 +386,7 @@
  • Last seen: [% IF ( ITEM_DAT.datelastseen ) %] - [% ITEM_DAT.datelastseen | $KohaDates %] + [% ITEM_DAT.datelastseen | $KohaDates with_hours => 1 %] [%END %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 57f53b4c52..e3e8d2ebdb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -140,7 +140,11 @@ [% SET attribute = header.attribute %] [% SET can_mod = item.nomod ? "nomod" : "canmod" %] [% IF header.attribute AND date_fields.grep('^' _ attribute _ '$').size %] - [% item.$attribute | $KohaDates %] + [% IF header.attribute == 'datelastseen' %] + [% item.$attribute | $KohaDates with_hours => 1 %] + [% ELSE %] + [% item.$attribute | $KohaDates %] + [% END %] [% ELSIF ( item.$attribute && ( attribute == 'price' || attribute == 'replacementprice' ) ) %] [% item.$attribute | $Price %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt index 371be36680..a0ed39fc63 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt @@ -119,7 +119,7 @@ [% item.barcode | html %] [% item.itemcallnumber | html %] - [% item.datelastseen | $KohaDates %] + [% item.datelastseen | $KohaDates with_hours => 1 %] [% item.price | $Price %] [% item.replacementprice | $Price %] [% Branches.GetName(item.homebranch) | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt index 056ef15384..673029cd9e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -41,7 +41,7 @@

    Inventory

    - [% IF (moddatecount) %]
    [% moddatecount | html %] items modified : datelastseen set to [% date | $KohaDates %]
    + [% IF (moddatecount) %]
    [% moddatecount | html %] items modified : datelastseen set to [% date | $KohaDates with_hours => 1 %]
    Number of potential barcodes read: [% LinesRead | html %]
    [% END %] [% IF (errorfile) %]
    [% errorfile | html %] can't be opened
    [% END %] [% IF (err_length && err_length==1) %]
    There was 1 barcode that was too long.
    [% END %] @@ -304,7 +304,7 @@ [% result.withdrawn | html %] - [% result.datelastseen | $KohaDates%] + [% result.datelastseen | $KohaDates with_hours => 1 %] [% FOREACH problem IN result.problems %] -- 2.39.5