From 6209ecaaf913786654fc868ec24519a6cb19dc1b Mon Sep 17 00:00:00 2001 From: charles Date: Mon, 15 Jan 2018 16:20:10 -0500 Subject: [PATCH] Bug19974 - Marking an item as 'lost' in additem.pl will not modify the current item TEST PLAN: 1) Log in with your superlibrarian account 2) Borrow any book 3) Visit your Checkouts page, and click 'Show Checkouts' 4) Click on the item's barcode to visit the item's page 5) On the item's page, click the 'Edit' button, and choose 'Edit items' 6) In the items table, click the 'Actions->Edit' button of the item you borrowed 7) Mark that item as lost (it should be the first row of the form) and click the button 'Save changes' 8) Visit your Checkouts page. The item should still be there, despite BZ12363 claiming it should've been automagically returned 8.1) Your koha-log should also output a warning message: 'DBIx::Class::Storage::DBI::select_single(): Query returned more than one row...' 8.2) If you visit the item's page, the modification had no effect. It should not be marked as lost. 9) APPLY PATCH 10) Start back from step 2), but this time, after marking the item as lost, the item's page should reflect the change, and the item you borrowed should've been automatically returned to the library --- cataloguing/additem.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index a0500a4..88da556 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -687,20 +687,21 @@ if ($op eq "additem") { # check that the barcode don't exist already my $addedolditem = TransformMarcToKoha($itemtosave); my $exist_itemnumber = get_item_from_barcode($addedolditem->{'barcode'}); + my $item = GetItem( $itemnumber ); + my $current_itemnumber = $itemnumber; # this is only while we figure out why itemnumber is cleared out below after ModItemFromMarc if ($exist_itemnumber && $exist_itemnumber != $itemnumber) { push @errors,"barcode_not_unique"; } else { ModItemFromMarc($itemtosave,$biblionumber,$itemnumber); $itemnumber=""; } - my $item = GetItem( $itemnumber ); my $olditemlost = $item->{'itemlost'}; my ($lost_tag,$lost_subfield) = GetMarcFromKohaField("items.itemlost",''); my $newitemlost = $itemtosave->subfield( $lost_tag, $lost_subfield ); if (($olditemlost eq '0' or $olditemlost eq '' ) and $newitemlost ge '1'){ - LostItem($itemnumber); + LostItem($current_itemnumber); } $nextop="additem"; } elsif ($op eq "delinkitem"){ -- 2.7.4