Bugzilla – Attachment 111347 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: (follow-up) Reduce repeated code
Bug-24488-follow-up-Reduce-repeated-code.patch (text/plain), 5.70 KB, created by
Nick Clemens (kidclamp)
on 2020-10-07 15:59:57 UTC
(
hide
)
Description:
Bug 24488: (follow-up) Reduce repeated code
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-10-07 15:59:57 UTC
Size:
5.70 KB
patch
obsolete
>From 60afc20ff202f66e6a00ca023d287c11f604ca66 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 7 Oct 2020 15:59:31 +0000 >Subject: [PATCH] Bug 24488: (follow-up) Reduce repeated code > >--- > circ/pendingreserves.pl | 109 +++++++----------------------------------------- > 1 file changed, 16 insertions(+), 93 deletions(-) > >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 1d5cef3013..fb851d48c9 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -205,20 +205,17 @@ foreach my $bibnum ( @biblionumbers ){ > my @issues = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 }); > > # get available item types for each biblio >+ my $res_items = Koha::Items->search( >+ { biblionumber => $bibnum, >+ itype => { '!=', undef }, >+ itemlost => 0, >+ withdrawn => 0, >+ notforloan => 0, >+ itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >+ }); > my $res_itemtypes; > if ( C4::Context->preference('item-level_itypes') ){ >- $res_itemtypes = Koha::Items->search( >- { biblionumber => $bibnum, >- itype => { '!=', undef }, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >- }, >- { columns => 'itype', >- distinct => 1, >- } >- ); >+ $res_itemtypes = $res_items->search({},{ columns => 'itype', distinct => 1 }); > } else { > my $res_itemtypes = Koha::Biblioitems->search( > { biblionumber => $bibnum, itemtype => { '!=', undef } }, >@@ -230,105 +227,31 @@ foreach my $bibnum ( @biblionumbers ){ > $reserves->{$bibnum}->{itemtypes} = $res_itemtypes; > > # get available locations for each biblio >- my $res_locations = Koha::Items->search( >- { biblionumber => $bibnum, >- location => { '!=', undef }, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >- }, >- { columns => 'location', >- distinct => 1, >- } >- ); >+ my $res_locations = $res_items->search({},{ columns => 'location', distinct => 1 }); > $reserves->{$bibnum}->{locations} = $res_locations; > > # get available callnumbers for each biblio >- my $res_callnumbers = Koha::Items->search( >- { biblionumber => $bibnum, >- itemcallnumber => { '!=', undef }, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >- }, >- { columns => 'itemcallnumber', >- distinct => 1, >- } >- ); >+ my $res_callnumber = $res_items->search({},{ columns => 'itemcallnumber', distinct => 1 }); > $reserves->{$bibnum}->{callnumbers} = $res_callnumbers; > > # get available enumchrons for each biblio >- my $res_enumchrons = Koha::Items->search( >- { biblionumber => $bibnum, >- enumchron => { '!=', undef }, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >- }, >- { columns => 'enumchron', >- distinct => 1, >- } >- ); >+ my $res_enumchrons = $res_items->search({},{ columns => 'enumchron', distinct => 1 }); > $reserves->{$bibnum}->{enumchrons} = $res_enumchrons; > > # get available copynumbers for each biblio >- my $res_copynumbers = Koha::Items->search( >- { biblionumber => $bibnum, >- copynumber => { '!=', undef }, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >- }, >- { columns => 'copynumber', >- distinct => 1, >- } >- ); >+ my $res_copynumber = $res_items->search({},{ columns => 'copynumber', distinct => 1 }); > $reserves->{$bibnum}->{copynumbers} = $res_copynumbers; > > # get available barcodes for each biblio >- my $res_barcodes = Koha::Items->search( >- { biblionumber => $bibnum, >- barcode => { '!=', undef }, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >- }, >- { columns => 'barcode', >- distinct => 1, >- } >- ); >+ my $res_barcodes = $res_items->search({},{ columns => 'barcode', distinct => 1 }); > $reserves->{$bibnum}->{barcodes} = $res_barcodes; > > # get available holding branches for each biblio >- my $res_holdingbranches = Koha::Items->search( >- { biblionumber => $bibnum, >- holdingbranch => { '!=', undef }, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >- }, >- { columns => 'holdingbranch', >- distinct => 1, >- } >- ); >+ my $res_holdingbranches = $res_items->search({},{ columns => 'holdingbranch', distinct => 1 }); > $reserves->{$bibnum}->{holdingbranches} = $res_holdingbranches; > > # items available >- my $items_count = Koha::Items->search( >- { biblionumber => $bibnum, >- itemlost => 0, >- withdrawn => 0, >- notforloan => 0, >- itemnumber => { -not_in => [ @branchtransfers, @issues ] }, >- }, >- { select => [ { distinct => 'itemnumber' } ] } >- )->count; >+ my $items_count = $res_items->search({},{ columns => 'itemnumber', distinct => 1 })->count; > $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