3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
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.
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.
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>.
32 my $op = $query->param('op') || '';
33 my $dbh = C4
::Context
->dbh;
36 my ( $template, $loggedinuser, $cookie );
37 my $subscriptionid = $query->param('subscriptionid');
38 my $referer = $query->param('referer') || 'detail';
39 my $biblionumber = $query->param('biblionumber');
41 ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
43 template_name
=> "opac-alert-subscribe.tt",
46 authnotrequired
=> 0, # user must logged in to request
47 # subscription notifications
52 my $subscription = Koha
::Subscriptions
->find( $subscriptionid );
53 my $logged_in_patron = Koha
::Patrons
->find( $loggedinuser );
55 if ( $op eq 'alert_confirmed' ) {
56 $subscription->add_subscriber( $logged_in_patron );
57 if ( $referer eq 'serial' ) {
58 print $query->redirect(
59 "opac-serial-issues.pl?biblionumber=$biblionumber");
62 print $query->redirect(
63 "opac-detail.pl?biblionumber=$biblionumber");
67 elsif ( $op eq 'cancel_confirmed' ) {
68 $subscription->remove_subscriber( $logged_in_patron );
69 warn "CANCEL confirmed : $loggedinuser, $subscriptionid";
70 if ( $referer eq 'serial' ) {
71 print $query->redirect(
72 "opac-serial-issues.pl?biblionumber=$biblionumber");
75 print $query->redirect(
76 "opac-detail.pl?biblionumber=$biblionumber");
83 my $subscription = &GetSubscription
($subscriptionid);
87 bibliotitle
=> $subscription->{bibliotitle
},
88 notes
=> $subscription->{notes
},
89 subscriptionid
=> $subscriptionid,
90 biblionumber
=> $biblionumber,
93 output_html_with_http_headers
$query, $cookie, $template->output;