View | Details | Raw Unified | Return to bug 28130
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc (+9 lines)
Lines 157-162 Link Here
157
                <a href="/cgi-bin/koha/opac-curbside-pickups.pl">Curbside pickups</a></li>
157
                <a href="/cgi-bin/koha/opac-curbside-pickups.pl">Curbside pickups</a></li>
158
            [% END %]
158
            [% END %]
159
159
160
            [% IF logged_in_user.alert_subscriptions.count %]
161
                [% IF ( alertsview ) %]
162
                    <li class="active">
163
                [% ELSE %]
164
                    <li>
165
                [% END %]
166
                <a href="/cgi-bin/koha/opac-alert-subscriptions.pl">Alert subscriptions ([% logged_in_user.alert_subscriptions.count | html %])</a></li>
167
            [% END %]
168
160
        </ul>
169
        </ul>
161
    </div>
170
    </div>
162
[% END %]
171
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt (+111 lines)
Line 0 Link Here
1
[% USE Koha %]
2
[% USE Branches %]
3
[% USE AuthorisedValues %]
4
[% USE AdditionalContents %]
5
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
6
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
<title>Your alert subscriptions &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
9
[% INCLUDE 'doc-head-close.inc' %]
10
[% BLOCK cssinclude %][% END %]
11
</head>
12
[% INCLUDE 'bodytag.inc' bodyid='opac-alert-subscriptions' %]
13
[% INCLUDE 'masthead.inc' %]
14
15
<div class="main">
16
    <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
17
        <ol class="breadcrumb">
18
            <li class="breadcrumb-item">
19
                <a href="/cgi-bin/koha/opac-main.pl">Home</a>
20
            </li>
21
            <li class="breadcrumb-item">
22
                <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
23
            </li>
24
            <li class="breadcrumb-item active">
25
                <a href="#" aria-current="page">Your alert subscriptions</a>
26
            </li>
27
        </ol>
28
    </nav> <!-- /#breadcrumbs -->
29
30
    <div class="container-fluid">
31
        <div class="row">
32
            <div class="col col-lg-2 order-2 order-lg-1">
33
                <div id="navigation">
34
                    [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
35
                </div>
36
            </div>
37
            <div class="col-md-12 col-lg-10 order-1">
38
39
                <div id="alert-subscriptions" class="maincontent">
40
                    <h1>Alert subscriptions</h1>
41
42
                    [% IF patron.alert_subscriptions.count %]
43
                        <table id="subscriptions" class="table table-bordered table-striped">
44
                            <thead>
45
                                <tr>
46
                                <th>ISSN</th>
47
                                <th>Title</th>
48
                                <th>Library</th>
49
                                <th>Location</th>
50
                                <th>Call number</th>
51
                                <th>Actions</th>
52
                                </tr>
53
                            </thead>
54
                            <tbody>
55
                                [% FOREACH sub IN patron.alert_subscriptions %]
56
                                    <tr>
57
                                        <td>
58
                                            [% IF sub.biblio.biblioitem.issn %][% sub.biblio.biblioitem.issn | html %][% END %]
59
                                        </td>
60
                                        <td>
61
                                            <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% sub.biblionumber | uri %]">[% sub.biblio.title | html %] [% sub.biblio.subtitle | html %]</a>
62
                                        </td>
63
                                        <td>
64
                                            [% IF ( sub.branchcode ) %][% Branches.GetName( sub.branchcode ) | html %][% END %]
65
                                        </td>
66
                                        <td>
67
                                            [% IF ( sub.location ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => sub.location ) | html %][% END %]
68
                                        </td>
69
                                        <td>
70
                                            [% IF ( sub.callnumber ) %][% sub.callnumber | html %][% END %]
71
                                        </td>
72
                                        <td class="actions">
73
                                            <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%]">
74
                                                <input type="hidden" name="subscriptionid" value="[% sub.subscriptionid | html %]">
75
                                                <input type="hidden" name="referer" value="[% referer | html %]">
76
                                                <input type="hidden" name="biblionumber" value="[% sub.biblionumber | html %]">
77
                                                <input type="hidden" name="op" value="cancel_confirmed">
78
                                                <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>
79
                                            </form>
80
                                        </td>
81
                                    </tr>
82
                                [% END %]
83
                            </tbody>
84
                        </table>
85
                    [% ELSE %]
86
                        <div class="dialog message">
87
                            <p>You have not subscribed to email alerts for any subscriptions.</p>
88
                        </div>
89
                    [% END %]
90
                </div> <!-- /#alert-subscriptions -->
91
92
           </div> <!-- / .col-lg-10 -->
93
        </div> <!-- / .row -->
94
    </div> <!-- / .container-fluid -->
95
</div> <!-- / .main -->
96
97
[% INCLUDE 'opac-bottom.inc' %]
98
[% BLOCK jsinclude %]
99
[% INCLUDE 'datatables.inc' %]
100
<script>
101
    $(document).ready(function(){
102
        $("#subscriptions").dataTable($.extend(true, {}, dataTablesDefaults, {
103
        }));
104
        $(".unsubscribe").submit(function(){
105
            var patron = $(this).data('patron');
106
            var title = $(this).data('title');
107
            return confirmDelete(__("Are you sure you want to unsubscribe %s from email alerts for %s?").format(patron, title));
108
        });
109
    });
110
</script>
111
[% END %]
(-)a/opac/opac-alert-subscribe.pl (+4 lines)
Lines 67-72 elsif ( $op eq 'cancel_confirmed' ) { Link Here
67
        print $query->redirect(
67
        print $query->redirect(
68
            "opac-serial-issues.pl?biblionumber=$biblionumber");
68
            "opac-serial-issues.pl?biblionumber=$biblionumber");
69
        exit;
69
        exit;
70
    } elsif ( $referer eq 'patron' ) {
71
        print $query->redirect(
72
            "/cgi-bin/koha/opac-alert-subscriptions.pl"
73
        );
70
    } else {
74
    } else {
71
        print $query->redirect(
75
        print $query->redirect(
72
            "opac-detail.pl?biblionumber=$biblionumber");
76
            "opac-detail.pl?biblionumber=$biblionumber");
(-)a/opac/opac-alert-subscriptions.pl (-1 / +53 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2023 Aleisha Amohia <aleisha@catalyst.net.nz>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
use CGI qw ( -utf8 );
22
use C4::Auth qw( get_template_and_user );
23
use C4::Context;
24
use C4::Output qw( output_html_with_http_headers );
25
use Koha::Patrons;
26
use Koha::Token;
27
28
my $query = CGI->new();
29
30
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
31
    {
32
        template_name   => 'opac-alert-subscriptions.tt',
33
        query           => $query,
34
        type            => 'opac',
35
    }
36
);
37
38
my $patron = Koha::Patrons->find( $borrowernumber );
39
40
$template->param(
41
    alertsview => 1,
42
    patron => $patron,
43
    referer => 'patron',
44
);
45
46
my $new_session_id = $query->cookie('CGISESSID');
47
$template->param(
48
    csrf_token => Koha::Token->new->generate_csrf({
49
        session_id => $new_session_id,
50
    }),
51
);
52
53
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };

Return to bug 28130