Bug 9673

Summary: Track when items are marked as lost or withdrawn
Product: Koha Reporter: Kyle M Hall <kyle>
Component: CatalogingAssignee: Kyle M Hall <kyle>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: enhancement    
Priority: P5 - low CC: gitbot, gmcharlt, jonathan.druart, katrin.fischer, m.de.rooy, mathsabypro, melia, nengard
Version: master   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: Small patch
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
Bug Depends on: 10550    
Bug Blocks:    
Attachments: Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 2
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 2
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 3 - Clear 'on' fields when clearing statuses
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 3 - Clear 'on' fields when clearing statuses
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 3 - Clear 'on' fields when clearing statuses
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 2 - Change wthdrawn_on to withdrawn_on
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 2 - Change wthdrawn_on to withdrawn_on
[SIGNED-OFF] Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup
Bug 9673 - Track when items are marked as lost or withdrawn
Bug 9673: QA followup

Description Kyle M Hall 2013-02-20 14:34:10 UTC
Many librarians would like a quick and easy way to know when an item was marked as lost or withdrawn.
Comment 1 Kyle M Hall 2013-02-20 14:38:08 UTC Comment hidden (obsolete)
Comment 2 Katrin Fischer 2013-03-02 12:25:05 UTC
Hi Kyle, 
please add the new fields also to the deleteditems table, else deleting items won't work correctly. I was also wondering if it might be useful to add this information to action_log or statistics table?
Comment 3 Kyle M Hall 2013-03-05 17:40:56 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall 2013-03-05 17:42:04 UTC
(In reply to comment #2)
> Hi Kyle, 
> please add the new fields also to the deleteditems table, else deleting
> items won't work correctly. I was also wondering if it might be useful to
> add this information to action_log or statistics table?

I believe this information may already be recorded in the action logs, but is not easily accessible to librarians as the format it is stored in is not exactly user friendly.
Comment 5 mathieu saby 2013-03-10 12:37:31 UTC Comment hidden (obsolete)
Comment 6 mathieu saby 2013-03-10 12:39:34 UTC Comment hidden (obsolete)
Comment 7 mathieu saby 2013-03-10 12:44:01 UTC
I fear did some mistakes using git bz...
But I have tested and I sign off :
- marking an item withdrawn
- marking an item lost
=> date visible
- mark an item previously lost or withdrawn as "non lost" and "non withdrawn"
=> date invisible, and no more present in database
- suppressing an item marked as lost of withdrawn
=> item moved to deleteditem. date of loss / withdrawal stored in deleteditem

M. Saby
Comment 8 mathieu saby 2013-03-10 12:45:00 UTC
An other interesting feature would be the ability to add comment when marking an item as lost or withdrawn.

M. Saby
Comment 9 Jonathan Druart 2013-03-11 11:18:30 UTC
(In reply to comment #2)
> Hi Kyle, 
> please add the new fields also to the deleteditems table, else deleting
> items won't work correctly. I was also wondering if it might be useful to
> add this information to action_log or statistics table?

In kohastructure too :)
Marked as Failed QA.
Comment 10 Kyle M Hall 2013-03-11 15:24:47 UTC Comment hidden (obsolete)
Comment 11 Kyle M Hall 2013-03-11 15:25:45 UTC Comment hidden (obsolete)
Comment 12 Jonathan Druart 2013-03-11 16:19:04 UTC
QA comment:
1/ DateTime::Format::MySQL is not load in C4::Items
2/ If someone edits the item even thought it is already marked as lost, the lost on date becomes the current date. Is it really what we want?

Marked as Failed QA for 1 and certainly for 2 too (except if it is wanted).
Comment 13 mathieu saby 2013-03-11 16:28:20 UTC
For 2) : I did not see that, but clearly, no, I don't want such a behavior...

