From acf832a8f2d6c9d3055fcd127cd926c353f3c48f Mon Sep 17 00:00:00 2001 From: toins Date: Tue, 5 Jun 2007 08:46:18 +0000 Subject: [PATCH] re-indenting + redirecting to subscription-detail.pl after a renewal. --- serials/subscription-renew.pl | 67 ++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl index 09576422ba..806bcb2f6b 100755 --- a/serials/subscription-renew.pl +++ b/serials/subscription-renew.pl @@ -45,7 +45,6 @@ Id of the subscription this script has to renew =cut - use strict; require Exporter; use CGI; @@ -59,38 +58,48 @@ use C4::Output; use C4::Serials; my $query = new CGI; -my $dbh = C4::Context->dbh; +my $dbh = C4::Context->dbh; -my $op = $query->param('op'); +my $op = $query->param('op'); my $subscriptionid = $query->param('subscriptionid'); -my $done = 0; # for after form has been submitted -my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "serials/subscription-renew.tmpl", - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => {serials => 1}, - debug => 1, - }); -if ($op eq "renew") { - ReNewSubscription($subscriptionid,$loggedinuser,$query->param('startdate'),$query->param('numberlength'),$query->param('weeklength'),$query->param('monthlength'),$query->param('note')); - $done = 1; +my $done = 0; # for after form has been submitted +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "serials/subscription-renew.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { serials => 1 }, + debug => 1, + } +); + +if ( $op eq "renew" ) { + ReNewSubscription( + $subscriptionid, $loggedinuser, + $query->param('startdate'), $query->param('numberlength'), + $query->param('weeklength'), $query->param('monthlength'), + $query->param('note') + ); + $query->redirect('/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid='.$subscriptionid); + exit; } -my $subscription= GetSubscription($subscriptionid); - -$template->param(startdate => format_date(GetExpirationDate($subscriptionid)||POSIX::strftime("%Y-%m-%d",localtime)), - numberlength => $subscription->{numberlength}, - weeklength => $subscription->{weeklength}, - monthlength => $subscription->{monthlength}, - subscriptionid => $subscriptionid, - bibliotitle => $subscription->{bibliotitle}, - $op => 1, - done => $done, - intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), - intranetstylesheet => C4::Context->preference("intranetstylesheet"), - IntranetNav => C4::Context->preference("IntranetNav"), - ); +my $subscription = GetSubscription($subscriptionid); + +$template->param( + startdate => format_date( + GetExpirationDate($subscriptionid) + || POSIX::strftime( "%Y-%m-%d", localtime ) + ), + numberlength => $subscription->{numberlength}, + weeklength => $subscription->{weeklength}, + monthlength => $subscription->{monthlength}, + subscriptionid => $subscriptionid, + bibliotitle => $subscription->{bibliotitle}, + $op => 1, + done => $done, +); # Print the page output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5