@@ -, +, @@ --- .../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 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -157,6 +157,15 @@ Curbside pickups [% END %] + [% IF logged_in_user.alert_subscriptions.count %] + [% IF ( alertsview ) %] +
  • + [% ELSE %] +
  • + [% END %] + Alert subscriptions ([% logged_in_user.alert_subscriptions.count | html %])
  • + [% END %] + [% END %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt +++ a/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' %] +Your alert subscriptions › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog +[% INCLUDE 'doc-head-close.inc' %] +[% BLOCK cssinclude %][% END %] + +[% INCLUDE 'bodytag.inc' bodyid='opac-alert-subscriptions' %] +[% INCLUDE 'masthead.inc' %] + +
    + + +
    +
    +
    + +
    +
    + +
    +

    Alert subscriptions

    + + [% IF patron.alert_subscriptions.count %] + + + + + + + + + + + + + [% FOREACH sub IN patron.alert_subscriptions %] + + + + + + + + + [% END %] + +
    ISSNTitleLibraryLocationCall numberActions
    + [% IF sub.biblio.biblioitem.issn %][% sub.biblio.biblioitem.issn | html %][% END %] + + [% sub.biblio.title | html %] [% sub.biblio.subtitle | html %] + + [% IF ( sub.branchcode ) %][% Branches.GetName( sub.branchcode ) | html %][% END %] + + [% IF ( sub.location ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => sub.location ) | html %][% END %] + + [% IF ( sub.callnumber ) %][% sub.callnumber | html %][% END %] + +
    + + + + + +
    +
    + [% ELSE %] +
    +

    You have not subscribed to email alerts for any subscriptions.

    +
    + [% END %] +
    + +
    +
    +
    +
    + +[% INCLUDE 'opac-bottom.inc' %] +[% BLOCK jsinclude %] +[% INCLUDE 'datatables.inc' %] + +[% END %] --- a/opac/opac-alert-subscribe.pl +++ a/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"); --- a/opac/opac-alert-subscriptions.pl +++ a/opac/opac-alert-subscriptions.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +# Copyright 2023 Aleisha Amohia +# +# 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 . + +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 }; --