Bugzilla – Attachment 138906 Details for
Bug 31306
Add Koha::Items->search_ordered method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31306: Allow to pass params and attributes to search_ordered
Bug-31306-Allow-to-pass-params-and-attributes-to-s.patch (text/plain), 1.35 KB, created by
Nick Clemens (kidclamp)
on 2022-08-09 12:58:46 UTC
(
hide
)
Description:
Bug 31306: Allow to pass params and attributes to search_ordered
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-08-09 12:58:46 UTC
Size:
1.35 KB
patch
obsolete
>From 4c2fed81c790108e5559d93f4a81e435a115cf89 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 29 Jul 2022 13:06:07 +0200 >Subject: [PATCH] Bug 31306: Allow to pass params and attributes to > search_ordered > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > Koha/Items.pm | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index 04db9654aa..3e4eece94e 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -407,10 +407,22 @@ Search and sort items in a specific order, depending if serials are present or n > =cut > > sub search_ordered { >- my ($self) = @_; >+ my ($self, $params, $attributes) = @_; >+ >+ $self = $self->search($params, $attributes); > >- if ( $self->search({ select => ["enumchron IS NOT NULL"] }) ) { >- return $self->search( {}, { order_by => 'enumchron' } ); >+ my @biblionumbers = uniq $self->get_column('biblionumber'); >+ >+ if ( scalar ( @biblionumbers ) == 1 >+ && Koha::Biblios->find( $biblionumbers[0] )->serial ) >+ { >+ return $self->search( >+ {}, >+ { >+ order_by => [ 'serialid.publisheddate', 'me.enumchron' ], >+ join => { serialitem => 'serialid' } >+ } >+ ); > } else { > return $self->search( > {}, >-- >2.30.2
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 31306
:
138806
|
138807
|
138808
|
138838
|
138839
|
138840
|
138905
| 138906 |
138907
|
138908