From a3d80a9f4f55bd49616f5bcdaa60289b9587ae59 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Thu, 29 Apr 2010 12:05:38 +0200 Subject: [PATCH] MT3421, Follow-up: Moves subscription history in a separate page - Adds link to serial-collection.pl - Changes are displayed after modification --- serials/serials-collection.pl | 3 +- serials/subscription-history.pl | 63 +++++++++++++++++---------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl index f66d724332..cbf0cafe2b 100755 --- a/serials/serials-collection.pl +++ b/serials/serials-collection.pl @@ -105,6 +105,7 @@ if (@subscriptionid){ $subs->{ "status" . $subs->{'status'} } = 1; $subs->{startdate} = format_date( $subs->{startdate} ); $subs->{histstartdate} = format_date( $subs->{histstartdate} ); + if ( !defined $subs->{enddate} || $subs->{enddate} eq '0000-00-00' ) { $subs->{enddate} = ''; } @@ -124,7 +125,7 @@ if (@subscriptionid){ my $subscriptioninformation = GetFullSubscriptionsFromBiblionumber($biblionumber); $subscriptions=PrepareSerialsData($subscriptioninformation); } - +$template->param($subscriptiondescs->[0]); my $title = $subscriptiondescs->[0]{bibliotitle}; my $yearmax=($subscriptions->[0]{year} eq "manage" && scalar(@$subscriptions)>1)? $subscriptions->[1]{year} :$subscriptions->[0]{year}; my $yearmin=$subscriptions->[scalar(@$subscriptions)-1]{year}; diff --git a/serials/subscription-history.pl b/serials/subscription-history.pl index 5f3122a6c4..09020ec3cf 100755 --- a/serials/subscription-history.pl +++ b/serials/subscription-history.pl @@ -43,42 +43,43 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); - my $subscriptionid = $query->param('subscriptionid'); - my $modhistory = $query->param('modhistory'); - my $subs = &GetSubscription($subscriptionid); +my $subscriptionid = $query->param('subscriptionid'); +my $modhistory = $query->param('modhistory'); +my $subs = &GetSubscription($subscriptionid); ## FIXME : Check rights to edit if mod. Could/Should display an error message. - if ($subs->{'cannotedit'}){ - warn "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed"; - print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); - } +if ($subs->{'cannotedit'}){ + warn "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed"; + print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); +} +# Modifications has been sent +if ($modhistory) { + my $histstartdate = format_date_in_iso($query->param('histstartdate')); + my $histenddate = format_date_in_iso($query->param('histenddate')); + my $recievedlist = $query->param('recievedlist'); + my $missinglist = $query->param('missinglist'); + my $opacnote = $query->param('opacnote'); + my $librariannote = $query->param('librariannote'); + my $return = ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote); + $template->param(success => 1) if ($return == 1); - for (qw(startdate firstacquidate histstartdate enddate histenddate)) { - # TODO : Handle date formats properly. - if ($subs->{$_} eq '0000-00-00') { - $subs->{$_} = '' - } else { - $subs->{$_} = format_date($subs->{$_}); - } - } + # Getting modified data + $subs = &GetSubscription($subscriptionid); +} +# Date handling +for (qw(startdate firstacquidate histstartdate enddate histenddate)) { + # TODO : Handle date formats properly. + if ($subs->{$_} eq '0000-00-00') { + $subs->{$_} = '' + } else { + $subs->{$_} = format_date($subs->{$_}); + } +} - $template->param($subs); - $template->param( - history => ($subs->{manualhistory} == 1 ), - ); +$template->param($subs); +$template->param(history => ($subs->{manualhistory} == 1 )); - if ($modhistory) { - my $histstartdate = format_date_in_iso($query->param('histstartdate')); - my $histenddate = format_date_in_iso($query->param('histenddate')); - my $recievedlist = $query->param('recievedlist'); - my $missinglist = $query->param('missinglist'); - my $opacnote = $query->param('opacnote'); - my $librariannote = $query->param('librariannote'); - my $return = ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote); - $template->param(success => 1) if ($return == 1); - } - - output_html_with_http_headers $query, $cookie, $template->output; +output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5