Bugzilla – Attachment 138053 Details for
Bug 31212
Datelastseen should be a datetime
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31212: Change datelastseen from date to datetime field
Bug-31212-Change-datelastseen-from-date-to-datetim.patch (text/plain), 12.91 KB, created by
Michal Urban
on 2022-07-22 18:22:45 UTC
(
hide
)
Description:
Bug 31212: Change datelastseen from date to datetime field
Filename:
MIME Type:
Creator:
Michal Urban
Created:
2022-07-22 18:22:45 UTC
Size:
12.91 KB
patch
obsolete
>From 5d169d6479f0fbfc6b39aafba94a3b5c4681565f Mon Sep 17 00:00:00 2001 >From: Michal Urban <michalurban177@gmail.com> >Date: Sat, 16 Jul 2022 10:55:42 -0400 >Subject: [PATCH] Bug 31212: Change datelastseen from date to datetime field > >This patch changes the datelastseen field to a datetime field for better time accuracy. > >It also fixes the interface in order to display datelastseen as a datetime field. > >To test: >1. Apply patch >2. Search the catalogue and select a biblio with at least one item. Confirm in the holdings table that every entry in the "Last Seen" column is in date-time format. >3. Navigate to "Items" in for that same biblio and check the item "History" section to have "Last Seen" in the correct format >4. Click "Edit" then "Edit Items" and confirm that the table has date-time format for the "Date Last Seen" Column entries >5. Edit one of the items to have lost status, then navigate to the Reports section, find "Items Lost", and search for the item with the barcode. Confirm the proper date-time format in the result. >6. Navigate to Tools, then Inventory, run inventory and confirm that the "Date Last Seen" column entries are in proper format >--- > C4/Items.pm | 4 ++-- > Koha/Schema/Result/Deleteditem.pm | 4 ++-- > Koha/Schema/Result/Item.pm | 4 ++-- > 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 | 6 +++--- > 9 files changed, 18 insertions(+), 16 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 9bb261f164..da16308a18 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -403,7 +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 => 1 }); >+ my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 0 }); > > my $item = Koha::Items->find($itemnumber); > $item->datelastseen($today); >@@ -587,7 +587,7 @@ sub GetItemsForInventory { > } > > if ($datelastseen) { >- $datelastseen = output_pref({ str => $datelastseen, dateformat => 'iso', dateonly => 1 }); >+ $datelastseen = output_pref({ str => $datelastseen, dateformat => 'iso', dateonly => 0 }); > push @where_strings, '(datelastseen < ? OR datelastseen IS NULL)'; > push @bind_params, $datelastseen; > } >diff --git a/Koha/Schema/Result/Deleteditem.pm b/Koha/Schema/Result/Deleteditem.pm >index 12c8900c5a..7d654a2f4e 100644 >--- a/Koha/Schema/Result/Deleteditem.pm >+++ b/Koha/Schema/Result/Deleteditem.pm >@@ -112,7 +112,7 @@ the date the item was last checked out > > =head2 datelastseen > >- data_type: 'date' >+ data_type: 'datetime' > datetime_undef_if_invalid: 1 > is_nullable: 1 > >@@ -396,7 +396,7 @@ __PACKAGE__->add_columns( > "datelastborrowed", > { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, > "datelastseen", >- { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, >+ { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 1 }, > "stack", > { data_type => "tinyint", is_nullable => 1 }, > "notforloan", >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index 9a6c397a3b..380fed037e 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -115,7 +115,7 @@ the date the item was last checked out/issued > > =head2 datelastseen > >- data_type: 'date' >+ data_type: 'datetime' > datetime_undef_if_invalid: 1 > is_nullable: 1 > >@@ -410,7 +410,7 @@ __PACKAGE__->add_columns( > "datelastborrowed", > { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, > "datelastseen", >- { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, >+ { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 1 }, > "stack", > { data_type => "tinyint", is_nullable => 1 }, > "notforloan", >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 8f8f094463..05f195f326 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2559,7 +2559,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)', >@@ -3120,7 +3120,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 14ac3460a4..fdbb0151e9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -551,7 +551,7 @@ Note that permanent location is a code, and location may be an authval. > [% END %] > > </td> >- <td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> >+ <td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates with_hours => 1 %]</td> > <td class="issues" data-order="[% item.issues || 0 | html %]">[% item.issues || 0 | html %]</td> > <td class="renewals" data-order="[% item.renewals || 0 | html %]">[% item.renewals || 0 | html %]</td> > <td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td> >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 2f7ddbd78e..8b7f0e33b5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -313,7 +313,7 @@ > 0 > [% END %] (<a href="/cgi-bin/koha/circ/bookcount.pl?&biblionumber=[% ITEM_DAT.biblionumber | uri %]&itm=[% ITEM_DAT.itemnumber | uri %]">View item's checkout history</a>)</li> > >- <li><span class="label">Last seen:</span>[% IF ( ITEM_DAT.datelastseen ) %][% ITEM_DAT.datelastseen | $KohaDates %] [%END %] </li> >+ <li><span class="label">Last seen:</span>[% IF ( ITEM_DAT.datelastseen ) %][% ITEM_DAT.datelastseen | $KohaDates with_hours => 1 %] [%END %] </li> > <li><span class="label">Last borrowed:</span>[% IF (ITEM_DAT.datelastborrowed ) %][% ITEM_DAT.datelastborrowed | $KohaDates %][% END %] </li> > [% IF Koha.Preference('StoreLastBorrower') && ITEM_DAT.object.last_returned_by %] > <li><span class="label">Last returned by:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.object.last_returned_by.borrowernumber | uri %]">[% ITEM_DAT.object.last_returned_by.cardnumber | html %]</a> </li> >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 31eaf8e3bd..c64fcccd96 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -124,8 +124,10 @@ > [% END %] > [% FOREACH header IN item_header_loop %] > [% SET attribute = header.attribute %] >- [% IF header.attribute AND date_fields.grep('^' _ attribute _ '$').size %] >- <td data-order="[% item.$attribute | html %]">[% item.$attribute | $KohaDates %]</td> >+ [% IF header.attribute == 'datelastseen' %] >+ <td data-order="[% item.$attribute | html %]">[% item.$attribute | $KohaDates with_hours => 1%]</td> >+ [% ELSIF header.attribute AND date_fields.grep('^' _ attribute _ '$').size %] >+ <td data-order="[% item.$attribute | html %]">[% item.$attribute | $KohaDates with_hours %]</td> > [% ELSE %] > <td>[% item.$attribute | html %]</td> > [% END %] >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 9ccc075100..565c9ea4b6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt >@@ -126,7 +126,7 @@ > <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% item.biblionumber | uri %]">[% item.barcode | html %]</a> > </td> > <td>[% item.itemcallnumber | html %]</td> >- <td data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> >+ <td data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates with_hours => 1 %]</td> > <td>[% item.price | $Price %]</td> > <td>[% item.replacementprice | $Price %]</td> > <td>[% Branches.GetName(item.homebranch) | html %]</td> >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 4f952b5452..917d9f597c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -47,7 +47,7 @@ > <main> > > <h1>Inventory</h1> >- [% IF (moddatecount) %]<div class="dialog message">[% moddatecount | html %] items modified : datelastseen set to [% date | $KohaDates %]</div> >+ [% IF (moddatecount) %]<div class="dialog message">[% moddatecount | html %] items modified : datelastseen set to [% date | $KohaDates with_hours => 1 %]</div> > <div class="dialog alert">Number of potential barcodes read: [% LinesRead | html %]</div>[% END %] > [% IF (errorfile) %]<div class="dialog alert">[% errorfile | html %] can't be opened</div>[% END %] > [% IF (err_length && err_length==1) %]<div class="dialog alert">There was 1 barcode that was too long.</div>[% END %] >@@ -185,7 +185,7 @@ > <li> > <br/> > <label for="datelastseen">Last inventory date:</label> >- <input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | $KohaDates %]" class="flatpickr" /> >+ <input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | $KohaDates with_hours => 1 %]" class="flatpickr" /> > (Skip records marked as seen on or after this date.) > </li> > <li> >@@ -309,7 +309,7 @@ > [% result.withdrawn | html %] > </td> > <td data-order="[% result.datelastseen | html %]"> >- [% result.datelastseen | $KohaDates%] >+ [% result.datelastseen | $KohaDates with_hours => 1 %] > </td> > <td> > [% FOREACH problem IN result.problems %] >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31212
:
138053
|
139510
|
142262
|
142263
|
142264
|
142282
|
142283
|
142284
|
142286
|
142287
|
142288
|
143595
|
146369
|
146370
|
146371
|
146372
|
147664
|
147665
|
147666
|
147667
|
148939
|
150378
|
150379
|
150380
|
150381
|
150382
|
150383
|
151189
|
151190
|
151194