Bugzilla – Attachment 74664 Details for
Bug 20400
Add routing list tab to the patron account in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20400: (follow-up) Several fixes from RM review
Bug-20400-follow-up-Several-fixes-from-RM-review.patch (text/plain), 6.83 KB, created by
Katrin Fischer
on 2018-04-20 20:33:45 UTC
(
hide
)
Description:
Bug 20400: (follow-up) Several fixes from RM review
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-04-20 20:33:45 UTC
Size:
6.83 KB
patch
obsolete
>From 374beb30a7c631dc589b7322116bea5cb7b770bd Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Fri, 20 Apr 2018 22:25:08 +0200 >Subject: [PATCH] Bug 20400: (follow-up) Several fixes from RM review > >- "your routing lists" tab is now highlighted when active >- get_routinglists was renamed to get_routing_lists >- Koha::Patron->get_routing_lists returns the ->search result > directly >- Koha::Subscription::RoutingList->subscription uses DBIC > relationship >- Undo changes to C4/Auth.pm >--- > C4/Auth.pm | 3 +-- > Koha/Patron.pm | 9 ++++----- > Koha/Subscription/Routinglist.pm | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc | 2 +- > opac/opac-routing-lists.pl | 4 ++-- > t/db_dependent/Koha/Patrons.t | 12 ++++++------ > 6 files changed, 15 insertions(+), 17 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 0661031..13c4652 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -238,12 +238,12 @@ sub get_template_and_user { > } > > my $borrowernumber; >- my $patron; > if ($user) { > > # It's possible for $user to be the borrowernumber if they don't have a > # userid defined (and are logging in through some other method, such > # as SSL certs against an email address) >+ my $patron; > $borrowernumber = getborrowernumber($user) if defined($user); > if ( !defined($borrowernumber) && defined($user) ) { > $patron = Koha::Patrons->find( $user ); >@@ -610,7 +610,6 @@ sub get_template_and_user { > PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), > PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), > useDischarge => C4::Context->preference('useDischarge'), >- routing_lists_exist => ( $patron and $patron->get_routinglists ), > ); > > $template->param( OpacPublic => '1' ) if ( $user || C4::Context->preference("OpacPublic") ); >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index dfa8bf1..f50ce86 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -589,18 +589,17 @@ sub get_overdues { > ); > } > >-=head3 get_routinglists >+=head3 get_routing_lists > >-my @routinglists = $patron->get_routinglists >+my @routinglists = $patron->get_routing_lists > > Returns the routing lists a patron is subscribed to. > > =cut > >-sub get_routinglists { >+sub get_routing_lists { > my ($self) = @_; >- my @subscribed_routings = Koha::Subscription::Routinglists->search({ borrowernumber => $self->borrowernumber }); >- return @subscribed_routings; >+ return Koha::Subscription::Routinglists->search({ borrowernumber => $self->borrowernumber }); > } > > =head3 get_age >diff --git a/Koha/Subscription/Routinglist.pm b/Koha/Subscription/Routinglist.pm >index 4c081e5..eb18e4b 100644 >--- a/Koha/Subscription/Routinglist.pm >+++ b/Koha/Subscription/Routinglist.pm >@@ -45,7 +45,7 @@ Returns the subscription for a routing list. > > sub subscription { > my ( $self ) = @_; >- return scalar Koha::Subscriptions->find( $self->subscriptionid ); >+ return Koha::Subscription->_new_from_dbic($self->_result->subscriptionid); > } > > =head2 Internal methods >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >index 5914f04..5dc3d03 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >@@ -96,7 +96,7 @@ > <a href="/cgi-bin/koha/opac-shelves.pl?op=list&category=1">your lists</a></li> > [% END %] > >- [% IF Koha.Preference( 'RoutingSerials' ) && routing_lists_exist %] >+ [% IF Koha.Preference( 'RoutingSerials' ) && logged_in_user && logged_in_user.get_routing_lists %] > [% IF ( routinglistsview ) %] > <li class="active"> > [% ELSE %] >diff --git a/opac/opac-routing-lists.pl b/opac/opac-routing-lists.pl >index 2dc09c6..9aedd1d 100644 >--- a/opac/opac-routing-lists.pl >+++ b/opac/opac-routing-lists.pl >@@ -41,11 +41,11 @@ $borrower->{description} = $category->description; > $borrower->{category_type} = $category->category_type; > $template->param( BORROWER_INFO => $borrower ); > >-my @routinglists = $patron->get_routinglists(); >+my @routinglists = $patron->get_routing_lists(); > > $template->param( > routinglists => \@routinglists, >- routinglistview => 1, >+ routinglistsview => 1, > ); > > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index ea57389..adad6c1 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -529,7 +529,7 @@ subtest 'checkouts + pending_checkouts + get_overdues + old_checkouts' => sub { > $module->unmock('userenv'); > }; > >-subtest 'get_routinglists' => sub { >+subtest 'get_routing_lists' => sub { > plan tests => 5; > > my $biblio = Koha::Biblio->new()->store(); >@@ -541,7 +541,7 @@ subtest 'get_routinglists' => sub { > my $patron = $builder->build( { source => 'Borrower' } ); > $patron = Koha::Patrons->find( $patron->{borrowernumber} ); > >- is( $patron->get_routinglists, 0, 'Retrieves correct number of routing lists: 0' ); >+ is( $patron->get_routing_lists->count, 0, 'Retrieves correct number of routing lists: 0' ); > > my $routinglist_count = Koha::Subscription::Routinglists->count; > my $routinglist = Koha::Subscription::Routinglist->new({ >@@ -550,11 +550,11 @@ subtest 'get_routinglists' => sub { > subscriptionid => $subscription->subscriptionid > })->store; > >- is ($patron->get_routinglists, 1, "Retrieves correct number of routing lists: 1"); >+ is ($patron->get_routing_lists->count, 1, "Retrieves correct number of routing lists: 1"); > >- my @routinglists = $patron->get_routinglists; >+ my @routinglists = $patron->get_routing_lists; > is ($routinglists[0]->ranking, 5, "Retrieves ranking: 5"); >- is( ref($routinglists[0]), 'Koha::Subscription::Routinglist', 'get_routinglists returns Koha::Subscription::Routinglist objects' ); >+ is( ref($routinglists[0]), 'Koha::Subscription::Routinglist', 'get_routing_lists returns Koha::Subscription::Routinglist objects' ); > > my $subscription2 = Koha::Subscription->new({ > biblionumber => $biblio->biblionumber, >@@ -566,7 +566,7 @@ subtest 'get_routinglists' => sub { > subscriptionid => $subscription2->subscriptionid > })->store; > >- is ($patron->get_routinglists, 2, "Retrieves correct number of routing lists: 2"); >+ is ($patron->get_routing_lists->count, 2, "Retrieves correct number of routing lists: 2"); > > $patron->delete; # Clean up for later tests > >-- >2.1.4
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 20400
:
72973
|
72974
|
73115
|
73116
|
73117
|
73118
|
73121
|
73122
|
73123
|
73124
|
74291
|
74292
|
74293
|
74294
|
74295
|
74296
|
74297
|
74298
|
74299
|
74300
|
74402
|
74588
|
74589
|
74590
|
74592
|
74593
|
74632
|
74633
|
74634
|
74635
|
74636
|
74637
|
74662
|
74664
|
74666