From e3791f596610bc89e3a930afd9b99bcc995e64b8 Mon Sep 17 00:00:00 2001 From: hdl Date: Mon, 16 Jul 2007 15:49:14 +0000 Subject: [PATCH] Bug Fixing Getting back to serials-collection when edit finished. subscription-renew is done in a popup. --- serials/serials-edit.pl | 26 +++++++++++++++++--------- serials/subscription-detail.pl | 1 + serials/subscription-renew.pl | 7 +++---- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index cec92444ca..84083d462a 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -121,6 +121,7 @@ foreach my $tmpserialid (@serialids){ my $data=GetSerialInformation($tmpserialid); $data->{publisheddate}=format_date($data->{publisheddate}); $data->{planneddate}=format_date($data->{planneddate}); + $data->{'editdisable'}=(HasSubscriptionExpired($data->{subscriptionid})&& $data->{'status1'}); push @serialdatalist,$data; } my $bibdata=GetBiblioData($serialdatalist[0]->{'biblionumber'}); @@ -135,12 +136,14 @@ foreach my $subscriptionid (@subscriptionids){ PrepareItemrecordDisplay( $serialdatalist[0]->{'biblionumber'} ); } $cell->{'subscriptionid'}=$subscriptionid; - $cell->{'subscriptionexpired'}=HasSubscriptionExpired($subscriptionid); $cell->{'itemid'} = "NNEW"; $cell->{'serialid'} = "NEW"; $cell->{'issuesatonce'} = 1; push @newserialloop,$cell; - push @subscriptionloop, {'subscriptionid'=>$subscriptionid}; + push @subscriptionloop, {'subscriptionid'=>$subscriptionid, + 'abouttoexpire'=>abouttoexpire($subscriptionid), + 'subscriptionexpired'=>HasSubscriptionExpired($subscriptionid), + }; } $template->param(newserialloop=>\@newserialloop); $template->param(subscriptions=>\@subscriptionloop); @@ -248,13 +251,18 @@ if ($op eq 'serialchangestatus') { } } } - ### FIXME this part of code is not very pretty. Nor is it very efficient... There MUST be a more perlish way to write it. But it works. - my $redirect ="serials-home.pl?"; - $redirect.=join("&",map{"serialseq=".$_} @serialseqs); - $redirect.="&".join("&",map{"planneddate=".$_} @planneddates); - $redirect.="&".join("&",map{"publisheddate=".$_} @publisheddates); - $redirect.="&".join("&",map{"status=".$_} @status); - $redirect.="&".join("&",map{"notes=".$_} @notes); +# ### FIXME this part of code is not very pretty. Nor is it very efficient... There MUST be a more perlish way to write it. But it works. +# my $redirect ="serials-home.pl?"; +# $redirect.=join("&",map{"serialseq=".$_} @serialseqs); +# $redirect.="&".join("&",map{"planneddate=".$_} @planneddates); +# $redirect.="&".join("&",map{"publisheddate=".$_} @publisheddates); +# $redirect.="&".join("&",map{"status=".$_} @status); +# $redirect.="&".join("&",map{"notes=".$_} @notes); + + my $redirect ="serials-collection.pl?"; + my %hashsubscription; + map{$hashsubscription{$_}=1} @subscriptionids; + $redirect.=join("&",map{"subscriptionid=".$_} sort keys %hashsubscription); print $query->redirect("$redirect"); } diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl index c26b5a8184..96c00aa238 100755 --- a/serials/subscription-detail.pl +++ b/serials/subscription-detail.pl @@ -48,6 +48,7 @@ if ($op eq 'del') { } my $subs = &GetSubscription($subscriptionid); +# use Data::Dumper; warn $subscriptionid; warn Dumper($subs); my ($routing, @routinglist) = getroutinglist($subscriptionid); my ($totalissues,@serialslist) = GetSerials($subscriptionid); $totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscription (only 1 issue) diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl index ab6a019912..31ae2e4f75 100755 --- a/serials/subscription-renew.pl +++ b/serials/subscription-renew.pl @@ -60,6 +60,7 @@ use C4::Serials; my $query = new CGI; my $dbh = C4::Context->dbh; +my $mode = $query->param('mode'); my $op = $query->param('op'); my $subscriptionid = $query->param('subscriptionid'); my $done = 0; # for after form has been submitted @@ -80,9 +81,7 @@ if ( $op eq "renew" ) { $query->param('startdate'), $query->param('numberlength'), $query->param('weeklength'), $query->param('monthlength'), $query->param('note') - ); - print $query->redirect('/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid='.$subscriptionid); - exit; + ); } my $subscription = GetSubscription($subscriptionid); @@ -98,7 +97,7 @@ $template->param( subscriptionid => $subscriptionid, bibliotitle => $subscription->{bibliotitle}, $op => 1, - done => $done, + popup => ($query->param('mode')eq "popup"), ); # Print the page -- 2.39.5