Bugzilla – Attachment 72974 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), 7.90 KB, created by
Katrin Fischer
on 2018-03-15 15:34:54 UTC
(
hide
)
Description:
Bug 20400: Rewrite using Koha::Objects
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-03-15 15:34:54 UTC
Size:
7.90 KB
patch
obsolete
>From 91394ba7abcb375b3b6c36d1feef8058fd2f8c6e 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 > >Adds >- Koha::Subscription::Routinglist >- Koha::Subscription::Routinglists > >Adds 2 methods >- Koha::Patron::get_routinglists >- Koha::Routinglist::subscription >--- > Koha/Patron.pm | 20 ++++++- > Koha/Subscription/Routinglist.pm | 67 ++++++++++++++++++++++ > Koha/Subscription/Routinglists.pm | 57 ++++++++++++++++++ > .../bootstrap/en/modules/opac-routing-lists.tt | 10 ++-- > opac/opac-routing-lists.pl | 21 +------ > 5 files changed, 150 insertions(+), 25 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 d0be998..ae37e3f 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -38,6 +38,7 @@ use Koha::Patrons; > use Koha::Virtualshelves; > use Koha::Club::Enrollments; > use Koha::Account; >+use Koha::Subscription::Routinglists; > > use base qw(Koha::Object); > >@@ -539,7 +540,7 @@ sub old_checkouts { > > my $overdue_items = $patron->get_overdues > >-Return the overdued items >+Return the overdue items > > =cut > >@@ -556,6 +557,23 @@ sub get_overdues { > ); > } > >+=cut >+ >+=head3 get_routinglists >+ >+my @routinglists = $patron->get_routinglists >+ >+Returns the routing lists a patron is subscribed to. >+ >+=cut >+ >+sub get_routinglists { >+ my ($self) = @_; >+ my @titles; >+ 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..3691fd9 >--- /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 ); >+} >+ >+=cut >+ >+=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..f2bbfac >--- /dev/null >+++ b/Koha/Subscription/Routinglists.pm >@@ -0,0 +1,57 @@ >+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 >+ >+=head3 type >+ >+=cut >+ >+sub _type { >+ return 'Subscriptionroutinglist'; >+} >+ >+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 fa791a6..697f874 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 ) %] > <table class="table table-bordered table-striped" id="finestable"> > <thead> > <tr> >@@ -40,11 +40,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..6567579 100644 >--- a/opac/opac-routing-lists.pl >+++ b/opac/opac-routing-lists.pl >@@ -23,7 +23,6 @@ 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 +42,10 @@ $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, > ); > > 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