Bugzilla – Attachment 133877 Details for
Bug 30432
get_items_that_can_fill needs to specify table for biblionumbers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30432: [21.05.x] Specify 'me' for biblionumber when limiting items
Bug-30432-2105x-Specify-me-for-biblionumber-when-l.patch (text/plain), 2.83 KB, created by
Nick Clemens (kidclamp)
on 2022-04-26 12:10:25 UTC
(
hide
)
Description:
Bug 30432: [21.05.x] Specify 'me' for biblionumber when limiting items
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-04-26 12:10:25 UTC
Size:
2.83 KB
patch
obsolete
>From 68976bd71fe4d8755ea910c73246812773fedd4a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 1 Apr 2022 12:48:54 +0000 >Subject: [PATCH] Bug 30432: [21.05.x] Specify 'me' for biblionumber when > limiting items > >To test: >1 - Apply only unit tests >2 - prove t/db_dependent/Koha/Holds.t >3 - It fails >4 - Apply this patch >5 - prove t/db_dependent/Koha/Holds.t >6 - It passes! > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Bug 30432: Unit test > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Bug 30432: Fix random failure > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Holds.pm | 2 +- > t/db_dependent/Koha/Holds.t | 15 ++++++++++++++- > 2 files changed, 15 insertions(+), 2 deletions(-) > >diff --git a/Koha/Holds.pm b/Koha/Holds.pm >index 19bcb6c02f..a6e3c0b424 100644 >--- a/Koha/Holds.pm >+++ b/Koha/Holds.pm >@@ -116,7 +116,7 @@ sub get_items_that_can_fill { > my @biblionumbers = $self->search({ 'me.itemnumber' => undef })->get_column('biblionumber'); > my @bibs_or_items; > push @bibs_or_items, 'me.itemnumber' => { in => \@itemnumbers } if @itemnumbers; >- push @bibs_or_items, 'biblionumber' => { in => \@biblionumbers } if @biblionumbers; >+ push @bibs_or_items, 'me.biblionumber' => { in => \@biblionumbers } if @biblionumbers; > > my @branchtransfers = map { $_->itemnumber } > Koha::Item::Transfers->search( >diff --git a/t/db_dependent/Koha/Holds.t b/t/db_dependent/Koha/Holds.t >index 5012469c6e..6ee827bf06 100755 >--- a/t/db_dependent/Koha/Holds.t >+++ b/t/db_dependent/Koha/Holds.t >@@ -410,7 +410,7 @@ subtest 'Desks' => sub { > }; > > subtest 'get_items_that_can_fill' => sub { >- plan tests => 3; >+ plan tests => 4; > > my $biblio = $builder->build_sample_biblio; > my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4 >@@ -502,6 +502,19 @@ subtest 'get_items_that_can_fill' => sub { > is_deeply( [ map { $_->itemnumber } $items->as_list ], > [ $item_2->itemnumber ], 'Only item 2 is available for filling the hold' ); > >+ >+ my $noloan_itype = $builder->build_object( { class => 'Koha::ItemTypes', value => { notforloan => 1 } } ); >+ t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); >+ Koha::Holds->find( $waiting_reserve_id )->delete; >+ $holds = Koha::Holds->search( >+ { >+ reserve_id => [ $reserve_id_1, $reserve_id_2 ] >+ } >+ ); >+ $items = $holds->get_items_that_can_fill; >+ is_deeply( [ sort map { $_->itemnumber } $items->as_list ], >+ [ $item_1->itemnumber, $item_2->itemnumber, $item_5->itemnumber ], 'Items 1, 2, and 5 are available for filling the holds' ); >+ > }; > > $schema->storage->txn_rollback; >-- >2.11.0
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 30432
:
132862
|
132863
|
132930
|
132931
|
133039
|
133040
|
133041
| 133877