Bugzilla – Attachment 113764 Details for
Bug 24488
Holds to Pull sometimes shows the wrong 'first patron' details
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24488: (QA follow-up) Move getting items out of cycle
Bug-24488-QA-follow-up-Move-getting-items-out-of-c.patch (text/plain), 4.44 KB, created by
Josef Moravec
on 2020-11-17 20:40:38 UTC
(
hide
)
Description:
Bug 24488: (QA follow-up) Move getting items out of cycle
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2020-11-17 20:40:38 UTC
Size:
4.44 KB
patch
obsolete
>From dad69143fa8b99db82a92a04fc475c478934ff69 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Tue, 17 Nov 2020 20:38:10 +0000 >Subject: [PATCH] Bug 24488: (QA follow-up) Move getting items out of cycle > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > circ/pendingreserves.pl | 46 +++++++++++++++++++++++++++------------------- > 1 file changed, 27 insertions(+), 19 deletions(-) > >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index b3d23f45b0..d661d2edaa 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -191,32 +191,40 @@ if ( C4::Context->preference('IndependentBranches') ){ > # get all distinct unfulfilled reserves > my $distinct_holds = Koha::Holds->search( > { %where }, >- { join => 'itembib', alias => 'reserve' } >+ { join => 'itembib', alias => 'reserve', columns => [ 'biblionumber' ] } > ); > my @biblionumbers = uniq $distinct_holds->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 $all_items; >+foreach my $item ( @all_items ) { >+ push @{$all_items->{$item->biblionumber}}, $item; >+} >+ >+ > # make final reserves hash and fill with info > my $reserves; > foreach my $bibnum ( @biblionumbers ){ > >- my @items = Koha::Items->search( >- { >- biblionumber => $bibnum, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- onloan => undef, >- itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] }, >- } >- ); >+ my $items = $all_items->{$bibnum}; > > # get available item types for each biblio > my @res_itemtypes; > if ( C4::Context->preference('item-level_itypes') ){ >- @res_itemtypes = uniq map { defined $_->itype ? $_->itype : () } @items; >+ @res_itemtypes = uniq map { defined $_->itype ? $_->itype : () } @$items; > } else { > @res_itemtypes = Koha::Biblioitems->search( > { biblionumber => $bibnum, itemtype => { '!=', undef } }, >@@ -228,25 +236,25 @@ foreach my $bibnum ( @biblionumbers ){ > $reserves->{$bibnum}->{itemtypes} = \@res_itemtypes; > > # get available locations for each biblio >- $reserves->{$bibnum}->{locations} = [ uniq map { defined $_->location ? $_->location : () } @items ]; >+ $reserves->{$bibnum}->{locations} = [ uniq map { defined $_->location ? $_->location : () } @$items ]; > > # get available callnumbers for each biblio >- $reserves->{$bibnum}->{callnumbers} = [ uniq map { defined $_->itemcallnumber ? $_->itemcallnumber : () } @items ]; >+ $reserves->{$bibnum}->{callnumbers} = [ uniq map { defined $_->itemcallnumber ? $_->itemcallnumber : () } @$items ]; > > # get available enumchrons for each biblio >- $reserves->{$bibnum}->{enumchrons} = [ uniq map { defined $_->enumchron ? $_->enumchron : () } @items ]; >+ $reserves->{$bibnum}->{enumchrons} = [ uniq map { defined $_->enumchron ? $_->enumchron : () } @$items ]; > > # get available copynumbers for each biblio >- $reserves->{$bibnum}->{copynumbers} = [ uniq map { defined $_->copynumber ? $_->copynumber : () } @items ]; >+ $reserves->{$bibnum}->{copynumbers} = [ uniq map { defined $_->copynumber ? $_->copynumber : () } @$items ]; > > # get available barcodes for each biblio >- $reserves->{$bibnum}->{barcodes} = [ uniq map { defined $_->barcode ? $_->barcode : () } @items ]; >+ $reserves->{$bibnum}->{barcodes} = [ uniq map { defined $_->barcode ? $_->barcode : () } @$items ]; > > # get available holding branches for each biblio >- $reserves->{$bibnum}->{holdingbranches} = [ uniq map { defined $_->holdingbranch ? $_->holdingbranch : () } @items ]; >+ $reserves->{$bibnum}->{holdingbranches} = [ uniq map { defined $_->holdingbranch ? $_->holdingbranch : () } @$items ]; > > # items available >- my $items_count = scalar @items; >+ my $items_count = scalar @$items; > $reserves->{$bibnum}->{items_count} = $items_count; > > # patrons with holds >-- >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 24488
:
97773
|
106379
|
106882
|
107206
|
107213
|
111341
|
111342
|
111343
|
111347
|
111348
|
111349
|
111350
|
111358
|
111359
|
111360
|
111361
|
111362
|
112815
|
112816
|
112817
|
112818
|
112819
|
113695
|
113696
|
113697
|
113698
|
113699
|
113700
|
113756
|
113757
|
113763
|
113764
|
113774
|
113775
|
113776
|
113777
|
113778
|
113798
|
113829
|
113830
|
113831
|
113832
|
113833
|
113834
|
113835
|
113836
|
113837
|
113838
|
113839
|
113840
|
113841
|
113842
|
113850
|
113851
|
113852
|
113853
|
113854
|
113855
|
113856
|
113857
|
113858
|
113859
|
113860
|
113861
|
113862
|
113863
|
113864
|
114835
|
114836
|
114837
|
114838
|
114839
|
114840
|
114841
|
114842
|
114843
|
114844
|
114845
|
114846
|
114847
|
114848
|
114849
|
114850
|
116362
|
116363
|
116364
|
116365
|
116366
|
116367
|
116368
|
116369
|
116370
|
116371
|
116372
|
116373
|
116374
|
116375
|
116376
|
116377
|
116384