Bug 17672

Summary: Items table should have a damaged_on column
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Architecture, internals, and plumbingAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: enhancement    
Priority: P5 - low CC: charles.farmer, jonathan.druart, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 17672 - Items table should have a damaged_on column
Bug 17672 - Schema updates
[SIGNED-OFF] Bug 17672 - Items table should have a damaged_on column
[SIGNED-OFF] Bug 17672 - Schema updates
Bug 17672 - Items table should have a damaged_on column
Bug 17672 - Schema updates
Bug 17672 - Dumping Items.t expected tests from 12 to 13
k
Bug 17672: Add damaged_on to items and deleteditems tables
Bug 17672: Fixing Items.t expected tests from 12 to 13

Description Nick Clemens (kidclamp) 2016-11-23 14:31:26 UTC
Mirroring the itemlost_on column it would be nice to have the ability to see when an item was marked damaged so libraries can track repairs and mending.
Comment 1 Nick Clemens (kidclamp) 2017-07-19 13:15:58 UTC
Created attachment 65099 [details] [review]
Bug 17672 - Items table should have a damaged_on column

This patchset adds a 'damaged_on' column to store the date an item is
marked damaged, analogous to withdrawn_on and itemlost_on

To test:
1 - Apply patch
2 - Mark an item damaged via moredetail.pl (Items tab on left in
        details)
3 - Note the damaged on date apears below
4 - Unmark the item, the date is removed
5 - Go to the edit items screen (from top bar 'Edit->edit items')
6 - Mark item damaged - check db or moredetails.pl to see damaged_on
date
7 - Unmark item damaged - confirm date is removed
8 - prove t/db_dependent/Items.t
Comment 2 Nick Clemens (kidclamp) 2017-07-19 13:16:01 UTC
Created attachment 65100 [details] [review]
Bug 17672 - Schema updates
Comment 3 Owen Leonard 2017-08-01 12:46:12 UTC
I haven't seen how withdrawn_on and itemlost_on behave, but I would think it could be useful to store the date the status was changed no matter what it changed to. Why not store the date if you're setting it to 0?
Comment 4 Nick Clemens (kidclamp) 2017-08-07 12:21:16 UTC
(In reply to Owen Leonard from comment #3)
> I haven't seen how withdrawn_on and itemlost_on behave, but I would think it
> could be useful to store the date the status was changed no matter what it
> changed to. Why not store the date if you're setting it to 0?

I think this would be a change in behaviour - currently these or more like the onloan column - info if the criteria is met, blank otherwise. Changing this would impact reports etc. 

I do think it would be a good change, but should be on a new bug
Comment 5 Owen Leonard 2017-08-07 13:42:23 UTC
Created attachment 65551 [details] [review]
[SIGNED-OFF] Bug 17672 - Items table should have a damaged_on column

This patchset adds a 'damaged_on' column to store the date an item is
marked damaged, analogous to withdrawn_on and itemlost_on

To test:
1 - Apply patch
2 - Mark an item damaged via moredetail.pl (Items tab on left in
        details)
3 - Note the damaged on date apears below
4 - Unmark the item, the date is removed
5 - Go to the edit items screen (from top bar 'Edit->edit items')
6 - Mark item damaged - check db or moredetails.pl to see damaged_on
date
7 - Unmark item damaged - confirm date is removed
8 - prove t/db_dependent/Items.t

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 6 Owen Leonard 2017-08-07 13:42:25 UTC
Created attachment 65552 [details] [review]
[SIGNED-OFF] Bug 17672 - Schema updates

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 7 Charles Farmer 2017-11-03 20:17:15 UTC
Since we see the date at which the item was damaged on the moredetail.pl, should we also see this information in the header table of the additem.pl page along the status? Just pitching the idea out there.

Everything worked fine, though I had to bump up the number of tests from 12 to 13 in order to make it work on the current master.
Comment 8 Charles Farmer 2017-11-03 20:25:15 UTC
Created attachment 68937 [details] [review]
Bug 17672 - Items table should have a damaged_on column

This patchset adds a 'damaged_on' column to store the date an item is
marked damaged, analogous to withdrawn_on and itemlost_on

To test:
1 - Apply patch
2 - Mark an item damaged via moredetail.pl (Items tab on left in
        details)
3 - Note the damaged on date apears below
4 - Unmark the item, the date is removed
5 - Go to the edit items screen (from top bar 'Edit->edit items')
6 - Mark item damaged - check db or moredetails.pl to see damaged_on
date
7 - Unmark item damaged - confirm date is removed
8 - prove t/db_dependent/Items.t

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

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 9 Charles Farmer 2017-11-03 20:25:30 UTC
Created attachment 68938 [details] [review]
Bug 17672 - Schema updates

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

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 10 Charles Farmer 2017-11-03 20:25:36 UTC
Created attachment 68939 [details] [review]
Bug 17672 - Dumping Items.t expected tests from 12 to 13
Comment 11 Katrin Fischer 2018-02-18 15:22:00 UTC
Hi Tomas, started on this one not noticing your QA contact at first then saw it's from December. Grabbing this one :)
Comment 12 Katrin Fischer 2018-02-18 17:17:50 UTC
Created attachment 71912 [details] [review]
k
Comment 13 Katrin Fischer 2018-02-18 17:18:39 UTC
Created attachment 71913 [details] [review]
Bug 17672: Add damaged_on to items and deleteditems tables

This patchset adds a 'damaged_on' column to store the date an item is
marked damaged, analogous to withdrawn_on and itemlost_on

To test:
1 - Apply patch
2 - Mark an item damaged via moredetail.pl (Items tab on left in
        details)
3 - Note the damaged on date apears below
4 - Unmark the item, the date is removed
5 - Go to the edit items screen (from top bar 'Edit->edit items')
6 - Mark item damaged - check db or moredetails.pl to see damaged_on
date
7 - Unmark item damaged - confirm date is removed
8 - prove t/db_dependent/Items.t

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

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2018-02-18 17:18:59 UTC
Created attachment 71914 [details] [review]
Bug 17672: Fixing Items.t expected tests from 12 to 13

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Katrin Fischer 2018-02-18 17:20:10 UTC
Works nicely, QA tools and tests pass :)

