Bugzilla – Attachment 138734 Details for
Bug 27272
Move C4::Items::GetItemsInfo to Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27272: Call search_ordered when GetItemsInfo was called before
Bug-27272-Call-searchordered-when-GetItemsInfo-was.patch (text/plain), 7.29 KB, created by
Victor Grousset/tuxayo
on 2022-08-05 20:15:58 UTC
(
hide
)
Description:
Bug 27272: Call search_ordered when GetItemsInfo was called before
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2022-08-05 20:15:58 UTC
Size:
7.29 KB
patch
obsolete
>From 29eb8108f5226e4e9e80899154961425bb32649c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 29 Jul 2022 13:06:48 +0200 >Subject: [PATCH] Bug 27272: Call search_ordered when GetItemsInfo was called > before > >--- > basket/basket.pl | 2 +- > basket/sendbasket.pl | 2 +- > opac/opac-detail.pl | 8 ++++---- > opac/opac-reserve.pl | 4 ++-- > opac/opac-sendbasket.pl | 2 +- > opac/opac-sendshelf.pl | 2 +- > opac/opac-tags.pl | 2 +- > serials/routing-preview.pl | 2 +- > tags/list.pl | 5 +++-- > virtualshelves/sendshelf.pl | 2 +- > 10 files changed, 16 insertions(+), 15 deletions(-) > >diff --git a/basket/basket.pl b/basket/basket.pl >index 12526138d1..88a5bd5dae 100755 >--- a/basket/basket.pl >+++ b/basket/basket.pl >@@ -89,7 +89,7 @@ foreach my $biblionumber ( @bibs ) { > > $num++; > $dat->{biblionumber} = $biblionumber; >- $dat->{ITEM_RESULTS} = $biblio->items; >+ $dat->{ITEM_RESULTS} = $biblio->items->search_ordered; > $dat->{MARCNOTES} = $marcnotesarray; > $dat->{MARCSUBJCTS} = $marcsubjctsarray; > $dat->{MARCAUTHORS} = $marcauthorsarray; >diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl >index cbd64b3fc8..ec9e1a2463 100755 >--- a/basket/sendbasket.pl >+++ b/basket/sendbasket.pl >@@ -85,7 +85,7 @@ if ( $email_add ) { > $dat->{MARCAUTHORS} = $marcauthorsarray; > $dat->{HASAUTHORS} = $hasauthors; > $dat->{'biblionumber'} = $biblionumber; >- $dat->{ITEM_RESULTS} = $biblio->items; >+ $dat->{ITEM_RESULTS} = $biblio->items->search_ordered; > > $iso2709 .= $record->as_usmarc(); > >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index e0ad9e9f6c..4590c1dbdc 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -114,9 +114,9 @@ unless ( $biblio && $record ) { > exit; > } > >-my $items = $biblio->items; >+my $items = $biblio->items->search_ordered; > if ($specific_item) { >- $items->search( { itemnumber => scalar $query->param('itemnumber') } ); >+ $items = $items->search( { itemnumber => scalar $query->param('itemnumber') } ); > $template->param( specific_item => 1 ); > } > >@@ -496,9 +496,9 @@ $template->param( > > my $host_items = $biblio->host_items->filter_by_visible_in_opac({ patron => $patron }); > >-$items = $biblio->items->search( >+$items = $biblio->items->search_ordered( > { >- itemnumber => { >+ 'me.itemnumber' => { > -in => [ > $items->get_column('itemnumber'), > $host_items->get_column('itemnumber') >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 9e907d1f5b..6cdbbbd3df 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -155,7 +155,7 @@ foreach my $biblioNumber (@biblionumbers) { > $biblio->items->filter_by_visible_in_opac( { patron => $patron } ); > my $host_items = > $biblio->host_items->filter_by_visible_in_opac( { patron => $patron } ); >- $items = $biblio->items->search( >+ $items = $biblio->items->search_ordered( > { > itemnumber => { > -in => [ >@@ -571,7 +571,7 @@ foreach my $biblioNum (@biblionumbers) { > > if ( $biblioLoopIter{holdable} and C4::Context->preference('AllowHoldItemTypeSelection') ) { > # build the allowed item types loop >- my $rs = $biblio->items->search( >+ my $rs = $biblio->items->search_ordered( > undef, > { select => [ { distinct => 'itype' } ], > as => 'item_type' >diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl >index 7ce5f9fdab..cc33d121db 100755 >--- a/opac/opac-sendbasket.pl >+++ b/opac/opac-sendbasket.pl >@@ -85,7 +85,7 @@ if ( $email_add ) { > my $marcauthorsarray = $biblio->get_marc_authors; > my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); > >- my $items = $biblio->items->filter_by_visible_in_opac({ patron => $patron }); >+ my $items = $biblio->items->search_ordered->filter_by_visible_in_opac({ patron => $patron }); > > my $hasauthors = 0; > if($dat->{'author'} || @$marcauthorsarray) { >diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl >index 768e372b4f..17afa1a82e 100755 >--- a/opac/opac-sendshelf.pl >+++ b/opac/opac-sendshelf.pl >@@ -94,7 +94,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { > my $marcauthorsarray = $biblio->get_marc_authors; > my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); > >- my $items = $biblio->items->filter_by_visible_in_opac({ patron => $patron }); >+ my $items = $biblio->items->search_ordered->filter_by_visible_in_opac({ patron => $patron }); > > $dat->{ISBN} = GetMarcISBN($record, $marcflavour); > $dat->{MARCSUBJCTS} = $marcsubjctsarray; >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index 17cacc7307..4aec61ee73 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -260,7 +260,7 @@ if ($loggedinuser) { > next unless $record; > my @hidden_items; > if ($should_hide) { >- my $items = $biblio->items; >+ my $items = $biblio->items->search_ordered; > my @all_itemnumbers = $items->get_column('itemnumber'); > my @items_to_show = $items->filter_by_visible_in_opac({ opac => 1, patron => $patron })->as_list; > @hidden_items = array_minus( @all_itemnumbers, @items_to_show ); >diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl >index d6cadaabf9..0e62a68c81 100755 >--- a/serials/routing-preview.pl >+++ b/serials/routing-preview.pl >@@ -65,7 +65,7 @@ if($ok){ > # get existing reserves ..... > > my $biblio = Koha::Biblios->find( $biblionumber ); >- my $items = $biblio->items; >+ my $items = $biblio->items->search_ordered; > my $branch = > $items->count > ? $items->next->holding_branch->branchcode >diff --git a/tags/list.pl b/tags/list.pl >index 95531f2a75..b9aec1aa19 100755 >--- a/tags/list.pl >+++ b/tags/list.pl >@@ -26,7 +26,7 @@ use C4::Context; > use C4::Tags qw( get_tag_rows get_tags remove_tag ); > use C4::Output qw( output_html_with_http_headers ); > >-use Koha::Items; >+use Koha::Biblios; > > my $needed_flags = { tools => 'moderate_tags' > }; # FIXME: replace when more specific permission is created. >@@ -60,7 +60,8 @@ else { > for ( @{$taglist} ) { > # FIXME We should use Koha::Biblio here > my $dat = &GetBiblioData( $_->{biblionumber} ); >- my $items = Koha::Items->search({ biblionumber => $dat->{biblionumber} }); >+ my $biblio = Koha::Biblios->find($dat->{biblionumber}); >+ my $items = $biblio->items->search_ordered; > $dat->{biblionumber} = $_->{biblionumber}; > $dat->{tag_id} = $_->{tag_id}; > $dat->{items} = $items; >diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl >index 4000192b3b..7e9111173f 100755 >--- a/virtualshelves/sendshelf.pl >+++ b/virtualshelves/sendshelf.pl >@@ -82,7 +82,7 @@ if ($to_address) { > my $marcauthorsarray = $biblio->get_marc_authors; > my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); > >- my $items = $biblio->items; >+ my $items = $biblio->items->search_ordered; > > $dat->{ISBN} = GetMarcISBN($record, $marcflavour); > $dat->{MARCSUBJCTS} = $marcsubjctsarray; >-- >2.37.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 27272
:
128230
|
128231
|
135640
|
135641
|
135642
|
135643
|
135644
|
135645
|
135646
|
135647
|
135648
|
135649
|
135650
|
135651
|
135652
|
135653
|
135654
|
135655
|
135656
|
135657
|
135658
|
135659
|
137966
|
137967
|
137968
|
137969
|
137970
|
137971
|
137972
|
137973
|
137974
|
137975
|
137976
|
137977
|
137978
|
137979
|
137980
|
137981
|
137982
|
138109
|
138296
|
138297
|
138298
|
138303
|
138304
|
138305
|
138306
|
138307
|
138308
|
138437
|
138438
|
138439
|
138440
|
138441
|
138442
|
138553
|
138554
|
138555
|
138556
|
138557
|
138558
|
138559
|
138560
|
138561
|
138562
|
138563
|
138564
|
138565
|
138566
|
138567
|
138568
|
138569
|
138570
|
138571
|
138572
|
138573
|
138574
|
138575
|
138614
|
138615
|
138616
|
138617
|
138618
|
138619
|
138620
|
138621
|
138622
|
138623
|
138624
|
138625
|
138626
|
138627
|
138628
|
138629
|
138630
|
138631
|
138632
|
138633
|
138634
|
138635
|
138636
|
138714
|
138715
|
138716
|
138717
|
138718
|
138719
|
138720
|
138721
|
138722
|
138723
|
138724
|
138725
|
138726
|
138727
|
138728
|
138729
|
138730
|
138731
|
138732
|
138733
|
138734
|
138735
|
138736
|
138773
|
138774
|
138775
|
138776
|
138777
|
138778
|
138779
|
138780
|
138781
|
138782
|
138783
|
138784
|
138785
|
138786
|
138787
|
138788
|
138789
|
138790
|
138791
|
138792
|
138793
|
138794
|
138832
|
139928