Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 107 lines (86 sloc) 3.051 kb
a0b06fbe » ctfliblime
2011-03-12 Prepare for perlbrew usage by changing all script magic to "#!/usr/bi…
1 #!/usr/bin/env perl
de16696e » toins
2006-07-12 this file has moved from bull to here
2
3 # Copyright 2000-2002 Katipo Communications
4 #
5 # This file is part of Koha.
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
19
20
21 =head1 NAME
22
23 subscription-renew.pl
24
25 =head1 DESCRIPTION
26
27 this script renew an existing subscription.
28
29 =head1 Parameters
30
31 =over 4
32
33 =item op
34 op use to know the operation to do on this template.
35 * renew : to renew the subscription.
36
37 Note that if op = modsubscription there are a lot of other parameters.
38
39 =item subscriptionid
40 Id of the subscription this script has to renew
41
42 =back
43
44 =cut
45
46 use strict;
c9f3ede1 » colinsc
2009-09-07 Enable warnings in serial scripts
47 use warnings;
4bf76c2d » Galen Charlton
2008-09-17 bug 2615: remove unneeded 'require Exporter'
48
de16696e » toins
2006-07-12 this file has moved from bull to here
49 use CGI;
50 use C4::Koha;
51 use C4::Auth;
a602c6d6 » Joshua Ferraro
2007-12-04 cleanup for serials and members for Dates
52 use C4::Dates qw/format_date/;
3607caae » ctfliblime
2011-06-09 Add Koha.pm and include it universally
53 use Koha;
de16696e » toins
2006-07-12 this file has moved from bull to here
54 use C4::Context;
55 use C4::Auth;
fc1342f7 » tipaul
2007-03-09 rel_3_0 moved to HEAD
56 use C4::Output;
de16696e » toins
2006-07-12 this file has moved from bull to here
57 use C4::Serials;
58
59 my $query = new CGI;
acf832a8 » toins
2007-06-05 re-indenting + redirecting to subscription-detail.pl after a renewal.
60 my $dbh = C4::Context->dbh;
de16696e » toins
2006-07-12 this file has moved from bull to here
61
e3791f59 » hdl
2007-07-16 Bug Fixing
62 my $mode = $query->param('mode');
bfad2384 » colinsc
2009-09-16 Ensure op is defined in serials scripts
63 my $op = $query->param('op') || q{};
de16696e » toins
2006-07-12 this file has moved from bull to here
64 my $subscriptionid = $query->param('subscriptionid');
acf832a8 » toins
2007-06-05 re-indenting + redirecting to subscription-detail.pl after a renewal.
65 my $done = 0; # for after form has been submitted
66 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
67 {
68 template_name => "serials/subscription-renew.tmpl",
69 query => $query,
70 type => "intranet",
71 authnotrequired => 0,
72 flagsrequired => { serials => 1 },
73 debug => 1,
74 }
75 );
76
77 if ( $op eq "renew" ) {
78 ReNewSubscription(
79 $subscriptionid, $loggedinuser,
80 $query->param('startdate'), $query->param('numberlength'),
81 $query->param('weeklength'), $query->param('monthlength'),
82 $query->param('note')
c9f3ede1 » colinsc
2009-09-07 Enable warnings in serial scripts
83 );
de16696e » toins
2006-07-12 this file has moved from bull to here
84 }
85
acf832a8 » toins
2007-06-05 re-indenting + redirecting to subscription-detail.pl after a renewal.
86 my $subscription = GetSubscription($subscriptionid);
4399daf0 » Henri-Damien LAURENT
2007-11-04 Managing Independant branches.
87 if ($subscription->{'cannotedit'}){
88 warn "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
89 print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
c9f3ede1 » colinsc
2009-09-07 Enable warnings in serial scripts
90 }
acf832a8 » toins
2007-06-05 re-indenting + redirecting to subscription-detail.pl after a renewal.
91
92 $template->param(
93 startdate => format_date(
94 GetExpirationDate($subscriptionid)
95 || POSIX::strftime( "%Y-%m-%d", localtime )
96 ),
97 numberlength => $subscription->{numberlength},
98 weeklength => $subscription->{weeklength},
99 monthlength => $subscription->{monthlength},
100 subscriptionid => $subscriptionid,
101 bibliotitle => $subscription->{bibliotitle},
102 $op => 1,
c9f3ede1 » colinsc
2009-09-07 Enable warnings in serial scripts
103 popup => ($query->param('mode')eq "popup"),
acf832a8 » toins
2007-06-05 re-indenting + redirecting to subscription-detail.pl after a renewal.
104 );
de16696e » toins
2006-07-12 this file has moved from bull to here
105
106 # Print the page
107 output_html_with_http_headers $query, $cookie, $template->output;
Something went wrong with that request. Please try again.