M. Saby
Comment 14 Kyle M Hall 2013-03-21 14:18:48 UTC Comment hidden (obsolete)
Comment 15 Kyle M Hall 2013-03-21 14:19:00 UTC Comment hidden (obsolete)
Comment 16 Kyle M Hall 2013-03-21 14:19:53 UTC Comment hidden (obsolete)
Comment 17 Kyle M Hall 2013-03-21 14:20:03 UTC Comment hidden (obsolete)
Comment 18 Kyle M Hall 2013-03-21 14:23:58 UTC Comment hidden (obsolete)
Comment 19 Jonathan Druart 2013-03-21 15:26:25 UTC
QA comment:
Just looking at the code:
If itemlost *and* wthdrawn are defined, we will have 2 calls to GetItem. It could be improve if a test is added before the loop.

Something like:
if ( $item->{itemlost} or $item->{wthdrawn} ) {
 my $pre_mod_item = GetItem($item->{'itemnumber'});
 for my $field ( qw( itemlost wthdrawn ) ) {
     if ( defined( $item->{$field} ) ) {

Marked as Failed QA.
Comment 20 Kyle M Hall 2013-05-08 16:30:23 UTC Comment hidden (obsolete)
Comment 21 Kyle M Hall 2013-05-08 16:30:33 UTC Comment hidden (obsolete)
Comment 22 Kyle M Hall 2013-05-08 16:31:15 UTC Comment hidden (obsolete)
Comment 23 Kyle M Hall 2013-05-08 16:36:29 UTC Comment hidden (obsolete)
Comment 24 Jonathan Druart 2013-05-13 14:24:44 UTC
Kyle, shouldn't we unset the withdrawn date if an item is restored?
Comment 25 Jonathan Druart 2013-06-14 10:39:57 UTC
ping Kyle
Comment 26 Kyle M Hall 2013-06-14 14:00:37 UTC Comment hidden (obsolete)
Comment 27 Kyle M Hall 2013-06-14 14:04:20 UTC Comment hidden (obsolete)
Comment 28 Jonathan Druart 2013-06-14 14:19:02 UTC
Kyle, The last patch does not work.
Try to :
1/ Mark as lost
2/ Mark as withdrawn
=> I got in DB:
   itemlost: 1
itemlost_on: NULL
   wthdrawn: 1
wthdrawn_on: 2013-06-14 16:18:12
Comment 29 Kyle M Hall 2013-06-17 15:56:11 UTC Comment hidden (obsolete)
Comment 30 Kyle M Hall 2013-06-17 15:58:40 UTC Comment hidden (obsolete)
Comment 31 Jonathan Druart 2013-06-18 07:16:23 UTC
Kyle,

Sorry but the last patch needs a signoff.

Early qa: maybe the 3 conditional tests if, unless and if
+        for my $field (@fields) {
+            if ( defined( $item->{$field} ) ) {
+                unless ( $pre_mod_item->{$field} ) {
+                    if ( $item->{$field} ) {
could be group into a simple condition (gain of visibility and indentation level)
    if(
           defined( $item->{$field} )
       and not pre_mod_item->{$field}
       and $item->{$field}
    )

It's a minor thing.

Switch back to Needs SignOff
Comment 32 Kyle M Hall 2013-06-18 14:55:56 UTC Comment hidden (obsolete)
Comment 33 Kyle M Hall 2013-06-18 14:56:11 UTC Comment hidden (obsolete)
Comment 34 Katrin Fischer 2013-07-07 11:06:26 UTC
Should we carry the existing typo to another column? wthdrawn -> wthdrawn_on?
Comment 35 Kyle M Hall 2013-07-08 11:47:18 UTC
(In reply to Katrin Fischer from comment #34)
> Should we carry the existing typo to another column? wthdrawn -> wthdrawn_on?

Yes, absolutely! I think it would be far more confusing to have one field named correctly and one not. At least this way we have consistency. And, when I or someone else get around to renaming the wthdrawn column, we can rename both at once.
Comment 36 Galen Charlton 2013-07-08 15:48:22 UTC
(In reply to Kyle M Hall from comment #35)
> (In reply to Katrin Fischer from comment #34)
> > Should we carry the existing typo to another column? wthdrawn -> wthdrawn_on?
> 
> Yes, absolutely! I think it would be far more confusing to have one field
> named correctly and one not. At least this way we have consistency. And,
> when I or someone else get around to renaming the wthdrawn column, we can
> rename both at once.

I can't say I'm keen on a patch that intentionally adds a typo, even for the sake of consistency.
Comment 37 Kyle M Hall 2013-07-08 15:50:31 UTC
Ok, I'll file a bug to rename wthdrawn, update this patch, and make it depend on the new bug. That should resolve all the issues at once.
Comment 38 Kyle M Hall 2013-07-08 17:24:33 UTC Comment hidden (obsolete)
Comment 39 Kyle M Hall 2013-07-08 17:24:44 UTC Comment hidden (obsolete)
Comment 40 Kyle M Hall 2013-07-08 17:26:34 UTC Comment hidden (obsolete)
Comment 41 Kyle M Hall 2013-07-08 17:32:30 UTC Comment hidden (obsolete)
Comment 42 Kyle M Hall 2013-07-08 17:32:38 UTC Comment hidden (obsolete)
Comment 43 Kyle M Hall 2013-07-08 17:32:47 UTC Comment hidden (obsolete)
Comment 44 Kyle M Hall 2013-07-08 17:38:25 UTC Comment hidden (obsolete)
Comment 45 Kyle M Hall 2013-07-08 17:38:37 UTC Comment hidden (obsolete)
Comment 46 Kyle M Hall 2013-07-08 19:31:17 UTC Comment hidden (obsolete)
Comment 47 Katrin Fischer 2013-07-08 23:08:02 UTC
Should we also be nice and update saved reports using wthdrawn?
Comment 48 I'm just a bot 2013-09-18 11:15:51 UTC
Applying: Bug 9673 - Track when items are marked as lost or withdrawn
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 9673 - Track when items are marked as lost or withdrawn
The copy of the patch that failed is found in:
   /home/christopher/git/koha/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Comment 49 Kyle M Hall 2013-10-02 17:21:14 UTC Comment hidden (obsolete)
Comment 50 Kyle M Hall 2013-10-02 17:21:27 UTC Comment hidden (obsolete)
Comment 51 Jonathan Druart 2013-11-04 11:24:33 UTC
QA comment:
Works as described.
There is a typo in updatedb (wthdrawn vs withdrawn).
The itemlost date (itemlost_on value) should be display only if the itemlost value is set (!= "").
I will submit a followup.
Marked as Passed QA.
Comment 52 Jonathan Druart 2013-11-04 11:26:34 UTC
Created attachment 22690 [details] [review]
Bug 9673 - Track when items are marked as lost or withdrawn

Add date fields to track when an item was marked as lost or withdrawn.
Display those fields on catalogue/moredetail.pl

Test Plan:
1) Apply patch
2) Run updatedatabase.pl
3) Pick a record with items, browse to the 'items' tab ( moredetail.pl )
4) Mark an item as lost, verify the field "Lost on:" displays below
   the "Lost status" field with todays date.
5) Mark the item as not lost, verify the field no longer displays
6) Repeat steps 4 and 5 with the Withdrawn field.

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 53 Jonathan Druart 2013-11-04 11:26:47 UTC
Created attachment 22691 [details] [review]
Bug 9673: QA followup

This followup fixes the wthdrawn typo exist in updatedatabase.pl and
does not display the lostitem date if the lostitem value is not set (!=
"").

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 54 Jonathan Druart 2013-11-04 11:28:12 UTC
I forgot to mention: I squashed the 2 patches (second patch fixed the typo and was not useful for the history).
Comment 55 Galen Charlton 2013-12-19 06:30:20 UTC
Pushed to master.  Thanks, Kyle!