Lines 60-66
my $dbh = C4::Context->dbh;
Link Here
|
60 |
|
60 |
|
61 |
my $mode = $query->param('mode') || q{}; |
61 |
my $mode = $query->param('mode') || q{}; |
62 |
my $op = $query->param('op') || 'display'; |
62 |
my $op = $query->param('op') || 'display'; |
63 |
my $subscriptionid = $query->param('subscriptionid'); |
63 |
my @subscriptionids = $query->multi_param('subscriptionid'); |
64 |
my $done = 0; # for after form has been submitted |
64 |
my $done = 0; # for after form has been submitted |
65 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
65 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
66 |
{ |
66 |
{ |
Lines 73-106
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
73 |
} |
73 |
} |
74 |
); |
74 |
); |
75 |
if ( $op eq "renew" ) { |
75 |
if ( $op eq "renew" ) { |
|
|
76 |
# Do not use this script with op=renew and @subscriptionids > 1! |
77 |
my $subscriptionid = $subscriptionids[0]; |
76 |
my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } ); |
78 |
my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } ); |
77 |
ReNewSubscription( |
79 |
ReNewSubscription( |
78 |
$subscriptionid, $loggedinuser, |
80 |
$subscriptionid, $loggedinuser, |
79 |
$startdate, $query->param('numberlength'), |
81 |
$startdate, scalar $query->param('numberlength'), |
80 |
$query->param('weeklength'), $query->param('monthlength'), |
82 |
scalar $query->param('weeklength'), scalar $query->param('monthlength'), |
81 |
$query->param('note') |
83 |
scalar $query->param('note') |
82 |
); |
84 |
); |
83 |
} |
85 |
} elsif ( $op eq 'multi_renew' ) { |
|
|
86 |
for my $subscriptionid ( @subscriptionids ) { |
87 |
my $subscription = GetSubscription( $subscriptionid ); |
88 |
next unless $subscription; |
89 |
ReNewSubscription( |
90 |
$subscriptionid, $loggedinuser, |
91 |
$subscription->{enddate}, $subscription->{numberlength}, |
92 |
$subscription->{weeklength}, $subscription->{monthlength}, |
93 |
); |
94 |
} |
95 |
} else { |
96 |
my $subscriptionid = $subscriptionids[0]; |
97 |
my $subscription = GetSubscription($subscriptionid); |
98 |
if ($subscription->{'cannotedit'}){ |
99 |
carp "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed"; |
100 |
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); |
101 |
} |
84 |
|
102 |
|
85 |
my $subscription = GetSubscription($subscriptionid); |
103 |
my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } ) |
86 |
if ($subscription->{'cannotedit'}){ |
104 |
or output_pref( { dt => dt_from_string, dateonly => 1 } ); |
87 |
carp "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed"; |
|
|
88 |
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); |
89 |
} |
90 |
|
105 |
|
91 |
my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } ) |
106 |
$template->param( |
92 |
or output_pref( { dt => dt_from_string, dateonly => 1 } ); |
107 |
startdate => $newstartdate, |
|
|
108 |
subscription => $subscription, |
109 |
); |
110 |
} |
93 |
|
111 |
|
94 |
$template->param( |
112 |
$template->param( |
95 |
startdate => $newstartdate, |
113 |
op => $op, |
96 |
numberlength => $subscription->{numberlength}, |
|
|
97 |
weeklength => $subscription->{weeklength}, |
98 |
monthlength => $subscription->{monthlength}, |
99 |
subscriptionid => $subscriptionid, |
100 |
bibliotitle => $subscription->{bibliotitle}, |
101 |
$op => 1, |
102 |
popup => ($mode eq 'popup'), |
103 |
); |
114 |
); |
104 |
|
115 |
|
105 |
# Print the page |
|
|
106 |
output_html_with_http_headers $query, $cookie, $template->output; |
116 |
output_html_with_http_headers $query, $cookie, $template->output; |
107 |
- |
|
|