Bug 31212: Change datelastseen from date to datetime field

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2023-02-07 23:14:43 +00:00 committed by Tomas Cohen Arazi
parent f523b0d98b
commit f729d46478
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
7 changed files with 14 additions and 8 deletions

View File

@ -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;
}

View File

@ -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)',

View File

@ -556,7 +556,7 @@
[% 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>

View File

@ -386,7 +386,7 @@
<li>
<span class="label">Last seen:</span>
[% IF ( ITEM_DAT.datelastseen ) %]
[% ITEM_DAT.datelastseen | $KohaDates %]
[% ITEM_DAT.datelastseen | $KohaDates with_hours => 1 %]
[%END %]
</li>
<li>

View File

@ -140,7 +140,11 @@
[% SET attribute = header.attribute %]
[% SET can_mod = item.nomod ? "nomod" : "canmod" %]
[% IF header.attribute AND date_fields.grep('^' _ attribute _ '$').size %]
<td class="[% can_mod | html %]" data-order="[% item.$attribute | html %]">[% item.$attribute | $KohaDates %]</td>
[% IF header.attribute == 'datelastseen' %]
<td class="[% can_mod | html %]" data-order="[% item.$attribute | html %]">[% item.$attribute | $KohaDates with_hours => 1 %]</td>
[% ELSE %]
<td class="[% can_mod | html %]" data-order="[% item.$attribute | html %]">[% item.$attribute | $KohaDates %]</td>
[% END %]
[% ELSIF ( item.$attribute && ( attribute == 'price' || attribute == 'replacementprice' ) ) %]
<td class="[% can_mod | html %]" data-order="[% item.$attribute | html %]">[% item.$attribute | $Price %]</td>
[% ELSE %]

View File

@ -119,7 +119,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>

View File

@ -41,7 +41,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 %]
@ -304,7 +304,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 %]