From f9bd0bfde2e437a9a690b3800f59cd11faf50ee2 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Sun, 18 Jul 2010 17:35:14 +0100 Subject: [PATCH] Bug 5022 Supplements were not saved correctly Content-Type: text/plain; charset="utf-8" No subscription id was set Also entered a default arrived date on the supplement And removed errors due to bad dates returned from GetSerials --- 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 032246c..55eb6f7 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 8805654..c2b724b 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 dee624c..6357fc7 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] ), -- 1.7.1.1