Bugzilla – Attachment 73390 Details for
Bug 20487
AddReturn should clear items.onloan for unissued items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20487: AddReturn should always clear items.onloan
Bug-20487-AddReturn-should-always-clear-itemsonloa.patch (text/plain), 2.49 KB, created by
Marcel de Rooy
on 2018-03-28 14:45:03 UTC
(
hide
)
Description:
Bug 20487: AddReturn should always clear items.onloan
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-03-28 14:45:03 UTC
Size:
2.49 KB
patch
obsolete
>From 3b9d6631b23fe89271edb01ba935df6d1c253947 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 28 Mar 2018 16:25:07 +0200 >Subject: [PATCH] Bug 20487: AddReturn should always clear items.onloan >Content-Type: text/plain; charset=utf-8 > >If an item is no longer issued but somehow still has a date in the onloan >column, checking it in should clear that date. >Realized by a simple change in AddReturn, moving the ModItem call outside >the if-doreturn statement and testing if the change is needed. > >Test plan: >[1] Run t/db_dependent/Circulation.t >[2] Bonus: Checkout item, delete issue from table, checkin. Verify that > items.onloan has been cleared. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Circulation.pm | 4 ++-- > t/db_dependent/Circulation.t | 13 ++++++++++++- > 2 files changed, 14 insertions(+), 3 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 3e711cd..1e0fce6 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1919,9 +1919,9 @@ sub AddReturn { > $messages->{'WasReturned'} = 1; > > } >- >- ModItem({ onloan => undef }, $item->{biblionumber}, $item->{'itemnumber'}); > } >+ # Clear items.onloan when needed >+ ModItem({ onloan => undef }, $item->{biblionumber}, $item->{itemnumber}) if defined $item->{onloan}; > > # the holdingbranch is updated if the document is returned to another location. > # this is always done regardless of whether the item was on loan or not >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index f4ff177..f64dd59 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 113; >+use Test::More tests => 114; > > use DateTime; > >@@ -2047,6 +2047,17 @@ subtest 'CanBookBeIssued | is_overdue' => sub { > > }; > >+subtest 'AddReturn should always clear items.onloan' => sub { >+ plan tests => 1; >+ >+ # Tested by returning an item that has not been issued >+ t::lib::Mocks::mock_preference( "AllowReturnToBranch", 'anywhere' ); >+ my $item = $builder->build_object({ class => 'Koha::Items', value => { onloan => '2018-01-01' }}); >+ AddReturn( $item->barcode, $item->homebranch ); >+ $item->discard_changes; # refresh >+ is( $item->onloan, undef, 'AddReturn did clear items.onloan' ); >+}; >+ > sub set_userenv { > my ( $library ) = @_; > C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20487
:
73390
|
73409
|
74723
|
74995
|
75290
|
75694
|
75695
|
76615
|
76616
|
78050
|
78051