Lines 17-23
Link Here
|
17 |
# You should have received a copy of the GNU General Public License |
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>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
|
|
|
21 |
use Modern::Perl; |
20 |
use Modern::Perl; |
22 |
use CGI qw ( -utf8 ); |
21 |
use CGI qw ( -utf8 ); |
23 |
use C4::Auth qw( get_template_and_user ); |
22 |
use C4::Auth qw( get_template_and_user ); |
Lines 25-92
use C4::Output qw( output_html_with_http_headers );
Link Here
|
25 |
use C4::Context; |
24 |
use C4::Context; |
26 |
use C4::Serials qw( GetSubscription ); |
25 |
use C4::Serials qw( GetSubscription ); |
27 |
|
26 |
|
28 |
|
|
|
29 |
my $query = CGI->new; |
27 |
my $query = CGI->new; |
30 |
my $op = $query->param('op') || ''; |
28 |
my $op = $query->param('op') || ''; |
31 |
my $dbh = C4::Context->dbh; |
29 |
my $dbh = C4::Context->dbh; |
32 |
|
30 |
|
33 |
my ( $template, $loggedinuser, $cookie ); |
31 |
my ( $template, $loggedinuser, $cookie ); |
34 |
my $subscriptionid = $query->param('subscriptionid'); |
32 |
my $subscriptionid = $query->param('subscriptionid'); |
35 |
my $referer = $query->param('referer') || 'detail'; |
33 |
my $referer = $query->param('referer') || 'detail'; |
36 |
my $biblionumber = $query->param('biblionumber'); |
34 |
my $biblionumber = $query->param('biblionumber'); |
37 |
|
35 |
|
38 |
( $template, $loggedinuser, $cookie ) = get_template_and_user( |
36 |
( $template, $loggedinuser, $cookie ) = get_template_and_user( |
39 |
{ |
37 |
{ |
40 |
template_name => "opac-alert-subscribe.tt", |
38 |
template_name => "opac-alert-subscribe.tt", |
41 |
query => $query, |
39 |
query => $query, |
42 |
type => "opac", |
40 |
type => "opac", |
43 |
authnotrequired => 0, # user must logged in to request |
41 |
authnotrequired => 0, # user must logged in to request |
44 |
# subscription notifications |
42 |
# subscription notifications |
45 |
} |
43 |
} |
46 |
); |
44 |
); |
47 |
|
45 |
|
48 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
46 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
49 |
my $logged_in_patron = Koha::Patrons->find( $loggedinuser ); |
47 |
my $logged_in_patron = Koha::Patrons->find($loggedinuser); |
50 |
|
48 |
|
51 |
if ( $op eq 'alert_confirmed' ) { |
49 |
if ( $op eq 'alert_confirmed' ) { |
52 |
$subscription->add_subscriber( $logged_in_patron ); |
50 |
$subscription->add_subscriber($logged_in_patron); |
53 |
if ( $referer eq 'serial' ) { |
51 |
if ( $referer eq 'serial' ) { |
54 |
print $query->redirect( |
52 |
print $query->redirect("opac-serial-issues.pl?biblionumber=$biblionumber"); |
55 |
"opac-serial-issues.pl?biblionumber=$biblionumber"); |
|
|
56 |
exit; |
53 |
exit; |
57 |
} else { |
54 |
} else { |
58 |
print $query->redirect( |
55 |
print $query->redirect("opac-detail.pl?biblionumber=$biblionumber"); |
59 |
"opac-detail.pl?biblionumber=$biblionumber"); |
|
|
60 |
exit; |
56 |
exit; |
61 |
} |
57 |
} |
62 |
} |
58 |
} elsif ( $op eq 'cancel_confirmed' ) { |
63 |
elsif ( $op eq 'cancel_confirmed' ) { |
59 |
$subscription->remove_subscriber($logged_in_patron); |
64 |
$subscription->remove_subscriber( $logged_in_patron ); |
|
|
65 |
warn "CANCEL confirmed : $loggedinuser, $subscriptionid"; |
60 |
warn "CANCEL confirmed : $loggedinuser, $subscriptionid"; |
66 |
if ( $referer eq 'serial' ) { |
61 |
if ( $referer eq 'serial' ) { |
67 |
print $query->redirect( |
62 |
print $query->redirect("opac-serial-issues.pl?biblionumber=$biblionumber"); |
68 |
"opac-serial-issues.pl?biblionumber=$biblionumber"); |
|
|
69 |
exit; |
63 |
exit; |
70 |
} elsif ( $referer eq 'patron' ) { |
64 |
} elsif ( $referer eq 'patron' ) { |
71 |
print $query->redirect( |
65 |
print $query->redirect("/cgi-bin/koha/opac-alert-subscriptions.pl"); |
72 |
"/cgi-bin/koha/opac-alert-subscriptions.pl" |
|
|
73 |
); |
74 |
} else { |
66 |
} else { |
75 |
print $query->redirect( |
67 |
print $query->redirect("opac-detail.pl?biblionumber=$biblionumber"); |
76 |
"opac-detail.pl?biblionumber=$biblionumber"); |
|
|
77 |
exit; |
68 |
exit; |
78 |
} |
69 |
} |
79 |
|
70 |
|
80 |
|
71 |
} else { |
81 |
} |
|
|
82 |
else { |
83 |
my $subscription = &GetSubscription($subscriptionid); |
72 |
my $subscription = &GetSubscription($subscriptionid); |
84 |
$template->param( |
73 |
$template->param( |
85 |
referer => $referer, |
74 |
referer => $referer, |
86 |
"typeissue$op" => 1, |
75 |
"typeissue$op" => 1, |
87 |
bibliotitle => $subscription->{bibliotitle}, |
76 |
bibliotitle => $subscription->{bibliotitle}, |
88 |
notes => $subscription->{notes}, |
77 |
notes => $subscription->{notes}, |
89 |
subscriptionid => $subscriptionid, |
78 |
subscriptionid => $subscriptionid, |
90 |
biblionumber => $biblionumber, |
79 |
biblionumber => $biblionumber, |
91 |
); |
80 |
); |
92 |
} |
81 |
} |