Bugzilla – Attachment 151659 Details for
Bug 28130
Show list of serial email alerts a patron subscribed to in patron account in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28130: Manage subscription alerts on OPAC
Bug-28130-Manage-subscription-alerts-on-OPAC.patch (text/plain), 11.03 KB, created by
Biblibre Sandboxes
on 2023-05-25 05:55:09 UTC
(
hide
)
Description:
Bug 28130: Manage subscription alerts on OPAC
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2023-05-25 05:55:09 UTC
Size:
11.03 KB
patch
obsolete
>From bd117359d3de5021b9e389b6d09821c6b9419642 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 24 May 2023 21:53:38 +0000 >Subject: [PATCH] Bug 28130: Manage subscription alerts on OPAC >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds an 'Alert subscriptions' tab to the patron's account on the OPAC, so they can easily view or cancel email alerts they have subscribed to. > >To test: > >1. Subscribe to email alerts for one or more subscriptions via the OPAC >2. Go to your account, notice the new 'Alert subscriptions' menu option, click here >3. Confirm your subscribed alerts show here. Confirm the table sorting works etc (JS enabled). >4. Test unsubscribing from email alerts, make sure the confirmation pop-up works as expected (JS enabled). >5. Confirm that, when unsubscribing, you are redirected back to this page. >6. Confirm the menu option disappears from the left sidebar navigation if you have no alert subscriptions. > >Sponsored-by: Bibliotheksservice-Zentrum Baden-Wuerttemberg >Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> >--- > .../bootstrap/en/includes/usermenu.inc | 9 ++ > .../en/modules/opac-alert-subscriptions.tt | 111 ++++++++++++++++++ > opac/opac-alert-subscribe.pl | 4 + > opac/opac-alert-subscriptions.pl | 53 +++++++++ > 4 files changed, 177 insertions(+) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt > create mode 100755 opac/opac-alert-subscriptions.pl > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >index 5f8b48cda8..00b1b97050 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >@@ -157,6 +157,15 @@ > <a href="/cgi-bin/koha/opac-curbside-pickups.pl">Curbside pickups</a></li> > [% END %] > >+ [% IF logged_in_user.alert_subscriptions.count %] >+ [% IF ( alertsview ) %] >+ <li class="active"> >+ [% ELSE %] >+ <li> >+ [% END %] >+ <a href="/cgi-bin/koha/opac-alert-subscriptions.pl">Alert subscriptions ([% logged_in_user.alert_subscriptions.count | html %])</a></li> >+ [% END %] >+ > </ul> > </div> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt >new file mode 100644 >index 0000000000..abcdb9319a >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt >@@ -0,0 +1,111 @@ >+[% USE Koha %] >+[% USE Branches %] >+[% USE AuthorisedValues %] >+[% USE AdditionalContents %] >+[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] >+[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Your alert subscriptions › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% BLOCK cssinclude %][% END %] >+</head> >+[% INCLUDE 'bodytag.inc' bodyid='opac-alert-subscriptions' %] >+[% INCLUDE 'masthead.inc' %] >+ >+<div class="main"> >+ <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs"> >+ <ol class="breadcrumb"> >+ <li class="breadcrumb-item"> >+ <a href="/cgi-bin/koha/opac-main.pl">Home</a> >+ </li> >+ <li class="breadcrumb-item"> >+ <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> >+ </li> >+ <li class="breadcrumb-item active"> >+ <a href="#" aria-current="page">Your alert subscriptions</a> >+ </li> >+ </ol> >+ </nav> <!-- /#breadcrumbs --> >+ >+ <div class="container-fluid"> >+ <div class="row"> >+ <div class="col col-lg-2 order-2 order-lg-1"> >+ <div id="navigation"> >+ [% INCLUDE 'navigation.inc' IsPatronPage=1 %] >+ </div> >+ </div> >+ <div class="col-md-12 col-lg-10 order-1"> >+ >+ <div id="alert-subscriptions" class="maincontent"> >+ <h1>Alert subscriptions</h1> >+ >+ [% IF patron.alert_subscriptions.count %] >+ <table id="subscriptions" class="table table-bordered table-striped"> >+ <thead> >+ <tr> >+ <th>ISSN</th> >+ <th>Title</th> >+ <th>Library</th> >+ <th>Location</th> >+ <th>Call number</th> >+ <th>Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH sub IN patron.alert_subscriptions %] >+ <tr> >+ <td> >+ [% IF sub.biblio.biblioitem.issn %][% sub.biblio.biblioitem.issn | html %][% END %] >+ </td> >+ <td> >+ <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% sub.biblionumber | uri %]">[% sub.biblio.title | html %] [% sub.biblio.subtitle | html %]</a> >+ </td> >+ <td> >+ [% IF ( sub.branchcode ) %][% Branches.GetName( sub.branchcode ) | html %][% END %] >+ </td> >+ <td> >+ [% IF ( sub.location ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => sub.location ) | html %][% END %] >+ </td> >+ <td> >+ [% IF ( sub.callnumber ) %][% sub.callnumber | html %][% END %] >+ </td> >+ <td class="actions"> >+ <form action="/cgi-bin/koha/opac-alert-subscribe.pl" method="post" class="unsubscribe" data-title="[% sub.biblio.title | html %] [% sub.biblio.subtitle | html %]" data-patron="[% INCLUDE 'patron-title.inc' no_html=1 patron=logged_in_user%]"> >+ <input type="hidden" name="subscriptionid" value="[% sub.subscriptionid | html %]"> >+ <input type="hidden" name="referer" value="[% referer | html %]"> >+ <input type="hidden" name="biblionumber" value="[% sub.biblionumber | html %]"> >+ <input type="hidden" name="op" value="cancel_confirmed"> >+ <button type="submit" class="btn btn-link btn-sm" name="submit"><i class="fa fa-times" aria-hidden="true"></i> Unsubscribe from email alerts</button> >+ </form> >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <div class="dialog message"> >+ <p>You have not subscribed to email alerts for any subscriptions.</p> >+ </div> >+ [% END %] >+ </div> <!-- /#alert-subscriptions --> >+ >+ </div> <!-- / .col-lg-10 --> >+ </div> <!-- / .row --> >+ </div> <!-- / .container-fluid --> >+</div> <!-- / .main --> >+ >+[% INCLUDE 'opac-bottom.inc' %] >+[% BLOCK jsinclude %] >+[% INCLUDE 'datatables.inc' %] >+<script> >+ $(document).ready(function(){ >+ $("#subscriptions").dataTable($.extend(true, {}, dataTablesDefaults, { >+ })); >+ $(".unsubscribe").submit(function(){ >+ var patron = $(this).data('patron'); >+ var title = $(this).data('title'); >+ return confirmDelete(__("Are you sure you want to unsubscribe %s from email alerts for %s?").format(patron, title)); >+ }); >+ }); >+</script> >+[% END %] >diff --git a/opac/opac-alert-subscribe.pl b/opac/opac-alert-subscribe.pl >index c35b341e37..1d37d94563 100755 >--- a/opac/opac-alert-subscribe.pl >+++ b/opac/opac-alert-subscribe.pl >@@ -67,6 +67,10 @@ elsif ( $op eq 'cancel_confirmed' ) { > print $query->redirect( > "opac-serial-issues.pl?biblionumber=$biblionumber"); > exit; >+ } elsif ( $referer eq 'patron' ) { >+ print $query->redirect( >+ "/cgi-bin/koha/opac-alert-subscriptions.pl" >+ ); > } else { > print $query->redirect( > "opac-detail.pl?biblionumber=$biblionumber"); >diff --git a/opac/opac-alert-subscriptions.pl b/opac/opac-alert-subscriptions.pl >new file mode 100755 >index 0000000000..d3a2ccea97 >--- /dev/null >+++ b/opac/opac-alert-subscriptions.pl >@@ -0,0 +1,53 @@ >+#!/usr/bin/perl >+ >+# Copyright 2023 Aleisha Amohia <aleisha@catalyst.net.nz> >+# >+# 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, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use CGI qw ( -utf8 ); >+use C4::Auth qw( get_template_and_user ); >+use C4::Context; >+use C4::Output qw( output_html_with_http_headers ); >+use Koha::Patrons; >+use Koha::Token; >+ >+my $query = CGI->new(); >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => 'opac-alert-subscriptions.tt', >+ query => $query, >+ type => 'opac', >+ } >+); >+ >+my $patron = Koha::Patrons->find( $borrowernumber ); >+ >+$template->param( >+ alertsview => 1, >+ patron => $patron, >+ referer => 'patron', >+); >+ >+my $new_session_id = $query->cookie('CGISESSID'); >+$template->param( >+ csrf_token => Koha::Token->new->generate_csrf({ >+ session_id => $new_session_id, >+ }), >+); >+ >+output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >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 28130
:
151550
|
151619
|
151656
|
151657
|
151658
|
151659
|
151814
|
151815
|
153779
|
153780
|
153781
|
153782