Bugzilla – Attachment 75290 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 clear items.onloan for unissued items
Bug-20487-AddReturn-should-clear-itemsonloan-for-u.patch (text/plain), 2.31 KB, created by
Charles Farmer
on 2018-05-11 22:30:52 UTC
(
hide
)
Description:
Bug 20487: AddReturn should clear items.onloan for unissued items
Filename:
MIME Type:
Creator:
Charles Farmer
Created:
2018-05-11 22:30:52 UTC
Size:
2.31 KB
patch
obsolete
>From 8dae1e940921f4f803e42f58162d1ca328ffa561 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 clear items.onloan for unissued > items > >If an item is no longer issued but somehow still has a date in the onloan >column, checking it in should clear that date. >Adding a ModItem call in the NotIssued section. > >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> > >Signed-off-by: Charles Farmer <charles.farmer@inLibro.com> >--- > C4/Circulation.pm | 1 + > t/db_dependent/Circulation.t | 11 ++++++++++- > 2 files changed, 11 insertions(+), 1 deletion(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 2deb367..7773397 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1814,6 +1814,7 @@ sub AddReturn { > . Dumper($issue->unblessed) . "\n"; > } else { > $messages->{'NotIssued'} = $barcode; >+ ModItem({ onloan => undef }, $item->{biblionumber}, $item->{itemnumber}) if defined $item->{onloan}; > # even though item is not on loan, it may still be transferred; therefore, get current branch info > $doreturn = 0; > # No issue, no borrowernumber. ONLY if $doreturn, *might* you have a $borrower later. >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index e93b019..d07a0cd 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 116; >+use Test::More tests => 117; > > use DateTime; > use POSIX qw( floor ); >@@ -2192,6 +2192,15 @@ subtest 'CanBookBeIssued | is_overdue' => sub { > > }; > >+subtest 'AddReturn should clear items.onloan for unissued items' => sub { >+ plan tests => 1; >+ >+ 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' ); >+}; > > $schema->storage->txn_rollback; > $cache->clear_from_cache('single_holidays'); >-- >2.7.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