Bug 30337: Holds to Pull ( pendingreserves.pl ) ignores holds if priority 1 hold is suspended
Holds to Pull ( pendingreserves.pl ) ignores holds if priority 1 hold is suspended, and shows the wrong number of "patrons with holds" which presumably tells the librarian how many copies to pull from the shelves. Test Plan: 1) Create a record with one or more holdable items 2) Place two holds on the record 3) Note they show in the holds to pull report 4) Suspend the priority 2 hold 5) Note the report continues showing that 2 patrons have holds 6) Resume the priority 2 hold 7) Suspend the priority 1 hold 8) Note the hold disappears from the holds to pull report 9) Apply this patch 10) Restart all the things! 11) Reload the holds to pull report 12) The report should show one hold that needs an item pulled to fill it! Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
fcb08b0e93
commit
e536229292
1 changed files with 7 additions and 3 deletions
|
@ -156,7 +156,7 @@ unless ( $enddate ) {
|
|||
# building query parameters
|
||||
my %where = (
|
||||
'me.found' => undef,
|
||||
'me.priority' => 1,
|
||||
'me.priority' => { '!=' => 0 },
|
||||
'me.suspend' => 0,
|
||||
'itembib.itemlost' => 0,
|
||||
'itembib.withdrawn' => 0,
|
||||
|
@ -188,7 +188,7 @@ if ( C4::Context->preference('IndependentBranches') ){
|
|||
# get all distinct unfulfilled reserves
|
||||
my $holds = Koha::Holds->search(
|
||||
{ %where },
|
||||
{ join => 'itembib', distinct => 1, columns => qw[me.biblionumber] }
|
||||
{ join => 'itembib', distinct => 1, columns => qw[me.biblionumber] }
|
||||
);
|
||||
my @biblionumbers = $holds->get_column('biblionumber');
|
||||
|
||||
|
@ -202,7 +202,7 @@ if ( $holds->count ) {
|
|||
# patrons count per biblio
|
||||
my $patrons_count = {
|
||||
map { $_->{biblionumber} => $_->{patrons_count} } @{ Koha::Holds->search(
|
||||
{},
|
||||
{ 'suspend' => 0 },
|
||||
{
|
||||
select => [ 'biblionumber', { count => { distinct => 'borrowernumber' } } ],
|
||||
as => [qw( biblionumber patrons_count )],
|
||||
|
@ -235,7 +235,11 @@ my $all_holds = {
|
|||
|
||||
# make final holds_info array and fill with info
|
||||
my @holds_info;
|
||||
my $seen = {};
|
||||
foreach my $bibnum ( @biblionumbers ){
|
||||
# Skip this record if it's already been handled
|
||||
next if $seen->{$bibnum};
|
||||
$seen->{$bibnum} = 1;
|
||||
|
||||
my $hold_info;
|
||||
my $items = $all_items->{$bibnum};
|
||||
|
|
Loading…
Reference in a new issue