I fixed patch subjects and changed the database update message a little to describe the change.
Comment 16 Jonathan Druart 2018-02-18 19:49:30 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 17 Jonathan Druart 2018-02-19 20:33:03 UTC
It broke the misc4dev tools:
C4::Installer::load_sql returned the following errors while attempting to load /home/vagrant/misc4dev/data/sql/marc21/1611/after_17196/items.sql:
DBD::mysql::st execute failed: Column count doesn't match value count at row 1 at /usr/share/perl5/DBIx/RunSQL.pm line 273.
Comment 18 Nick Clemens (kidclamp) 2018-02-20 12:02:17 UTC
(In reply to Jonathan Druart from comment #17)
> It broke the misc4dev tools:
> C4::Installer::load_sql returned the following errors while attempting to
> load /home/vagrant/misc4dev/data/sql/marc21/1611/after_17196/items.sql:
> DBD::mysql::st execute failed: Column count doesn't match value count at row
> 1 at /usr/share/perl5/DBIx/RunSQL.pm line 273.

Doesn't this mean misc4dev needs an update? Not sure what is needed here
Comment 19 Tomás Cohen Arazi (tcohen) 2018-02-20 12:08:42 UTC
(In reply to Nick Clemens from comment #18)
> (In reply to Jonathan Druart from comment #17)
> > It broke the misc4dev tools:
> > C4::Installer::load_sql returned the following errors while attempting to
> > load /home/vagrant/misc4dev/data/sql/marc21/1611/after_17196/items.sql:
> > DBD::mysql::st execute failed: Column count doesn't match value count at row
> > 1 at /usr/share/perl5/DBIx/RunSQL.pm line 273.
> 
> Doesn't this mean misc4dev needs an update? Not sure what is needed here

I think Jonathan is asking you to provide a fix for misc4dev he.
Comment 20 Jonathan Druart 2018-02-20 14:43:13 UTC
(In reply to Tomás Cohen Arazi from comment #19)
> I think Jonathan is asking you to provide a fix for misc4dev he.

Nope, I would have asked explicitly in that case :)
I let a note here to let you know and added a keyword to not forget.
Comment 21 Jonathan Druart 2018-02-20 14:55:17 UTC
New commit added to misc4dev.

  commit 05f342d6a850e2a89b2d49a9ce1bcb35c411d787

    Fix items.sql since bug 17672

    damaged_on has been added and so we must list the columns
Comment 22 Nick Clemens (kidclamp) 2018-03-23 00:54:39 UTC
Enhancement, not backported for 17.11