From 842c3fc66acee26fc400399d3b4a55d616a9ad7c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 6 Mar 2013 13:42:11 -0500 Subject: [PATCH] Bug 8956 - Split serials enumeration data into separate fields - Part 4 - Add saving/editing of published end date for bound volumes --- C4/Serials.pm | 17 ++++++++--------- .../prog/en/modules/serials/serials-edit.tt | 7 +++++++ serials/serials-collection.pl | 2 +- serials/serials-edit.pl | 11 +++++++++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 8b5c697..1394a86 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1107,7 +1107,7 @@ Note : if we change from "waited" to something else,then we will have to create =cut sub ModSerialStatus { - my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_; + my ( $serialid, $serialseq, $planneddate, $publisheddate, $published_end_date, $status, $notes ) = @_; #It is a usual serial # 1st, get previous status : @@ -1124,9 +1124,9 @@ sub ModSerialStatus { } else { my $query = -'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE serialid = ?'; +'UPDATE serial SET serialseq=?,publisheddate=?,published_end_date=?,planneddate=?,status=?,notes=? WHERE serialid = ?'; $sth = $dbh->prepare($query); - $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid ); + $sth->execute( $serialseq, $publisheddate, $published_end_date, $planneddate, $status, $notes, $serialid ); $query = "SELECT * FROM subscription WHERE subscriptionid = ?"; $sth = $dbh->prepare($query); $sth->execute($subscriptionid); @@ -1172,7 +1172,7 @@ sub ModSerialStatus { # next date (calculated from actual date & frequency parameters) my $nextpublisheddate = GetNextDate( $publisheddate, $val ); - NewIssue( $newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextpublisheddate, $nextpublisheddate, undef, $newlastvalue1, $newlastvalue2, $newlastvalue3 ); + NewIssue( $newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextpublisheddate, $nextpublisheddate, $published_end_date, undef, $newlastvalue1, $newlastvalue2, $newlastvalue3 ); $query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? WHERE subscriptionid = ?"; $sth = $dbh->prepare($query); @@ -1482,18 +1482,17 @@ returns the serial id =cut sub NewIssue { - my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes, $x, $y, $z ) = @_; - warn "NewIssue( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes, $x, $y, $z )"; + my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $published_end_date, $notes, $x, $y, $z ) = @_; ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? my $dbh = C4::Context->dbh; my $query = qq| INSERT INTO serial - (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes,serialseq_x,serialseq_y,serialseq_z) - VALUES (?,?,?,?,?,?,?,?,?,?) + (serialseq,subscriptionid,biblionumber,status,publisheddate,published_end_date,planneddate,notes,serialseq_x,serialseq_y,serialseq_z) + VALUES (?,?,?,?,?,?,?,?,?,?,?) |; my $sth = $dbh->prepare($query); - $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes, $x, $y, $z ); + $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $published_end_date, $planneddate, $notes, $x, $y, $z ); my $serialid = $dbh->{'mysql_insertid'}; $query = qq| SELECT missinglist,recievedlist diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt index 5a2be85..ec05315 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt @@ -167,6 +167,7 @@ $(document).ready(function() { Expected on Status Notes + Bound volumes
Ending published on [% FOREACH serialslis IN serialslist %] [% UNLESS ( loop.odd ) %] @@ -240,6 +241,9 @@ $(document).ready(function() { + + + [% UNLESS ( serialslis.subscriptionexpired ) %] [% IF ( serialslis.serialsadditems ) %] @@ -350,6 +354,9 @@ $(document).ready(function() { + + + [% IF ( newserialloo.serialsadditems ) %] diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl index d02721b..9071f83 100755 --- a/serials/serials-collection.pl +++ b/serials/serials-collection.pl @@ -79,7 +79,7 @@ if($op eq 'gennext' && @subscriptionid){ my $nextpublisheddate = GetNextDate( $expected->{planneddate}->output('iso'), $subscription ); ## Creating the new issue NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, - 1, $nextpublisheddate, $nextpublisheddate, undef, $newlastvalue1, $newlastvalue2, $newlastvalue3 ); + 1, $nextpublisheddate, $nextpublisheddate, undef, undef, $newlastvalue1, $newlastvalue2, $newlastvalue3 ); ## Updating the subscription seq status my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index 66d3a4e..5c68b23 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -81,6 +81,7 @@ my @serialids = $query->param('serialid'); my @serialseqs = $query->param('serialseq'); my @planneddates = $query->param('planneddate'); my @publisheddates = $query->param('publisheddate'); +my @published_end_dates = $query->param('published_end_date'); my @status = $query->param('status'); my @notes = $query->param('notes'); my @subscriptionids = $query->param('subscriptionid'); @@ -134,7 +135,7 @@ foreach my $serialid (@serialids) { && !$processedserialid{$serialid} ) { my $serinfo = GetSerialInformation($serialid); #TODO duplicates work done by GetSerials2 above - for my $d ( qw( publisheddate planneddate )){ + for my $d ( qw( publisheddate planneddate published_end_date )){ if ( $serinfo->{$d} =~m/^00/ ) { $serinfo->{$d} = q{}; } @@ -206,7 +207,7 @@ if ( $op and $op eq 'serialchangestatus' ) { my $newserial; for ( my $i = 0 ; $i <= $#serialids ; $i++ ) { - my ($plan_date, $pub_date); + my ($plan_date, $pub_date, $pub_end_date); if (defined $planneddates[$i] && $planneddates[$i] ne 'XXX') { $plan_date = format_date_in_iso( $planneddates[$i] ); @@ -215,6 +216,10 @@ if ( $op and $op eq 'serialchangestatus' ) { $pub_date = format_date_in_iso( $publisheddates[$i] ); } + if (defined $published_end_dates[$i] && $published_end_dates[$i] ne 'XXX') { + $pub_end_date = format_date_in_iso( $published_end_dates[$i] ); + } + if ( $serialids[$i] && $serialids[$i] eq 'NEW' ) { if ( $serialseqs[$i] ) { @@ -227,6 +232,7 @@ if ( $op and $op eq 'serialchangestatus' ) { $status[$i], $plan_date, $pub_date, + $pub_end_date, $notes[$i] ); } @@ -237,6 +243,7 @@ if ( $op and $op eq 'serialchangestatus' ) { $serialseqs[$i], $plan_date, $pub_date, + $pub_end_date, $status[$i], $notes[$i] ); -- 1.7.2.5