Bugzilla – Attachment 116969 Details for
Bug 27131
Move code from circ/pendingreserves.pl to modules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27131: Add get_items_that_can_fill
Bug-27131-Add-getitemsthatcanfill.patch (text/plain), 2.82 KB, created by
Andrii Nugged
on 2021-02-18 01:56:12 UTC
(
hide
)
Description:
Bug 27131: Add get_items_that_can_fill
Filename:
MIME Type:
Creator:
Andrii Nugged
Created:
2021-02-18 01:56:12 UTC
Size:
2.82 KB
patch
obsolete
>From bf68e51dd676f7cadca1beacf4d8923f99635096 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 2 Dec 2020 09:23:42 +0100 >Subject: [PATCH] Bug 27131: Add get_items_that_can_fill > >Signed-off-by: Andrew Nugged <nugged@gmail.com> >--- > Koha/Holds.pm | 34 ++++++++++++++++++++++++++++++++++ > circ/pendingreserves.pl | 19 +++---------------- > 2 files changed, 37 insertions(+), 16 deletions(-) > >diff --git a/Koha/Holds.pm b/Koha/Holds.pm >index 604953d4c9..4a25babff5 100644 >--- a/Koha/Holds.pm >+++ b/Koha/Holds.pm >@@ -92,6 +92,40 @@ sub forced_hold_level { > return; > } > >+sub get_items_that_can_fill { >+ my ( $self ) = @_; >+ >+ my @biblionumbers = $self->get_column('biblionumber'); >+ >+ my @branchtransfers = map { $_->itemnumber } >+ Koha::Item::Transfers->search( >+ { datearrived => undef }, >+ { >+ columns => ['itemnumber'], >+ collapse => 1, >+ } >+ ); >+ my @waiting_holds = map { $_->itemnumber } >+ Koha::Holds->search( >+ { 'found' => 'W' }, >+ { >+ columns => ['itemnumber'], >+ collapse => 1, >+ } >+ ); >+ >+ return Koha::Items->search( >+ { >+ biblionumber => { in => \@biblionumbers }, >+ itemlost => 0, >+ withdrawn => 0, >+ notforloan => 0, >+ onloan => undef, >+ itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] }, >+ } >+ ); >+} >+ > =head3 type > > =cut >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 3ed65938b7..995d63bd9c 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -188,27 +188,14 @@ if ( C4::Context->preference('IndependentBranches') ){ > } > > # get all distinct unfulfilled reserves >-my @biblionumbers = Koha::Holds->search( >+my $holds = Koha::Holds->search( > { %where }, > { join => 'itembib', alias => 'reserve', distinct => 1, columns => qw[me.biblionumber] } >-)->get_column('biblionumber'); >- >-my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 }); >-my @waiting_holds = map { $_->itemnumber } Koha::Holds->search({'found' => 'W'}, { columns => [ 'itemnumber' ], collapse => 1 }); >- >-my @all_items = Koha::Items->search( >- { >- biblionumber => { in => \@biblionumbers }, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- onloan => undef, >- itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] }, >- } > ); >+my @biblionumbers = $holds->get_column('biblionumber'); > > my $all_items; >-foreach my $item ( @all_items ) { >+foreach my $item ( $holds->get_items_that_can_fill ) { > push @{$all_items->{$item->biblionumber}}, $item; > } > >-- >2.30.1
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 27131
:
114085
|
114851
|
114852
|
116969
|
116970
|
116971
|
116972
|
116973
|
116977