Bugzilla – Attachment 161159 Details for
Bug 16122
Item record needs to keep local use count
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16122: AddReturn unit tests and small fix in sub AddReturn
Bug-16122-AddReturn-unit-tests-and-small-fix-in-su.patch (text/plain), 2.63 KB, created by
Biblibre Sandboxes
on 2024-01-18 22:31:27 UTC
(
hide
)
Description:
Bug 16122: AddReturn unit tests and small fix in sub AddReturn
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2024-01-18 22:31:27 UTC
Size:
2.63 KB
patch
obsolete
>From bd459d908928c1a37f1d181923157d7c4a04d785 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 18 Jan 2024 19:14:48 +0000 >Subject: [PATCH] Bug 16122: AddReturn unit tests and small fix in sub > AddReturn > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >--- > C4/Circulation.pm | 2 +- > t/db_dependent/Circulation.t | 20 +++++++++++++++++++- > 2 files changed, 20 insertions(+), 2 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 0e0a6d0a68..deeb737ee3 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2159,7 +2159,7 @@ sub AddReturn { > > my $itemnumber = $item->itemnumber; > my $itemtype = $item->effective_itemtype; >- my $localuse_count = $item->localuse; >+ my $localuse_count = $item->localuse || 0; > > my $issue = $item->checkout; > if ( $issue ) { >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 5095afde73..35e795f075 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -6116,21 +6116,39 @@ subtest 'Tests for transfer not in transit' => sub { > > subtest 'Tests for RecordLocalUseOnReturn' => sub { > >- plan tests => 2; >+ plan tests => 5; > > t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0); > my $item = $builder->build_sample_item(); >+ my $item_2 = $builder->build_sample_item( >+ { >+ onloan => undef, >+ } >+ ); >+ > $item->withdrawn(1)->itemlost(1)->store; > my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef ); > is_deeply( > \@return, > [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "RecordLocalUSeOnReturn is off, no local use recorded"); > >+ AddReturn( $item_2->barcode, $item_2->homebranch ); >+ $item_2->discard_changes; # refresh >+ is( $item_2->localuse, undef , 'Without RecordLocalUseOnReturn no localuse is recorded.'); >+ > t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 1); > my @return2 = AddReturn( $item->barcode, $item->homebranch, 0, undef ); > is_deeply( > \@return2, > [ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded"); >+ >+ AddReturn( $item_2->barcode, $item_2->homebranch ); >+ $item_2->discard_changes; # refresh >+ is( $item_2->localuse, 1 , 'With RecordLocalUseOnReturn localuse is recorded.'); >+ >+ AddReturn( $item_2->barcode, $item_2->homebranch ); >+ $item_2->discard_changes; # refresh >+ is( $item_2->localuse, 2 , 'With RecordLocalUseOnReturn localuse is recorded.'); > }; > > subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { >-- >2.30.2
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 16122
:
149281
|
149282
|
149283
|
149284
|
150231
|
150232
|
150233
|
150234
|
150235
|
150236
|
150623
|
150693
|
153193
|
153196
|
153197
|
153198
|
153199
|
153200
|
158466
|
158467
|
158468
|
158469
|
158470
|
158471
|
161001
|
161002
|
161003
|
161004
|
161005
|
161006
|
161144
|
161145
|
161146
|
161147
|
161148
|
161149
|
161150
|
161151
|
161153
|
161154
|
161155
|
161156
|
161157
|
161158
|
161159
|
161160
|
163072
|
163073
|
163074
|
163075
|
163076
|
163077
|
163243
|
163244
|
163245
|
163246
|
163247
|
163248
|
163296
|
163297
|
163298
|
163299
|
163300
|
163301
|
163302
|
163303
|
165313
|
165314
|
165315
|
165316
|
165317
|
165318
|
165319
|
165320