Bugzilla – Attachment 111349 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: [DISCUSSION] For comparaison
Bug-24488-DISCUSSION-For-comparaison.patch (text/plain), 8.60 KB, created by
Jonathan Druart
on 2020-10-07 16:35:18 UTC
(
hide
)
Description:
Bug 24488: [DISCUSSION] For comparaison
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-10-07 16:35:18 UTC
Size:
8.60 KB
patch
obsolete
>From c8ee232c00a2ab042c3a8bea05e1051a97b41a5a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 7 Oct 2020 18:33:59 +0200 >Subject: [PATCH] Bug 24488: [DISCUSSION] For comparaison > >I'd like someone to run a benchmark with and without this patch on a >quite big database and see which approach is the best >--- > circ/pendingreserves.pl | 89 +++---------------- > .../prog/en/modules/circ/pendingreserves.tt | 26 +++--- > 2 files changed, 27 insertions(+), 88 deletions(-) > >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 387b782063..69ccba5485 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -205,7 +205,7 @@ foreach my $bibnum ( @biblionumbers ){ > my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 }); > my @issues = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 }); > >- my $items = Koha::Items->search( >+ @items = Koha::Items->search( > { > biblionumber => $bibnum, > itemlost => 0, >@@ -216,102 +216,41 @@ foreach my $bibnum ( @biblionumbers ){ > ); > > # get available item types for each biblio >- my $res_itemtypes; >+ my @res_itemtypes; > if ( C4::Context->preference('item-level_itypes') ){ >- $res_itemtypes = $items->search( >- { >- itype => { '!=', undef }, >- }, >- { >- columns => 'itype', >- distinct => 1, >- } >- ); >+ @res_itemtypes = uniq map { defined $_->itype ? $_->itype : () } @items; > } else { >- my $res_itemtypes = Koha::Biblioitems->search( >+ @res_itemtypes = Koha::Biblioitems->search( > { biblionumber => $bibnum, itemtype => { '!=', undef } }, > { columns => 'itemtype', > distinct => 1, > } >- ); >+ )->get_column('itemtype'); > } >- $reserves->{$bibnum}->{itemtypes} = $res_itemtypes; >+ $reserves->{$bibnum}->{itemtypes} = \@res_itemtypes; > > # get available locations for each biblio >- my $res_locations = $items->search( >- { >- location => { '!=', undef }, >- }, >- { >- columns => 'location', >- distinct => 1, >- } >- ); >- $reserves->{$bibnum}->{locations} = $res_locations; >+ $reserves->{$bibnum}->{locations} = [ uniq map { defined $_->location ? $_->location : () } @items ]; > > # get available callnumbers for each biblio >- my $res_callnumbers = $items->search( >- { >- itemcallnumber => { '!=', undef }, >- }, >- { >- columns => 'itemcallnumber', >- distinct => 1, >- } >- ); >- $reserves->{$bibnum}->{callnumbers} = $res_callnumbers; >+ $reserves->{$bibnum}->{locations} = [ uniq map { defined $_->itemcallnumber ? $_->itemcallnumber : () } @items ]; > > # get available enumchrons for each biblio >- my $res_enumchrons = $items->search( >- { >- enumchron => { '!=', undef }, >- }, >- { >- columns => 'enumchron', >- distinct => 1, >- } >- ); >- $reserves->{$bibnum}->{enumchrons} = $res_enumchrons; >+ $reserves->{$bibnum}->{enumchrons} = [ uniq map { defined $_->enumchron ? $_->enumchron : () } @items ]; > > # get available copynumbers for each biblio >- my $res_copynumbers = $items->search( >- { >- copynumber => { '!=', undef }, >- }, >- { >- columns => 'copynumber', >- distinct => 1, >- } >- ); >- $reserves->{$bibnum}->{copynumbers} = $res_copynumbers; >+ $reserves->{$bibnum}->{copynumbers} = [ uniq map { defined $_->copynumber ? $_->copynumber : () } @items ]; > > # get available barcodes for each biblio >- my $res_barcodes = $items->search( >- { >- barcode => { '!=', undef }, >- }, >- { >- columns => 'barcode', >- distinct => 1, >- } >- ); >- $reserves->{$bibnum}->{barcodes} = $res_barcodes; >+ $reserves->{$bibnum}->{barcodes} = [ uniq map { defined $_->barcode ? $_->barcode : () } @items ]; > > # get available holding branches for each biblio >- my $res_holdingbranches = $items->search( >- { >- holdingbranch => { '!=', undef }, >- }, >- { >- columns => 'holdingbranch', >- distinct => 1, >- } >- ); >- $reserves->{$bibnum}->{holdingbranches} = $res_holdingbranches; >+ $reserves->{$bibnum}->{holdingbranches} = [ uniq map { defined $_->holdingbranch ? $_->holdingbranch : () } @items ]; > > # items available >- my $items_count = $items->count; >+ my $items_count = scalar @items; > $reserves->{$bibnum}->{items_count} = $items_count; >+ use Data::Printer colored => 1; warn p $reserves; > > # patrons with holds > my $patrons_count = Koha::Holds->search( >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >index e4a79dae77..668ccdcf19 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >@@ -92,48 +92,48 @@ > <td>"</td> > [% END %] > <td> >- [% IF ( reserve.value.holdingbranches ) %] >+ [% IF ( reserve.value.holdingbranches.size ) %] > <ul> > [% FOREACH holdingbranch IN reserve.value.holdingbranches %] >- <li>[% Branches.GetName ( holdingbranch.holdingbranch ) | html %]</li> >+ <li>[% Branches.GetName ( holdingbranch ) | html %]</li> > [% END %] > </ul> > [% END %] > </td> > <td> >- [% IF ( reserve.value.barcodes.count ) %] >- [% SET barcode = reserve.value.barcodes.next.barcode %] >+ [% IF ( reserve.value.barcodes.size ) %] >+ [% SET barcode = reserve.value.barcodes.first %] > [% IF ( reserve.value.itemnumber ) %]Only [% barcode | html %][% ELSE %][% barcode | html %] or any available.[% END %] > [% END %] > </td> > <td> >- [% IF ( reserve.value.callnumbers ) %] >+ [% IF ( reserve.value.callnumbers.size ) %] > <ul> > [% FOREACH callnumber IN reserve.value.callnumbers %] > <li> >- [% callnumber.itemcallnumber | html %] >+ [% callnumber | html %] > </li> > [% END %] > </ul> > [% END %] > </td> > <td> >- [% IF ( reserve.value.copynumbers ) %] >+ [% IF ( reserve.value.copynumbers.size ) %] > <ul> > [% FOREACH copyno IN reserve.value.copynumbers %] > <li> >- [% copyno.copynumber | html %] >+ [% copyno | html %] > </li> > [% END %] > </ul> > [% END %] > </td> > <td> >- [% IF ( reserve.value.enumchrons ) %] >+ [% IF ( reserve.value.enumchrons.size ) %] > <ul> > [% FOREACH enumchron IN reserve.value.enumchrons %] > <li> >- [% enumchron.enumchron | html %] >+ [% enumchron | html %] > </li> > [% END %] > </ul> >@@ -143,9 +143,9 @@ > <ul> > [% FOREACH type IN reserve.value.itemtypes %] > [% IF Koha.Preference('item-level_itypes') %] >- <li>[% ItemTypes.GetDescription( type.itype ) | html %]</li> >+ <li>[% ItemTypes.GetDescription( type ) | html %]</li> > [% ELSE %] >- <li>[% ItemTypes.GetDescription( type.itemtype ) | html %]</li> >+ <li>[% ItemTypes.GetDescription( type ) | html %]</li> > [% END %] > [% END %] > </ul> >@@ -153,7 +153,7 @@ > <td> > <ul> > [% FOREACH loc IN reserve.value.locations %] >- <li>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => loc.location) | html %]</li> >+ <li>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => loc ) | html %]</li> > [% END %] > </ul> > </td> >-- >2.20.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 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