Bug 28015 - Inventory tool fails when timeformat=12h
Summary: Inventory tool fails when timeformat=12h
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 23463
Blocks:
  Show dependency treegraph
 
Reported: 2021-03-22 16:01 UTC by Owen Leonard
Modified: 2021-12-13 21:10 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.05,20.05.11


Attachments
Error trace (18.98 KB, text/plain)
2021-03-22 16:01 UTC, Owen Leonard
Details
Bug 28015: Fix inventory for timeformat=12h (2.89 KB, patch)
2021-04-09 09:24 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28015: Fix inventory for timeformat=12h (2.93 KB, patch)
2021-04-09 12:47 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28015: Fix inventory for timeformat=12h (2.99 KB, patch)
2021-04-15 16:08 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2021-03-22 16:01:00 UTC
When I submit a batch of barcodes in the inventory tool I get an error:

Invalid value passed, datelastseen=2021-03-22 12:00 AM expected type is date at /usr/share/perl5/Exception/Class/Base.pm line 88

Changing the dateformat system preference doesn't seem to have any effect as far as I can tell.
Comment 1 Owen Leonard 2021-03-22 16:01:22 UTC
Created attachment 118617 [details]
Error trace
Comment 2 Jonathan Druart 2021-04-09 09:21:26 UTC
Certainly caused by

  commit bbb504c86f5ca0a474365d4839177412f415c4ee
  Bug 23463: Replace ModItem with Koha::Item->store
Comment 3 Jonathan Druart 2021-04-09 09:24:02 UTC
Created attachment 119364 [details] [review]
Bug 28015: Fix inventory for timeformat=12h

Inventory explodes with the following stacktrace if timeformat is set to 12h

Invalid value passed, datelastseen=2021-04-09 12:00 AM expected type is date at /usr/share/perl5/Exception/Class/Base.pm line 88
        Exception::Class::Base::throw('Koha::Exceptions::Object::BadValue', 'type', 'date', 'value', '2021-04-09 12:00 AM', 'property', 'datelastseen') called at /kohadevbox/koha/Koha/Object.pm line 196
        Koha::Object::catch {...} ('DBIx::Class::Exception=HASH(0x557a052baeb0)') called at /usr/share/perl5/Try/Tiny.pm line 124
        Try::Tiny::try('CODE(0x557a051931d8)', 'Try::Tiny::Catch=REF(0x557a052bfc30)') called at /kohadevbox/koha/Koha/Object.pm line 206
        Koha::Object::store('Koha::Item=HASH(0x557a0521a048)') called at /kohadevbox/koha/Koha/Item.pm line 202
        Koha::Item::store('Koha::Item=HASH(0x557a0521a048)') called at /kohadevbox/koha/tools/inventory.pl line 220

Test plan:
Set TimeFormat to 12h
Use the inventory
=> Confirm that it's working with this patch applied
Comment 4 Owen Leonard 2021-04-09 12:47:53 UTC
Created attachment 119376 [details] [review]
Bug 28015: Fix inventory for timeformat=12h

Inventory explodes with the following stacktrace if timeformat is set to 12h

Invalid value passed, datelastseen=2021-04-09 12:00 AM expected type is date at /usr/share/perl5/Exception/Class/Base.pm line 88
        Exception::Class::Base::throw('Koha::Exceptions::Object::BadValue', 'type', 'date', 'value', '2021-04-09 12:00 AM', 'property', 'datelastseen') called at /kohadevbox/koha/Koha/Object.pm line 196
        Koha::Object::catch {...} ('DBIx::Class::Exception=HASH(0x557a052baeb0)') called at /usr/share/perl5/Try/Tiny.pm line 124
        Try::Tiny::try('CODE(0x557a051931d8)', 'Try::Tiny::Catch=REF(0x557a052bfc30)') called at /kohadevbox/koha/Koha/Object.pm line 206
        Koha::Object::store('Koha::Item=HASH(0x557a0521a048)') called at /kohadevbox/koha/Koha/Item.pm line 202
        Koha::Item::store('Koha::Item=HASH(0x557a0521a048)') called at /kohadevbox/koha/tools/inventory.pl line 220

Test plan:
Set TimeFormat to 12h
Use the inventory
=> Confirm that it's working with this patch applied

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Nick Clemens (kidclamp) 2021-04-15 16:08:45 UTC
Created attachment 119672 [details] [review]
Bug 28015: Fix inventory for timeformat=12h

Inventory explodes with the following stacktrace if timeformat is set to 12h

Invalid value passed, datelastseen=2021-04-09 12:00 AM expected type is date at /usr/share/perl5/Exception/Class/Base.pm line 88
        Exception::Class::Base::throw('Koha::Exceptions::Object::BadValue', 'type', 'date', 'value', '2021-04-09 12:00 AM', 'property', 'datelastseen') called at /kohadevbox/koha/Koha/Object.pm line 196
        Koha::Object::catch {...} ('DBIx::Class::Exception=HASH(0x557a052baeb0)') called at /usr/share/perl5/Try/Tiny.pm line 124
        Try::Tiny::try('CODE(0x557a051931d8)', 'Try::Tiny::Catch=REF(0x557a052bfc30)') called at /kohadevbox/koha/Koha/Object.pm line 206
        Koha::Object::store('Koha::Item=HASH(0x557a0521a048)') called at /kohadevbox/koha/Koha/Item.pm line 202
        Koha::Item::store('Koha::Item=HASH(0x557a0521a048)') called at /kohadevbox/koha/tools/inventory.pl line 220

Test plan:
Set TimeFormat to 12h
Use the inventory
=> Confirm that it's working with this patch applied

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Jonathan Druart 2021-04-16 10:30:03 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-04-22 13:56:17 UTC
Pushed to 20.11.x for 20.11.05
Comment 8 Andrew Fuerste-Henry 2021-04-25 15:58:52 UTC
Pushed to 20.05.x for 20.05.11
Comment 9 Victor Grousset/tuxayo 2021-04-25 20:40:29 UTC
Missing dependencies for 19.11.x, it shouldn't be affected, no backport.