From aa6ce934d9fc3eb260211292c44ae941fe214330 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Mon, 6 Dec 2010 16:48:47 +0100 Subject: [PATCH] Bug 5022 Supplements were not saved correctly No subscription id was set Also entered a default arrived date on the supplement And removed errors due to bad dates returned from GetSerials Signed-off-by: Katrin Fischer Signed-off-by: Chris Cormack --- C4/Serials.pm | 19 +++++++++++++++---- .../prog/en/modules/serials/serials-edit.tmpl | 8 ++++++-- serials/serials-edit.pl | 16 ++++++++++++---- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 32e46becae..bf4a2e6f71 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -659,8 +659,13 @@ sub GetSerials { while ( my $line = $sth->fetchrow_hashref ) { $line->{ "status" . $line->{status} } = 1; # fills a "statusX" value, used for template status select list - $line->{"publisheddate"} = format_date( $line->{"publisheddate"} ); - $line->{"planneddate"} = format_date( $line->{"planneddate"} ); + for my $datefield ( qw( planneddate publisheddate) ) { + if ($line->{$datefield} && $line->{$datefield}!~m/^00/) { + $line->{$datefield} = format_date( $line->{$datefield}); + } else { + $line->{$datefield} = q{}; + } + } push @serials, $line; } @@ -676,8 +681,14 @@ sub GetSerials { while ( ( my $line = $sth->fetchrow_hashref ) && $counter < $count ) { $counter++; $line->{ "status" . $line->{status} } = 1; # fills a "statusX" value, used for template status select list - $line->{"planneddate"} = format_date( $line->{"planneddate"} ); - $line->{"publisheddate"} = format_date( $line->{"publisheddate"} ); + for my $datefield ( qw( planneddate publisheddate) ) { + if ($line->{$datefield} && $line->{$datefield}!~m/^00/) { + $line->{$datefield} = format_date( $line->{$datefield}); + } else { + $line->{$datefield} = q{}; + } + } + push @serials, $line; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tmpl index 88056540d1..c2b724b3e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tmpl @@ -88,6 +88,10 @@ function changeDate(adate) { var elem = document.getElementById("expecteddate"); elem.value = adate; } +function changeDate2(adate) { + var elem = document.getElementById("supexpecteddate"); + elem.value = adate; +} function CloneSubfield(index){ var original = document.getElementById(index); //original
var clone = original.cloneNode(true); @@ -331,10 +335,10 @@ function CloneSubfield(index){ " size="10" maxlength="15" /> - " size="10" maxlength="15" /> + " size="10" maxlength="15" /> - " onchange="if (this.value==2 || this.value==7){changeDate2('')} else {changeDate2('')}" > diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index dee624c73e..6357fc71f2 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -19,7 +19,7 @@ =head1 NAME -serials-recieve.pl +serials-edit.pl =head1 Parameters @@ -133,8 +133,14 @@ foreach my $tmpserialid (@serialids) { && !$processedserialid{$tmpserialid} ) { my $data = GetSerialInformation($tmpserialid); - $data->{publisheddate} = format_date( $data->{publisheddate} ); - $data->{planneddate} = format_date( $data->{planneddate} ); + for my $datefield ( qw( publisheddate planneddate) ) { + if ($data->{$datefield} && $data->{$datefield}!~m/^00/) { + $data->{$datefield} = format_date( $data->{$datefield} ); + } + else { + $data->{$datefield} = q{}; + } + } $data->{arriveddate}=$today->output('syspref'); $data->{'editdisable'} = ( ( @@ -173,6 +179,8 @@ foreach my $subscriptionid (@subscriptionids) { $cell->{'itemid'} = "NNEW"; $cell->{'serialid'} = "NEW"; $cell->{'issuesatonce'} = 1; + $cell->{arriveddate}=$today->output('syspref'); + push @newserialloop, $cell; push @subscriptionloop, { @@ -198,7 +206,7 @@ if ( $op and $op eq 'serialchangestatus' ) { ### FIXME if NewIssue is modified to use subscription biblionumber, then biblionumber would not be useful. $newserial = NewIssue( $serialseqs[$i], - $subscriptionids[$i], + $subscriptionids[0], $serialdatalist[0]->{'biblionumber'}, $status[$i], format_date_in_iso( $planneddates[$i] ), -- 2.39.5