From 421794e2a2af09669089d71ed27d177c148d583e Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Mon, 4 Jun 2012 09:39:05 +0530 Subject: [PATCH] Bug 7910 - Batch renewal of serials To Test: 1) Go to Serials click on Check expiration link. 2) Search some subscription which have to expire it will give some result. 3) Select atleast one subscription which you want to renew. 4) Check the expiration date after renew. Signed-off-by: Jonathan Druart modify + subscriptionid => @subscriptionid, with + subscriptionid => \@subscriptionid, Signed-off-by: Jonathan Druart --- .../prog/en/modules/serials/checkexpiration.tt | 34 ++++++++++++++++++-- serials/subscription-renew.pl | 28 +++++++++++++--- 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt index f2b01a5..dc04d2f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt @@ -25,7 +25,23 @@ // ]]> - + [% INCLUDE 'header.inc' %] @@ -74,8 +90,15 @@ [% END %] will expire before [% date %]

+
+ + + + - + + @@ -88,6 +111,9 @@ [% ELSE %] [% END %] + @@ -108,7 +134,9 @@ [% END %] -
ISSN Title Note
+ + [% subscriptions_loo.issn %] Renew
+
+ +
[% ELSE %]

No results for your query

[% END %] diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl index 48861bc..c274781 100755 --- a/serials/subscription-renew.pl +++ b/serials/subscription-renew.pl @@ -61,7 +61,8 @@ my $dbh = C4::Context->dbh; my $mode = $query->param('mode'); my $op = $query->param('op') || q{}; -my $subscriptionid = $query->param('subscriptionid'); +my @subscriptionid = $query->param('subscriptionid'); +my $date = $query->param('date'); my $done = 0; # for after form has been submitted my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -75,17 +76,32 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); if ( $op eq "renew" ) { ReNewSubscription( - $subscriptionid, $loggedinuser, + @subscriptionid, $loggedinuser, C4::Dates->new($query->param('startdate'))->output('iso'), $query->param('numberlength'), $query->param('weeklength'), $query->param('monthlength'), $query->param('note') ); } -my $subscription = GetSubscription($subscriptionid); +my $subid; +if ( $op eq "renewall" ) { + foreach $subid (@subscriptionid){ + next unless $subid; + my $data = GetSubscription($subid); + my $length = $data->{numberlength}; + my $weeklength = $data->{weeklength}; + my $monthlength = $data->{monthlength}; + my $note = $data->{note}; + my $startdate = $data->{enddate} || POSIX::strftime( "%Y-%m-%d", localtime ); + ReNewSubscription( $subid,$loggedinuser,$startdate,$length,$weeklength, $monthlength, $note); + } + print $query->redirect("/cgi-bin/koha/serials/checkexpiration.pl?date=$date"); +} + +my $subscription = GetSubscription(@subscriptionid); if ($subscription->{'cannotedit'}){ - carp "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed"; - print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); + carp "Attempt to renew subscription @subscriptionid by ".C4::Context->userenv->{'id'}." not allowed"; + print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=@subscriptionid"); } $template->param( @@ -96,7 +112,7 @@ $template->param( numberlength => $subscription->{numberlength}, weeklength => $subscription->{weeklength}, monthlength => $subscription->{monthlength}, - subscriptionid => $subscriptionid, + subscriptionid => \@subscriptionid, bibliotitle => $subscription->{bibliotitle}, $op => 1, popup => ($query->param('mode')eq "popup"), -- 1.7.7.3