Created attachment 15567[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.

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?

Created attachment 15890[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.

(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.

Created attachment 16002[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.

Created attachment 16003[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>

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

(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.

Created attachment 16032[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>

Created attachment 16033[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>

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).

Created attachment 16642[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>

Created attachment 16644[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>

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.

Created attachment 18031[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>

Created attachment 18033[details][review]Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 2
* Reduces the possible cass to GetItem from 2 to 1
* Uses dt_from_string to get the DateTime object, so the time zone is correct

Created attachment 18034[details][review]Bug 9673 - Track when items are marked as lost or withdrawn - QA Followup 2
* Reduces the possible cass to GetItem from 2 to 1
* Uses dt_from_string to get the DateTime object, so the time zone is correct

Created attachment 19120[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>

(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.

(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.

Created attachment 19483[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>

Created attachment 19486[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>

Created attachment 19489[details][review]
[SIGNED-OFF] 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>

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".

Created attachment 21730[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>

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.

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>