Bugzilla – Attachment 113449 Details for
Bug 20936
Holds history for patrons in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20936: (follow-up) add biblio and item relation to old holds and set a limit on search holds
Bug-20936-follow-up-add-biblio-and-item-relation-t.patch (text/plain), 3.07 KB, created by
Agustín Moyano
on 2020-11-10 22:36:54 UTC
(
hide
)
Description:
Bug 20936: (follow-up) add biblio and item relation to old holds and set a limit on search holds
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2020-11-10 22:36:54 UTC
Size:
3.07 KB
patch
obsolete
>From 8d3eeab0094eb361578e78ab8f235a7471c2252e Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Tue, 10 Nov 2020 19:23:49 -0300 >Subject: [PATCH] Bug 20936: (follow-up) add biblio and item relation to old > holds and set a limit on search holds > >--- > Koha/Schema/Result/OldReserve.pm | 24 ++++++++++++++++++++++++ > opac/opac-holdshistory.pl | 32 ++++++++++++++++++++++---------- > 2 files changed, 46 insertions(+), 10 deletions(-) > >diff --git a/Koha/Schema/Result/OldReserve.pm b/Koha/Schema/Result/OldReserve.pm >index eae6d24d3b..a65cef0814 100644 >--- a/Koha/Schema/Result/OldReserve.pm >+++ b/Koha/Schema/Result/OldReserve.pm >@@ -324,6 +324,30 @@ __PACKAGE__->belongs_to( > # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-11-06 11:00:40 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7weIpuc0RpZ/MxFn94E8dg > >+__PACKAGE__->belongs_to( >+ "item", >+ "Koha::Schema::Result::Item", >+ { itemnumber => "itemnumber" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ >+__PACKAGE__->belongs_to( >+ "biblio", >+ "Koha::Schema::Result::Biblio", >+ { biblionumber => "biblionumber" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ > __PACKAGE__->add_columns( > '+item_level_hold' => { is_boolean => 1 }, > '+lowestPriority' => { is_boolean => 1 }, >diff --git a/opac/opac-holdshistory.pl b/opac/opac-holdshistory.pl >index e55ae1ad04..67ecae864e 100755 >--- a/opac/opac-holdshistory.pl >+++ b/opac/opac-holdshistory.pl >@@ -24,6 +24,8 @@ use C4::Auth; > use C4::Output; > > use Koha::Patrons; >+use Koha::Holds; >+use Koha::Old::Holds; > > my $query = CGI->new; > my @all_holds; >@@ -42,10 +44,26 @@ my ( $template, $patron_id, $cookie ) = get_template_and_user( > } > ); > >-my $patron = Koha::Patrons->find( $patron_id ); >+my $patron = Koha::Patrons->find($patron_id); > >-my $holds = $patron->holds; >-my $old_holds = $patron->old_holds; >+my $sort = $query->param('sort'); >+$sort = 'reservedate' unless $sort; >+ >+my $unlimit = $query->param('unlimit'); >+my $ops = { >+ prefetch => ['biblio', 'item'], >+ order_by => $sort >+}; >+ >+$ops->{rows} = 50 unless $unlimit; >+ >+my $holds = Koha::Holds->search({ >+ borrowernumber => $patron_id >+}, $ops); >+ >+my $old_holds = Koha::Old::Holds->search({ >+ borrowernumber => $patron_id >+}, $ops); > > while (my $hold = $holds->next) { > push @all_holds, $hold; >@@ -55,19 +73,13 @@ while (my $hold = $old_holds->next) { > push @all_holds, $hold; > } > >-my $sort = $query->param('sort'); >- >-$sort = 'reservedate' unless $sort; >- > if($sort eq 'reservedate') { > @all_holds = sort {$b->$sort cmp $a->$sort} @all_holds; > } else { > my ($obj, $col) = split /\./, $sort; >- @all_holds = sort {$a->$obj->$col cmp $b->$obj->$col} @all_holds; >+ @all_holds = sort { ( $a->$obj && $a->$obj->$col || '' ) cmp ( $b->$obj && $b->$obj->$col || '' ) } @all_holds; > } > >-my $unlimit = $query->param('unlimit'); >- > unless($unlimit) { > @all_holds = splice(@all_holds, 0, 50); > } >-- >2.25.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 20936
:
98629
|
98630
|
100115
|
100116
|
100117
|
100205
|
100206
|
100207
|
100471
|
100472
|
100473
|
100474
|
101724
|
101725
|
101726
|
101727
|
101772
|
101915
|
102166
|
103948
|
103949
|
103950
|
103951
|
104040
|
104041
|
104466
|
104467
|
105131
|
112667
|
112668
|
112730
|
112731
|
112732
|
112733
|
113446
|
113447
|
113448
| 113449