Bugzilla – Attachment 74633 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: Rewrite using Koha::Objects
Bug-20400-Rewrite-using-KohaObjects.patch (text/plain), 8.32 KB, created by
Nick Clemens (kidclamp)
on 2018-04-20 12:58:28 UTC
(
hide
)
Description:
Bug 20400: Rewrite using Koha::Objects
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-04-20 12:58:28 UTC
Size:
8.32 KB
patch
obsolete
>From e4e4e8c5c85d66a34965bca1c7fde430cac162ed Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Thu, 15 Mar 2018 15:26:35 +0000 >Subject: [PATCH] Bug 20400: Rewrite using Koha::Objects >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Adds >- Koha::Subscription::Routinglist >- Koha::Subscription::Routinglists > >Adds 2 methods >- Koha::Patron::get_routinglists >- Koha::Routinglist::subscription > >Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Patron.pm | 17 +++++- > Koha/Subscription/Routinglist.pm | 67 ++++++++++++++++++++++ > Koha/Subscription/Routinglists.pm | 62 ++++++++++++++++++++ > .../bootstrap/en/modules/opac-routing-lists.tt | 10 ++-- > opac/opac-routing-lists.pl | 23 +------- > 5 files changed, 153 insertions(+), 26 deletions(-) > create mode 100644 Koha/Subscription/Routinglist.pm > create mode 100644 Koha/Subscription/Routinglists.pm > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index c8e319e..dfa8bf1 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -39,6 +39,7 @@ use Koha::Patrons; > use Koha::Virtualshelves; > use Koha::Club::Enrollments; > use Koha::Account; >+use Koha::Subscription::Routinglists; > > use base qw(Koha::Object); > >@@ -571,7 +572,7 @@ sub old_checkouts { > > my $overdue_items = $patron->get_overdues > >-Return the overdued items >+Return the overdue items > > =cut > >@@ -588,6 +589,20 @@ sub get_overdues { > ); > } > >+=head3 get_routinglists >+ >+my @routinglists = $patron->get_routinglists >+ >+Returns the routing lists a patron is subscribed to. >+ >+=cut >+ >+sub get_routinglists { >+ my ($self) = @_; >+ my @subscribed_routings = Koha::Subscription::Routinglists->search({ borrowernumber => $self->borrowernumber }); >+ return @subscribed_routings; >+} >+ > =head3 get_age > > my $age = $patron->get_age >diff --git a/Koha/Subscription/Routinglist.pm b/Koha/Subscription/Routinglist.pm >new file mode 100644 >index 0000000..4c081e5 >--- /dev/null >+++ b/Koha/Subscription/Routinglist.pm >@@ -0,0 +1,67 @@ >+package Koha::Subscription::Routinglist; >+ >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Carp; >+ >+use Koha::Database; >+use Koha::Subscriptions; >+ >+use base qw(Koha::Object); >+ >+=head1 NAME >+ >+Koha::Subscription::Routinglist - Koha subscription routing list object class >+ >+=head1 API >+ >+=head2 Class methods >+ >+=cut >+ >+=head3 subscription >+ >+my $subscription = $routinglist->subscription >+ >+Returns the subscription for a routing list. >+ >+=cut >+ >+sub subscription { >+ my ( $self ) = @_; >+ return scalar Koha::Subscriptions->find( $self->subscriptionid ); >+} >+ >+=head2 Internal methods >+ >+=head3 _type >+ >+=cut >+ >+sub _type { >+ return 'Subscriptionroutinglist'; >+} >+ >+=head1 AUTHOR >+ >+Katrin Fischer <katrin.fischer@bsz-bw.de> >+ >+=cut >+ >+1; >diff --git a/Koha/Subscription/Routinglists.pm b/Koha/Subscription/Routinglists.pm >new file mode 100644 >index 0000000..198118e >--- /dev/null >+++ b/Koha/Subscription/Routinglists.pm >@@ -0,0 +1,62 @@ >+package Koha::Subscription::Routinglists; >+ >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Carp; >+ >+use Koha::Database; >+use Koha::Subscription::Routinglist; >+ >+use base qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::Subscription::Routinglists - Koha subscription routing lists object class >+ >+=head1 API >+ >+=head2 Class methods >+ >+=cut >+ >+=head2 Internal methods >+ >+=head3 _type >+ >+=cut >+ >+sub _type { >+ return 'Subscriptionroutinglist'; >+} >+ >+=head3 object_class >+ >+=cut >+ >+sub object_class { >+ return 'Koha::Subscription::Routinglist'; >+} >+ >+=head1 AUTHOR >+ >+Katrin Fischer <katrin.fischer@bsz-bw.de> >+ >+=cut >+ >+1; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt >index 6ac42be..b54a8f1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt >@@ -31,7 +31,7 @@ > > <h3>Routing lists</h3> > >- [% IF ( subscriptionLoop ) %] >+ [% IF ( routinglists ) %] > <p id="routing-list-intro">You are subscribed to the routing lists for following serial titles. If you wish to make changes, please contact the library.</p> > > <table class="table table-bordered table-striped" id="routingtable"> >@@ -42,11 +42,11 @@ > </thead> > > <tbody> >- [% FOREACH subscription IN subscriptionLoop %] >- [% IF ( subscripLoop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %] >+ [% FOREACH routinglist IN routinglists %] >+ [% IF ( titles_loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %] > <td> >- <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% subscription.biblionumber %]"> >- [% subscription.title %] >+ <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% routinglist.subscription.biblio.biblionumber %]"> >+ [% routinglist.subscription.biblio.title %] > </a> > </td> > </tr> >diff --git a/opac/opac-routing-lists.pl b/opac/opac-routing-lists.pl >index 55e3878..2dc09c6 100644 >--- a/opac/opac-routing-lists.pl >+++ b/opac/opac-routing-lists.pl >@@ -21,9 +21,7 @@ use CGI qw ( -utf8 ); > use C4::Members; > use C4::Auth; > use C4::Output; >-use C4::Serials; > use Koha::Patrons; >-use Koha::Subscriptions; > > my $query = new CGI; > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >@@ -43,26 +41,11 @@ $borrower->{description} = $category->description; > $borrower->{category_type} = $category->category_type; > $template->param( BORROWER_INFO => $borrower ); > >- >-my $count; >-my @borrowerSubscriptions; >-($count, @borrowerSubscriptions) = GetSubscriptionsFromBorrower($borrowernumber ); >-my @subscripLoop; >- >-foreach my $num_res (@borrowerSubscriptions) { >- my %getSubscrip; >- $getSubscrip{subscriptionid} = $num_res->{'subscriptionid'}; >- $getSubscrip{title} = $num_res->{'title'}; >- $getSubscrip{borrowernumber} = $num_res->{'borrowernumber'}; >- my $subscription = Koha::Subscriptions->find( $num_res->{'subscriptionid'} ); >- $getSubscrip{biblionumber} = $subscription->biblionumber(); >- push( @subscripLoop, \%getSubscrip ); >-} >+my @routinglists = $patron->get_routinglists(); > > $template->param( >- countSubscrip => scalar @subscripLoop, >- subscriptionLoop => \@subscripLoop, >- routinglistview => 1 >+ routinglists => \@routinglists, >+ routinglistview => 1, > ); > > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >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