From 62a19486782b6641d32ae059fe2f02d14de54b70 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 5 Feb 2014 11:05:19 +0100 Subject: [PATCH] Bug 11689: New missing statuses are not well managed Bug 10851 introduced new missing status (codes 41,42,43,44), but in GetSerials and _update_missinglist, they are not take into account. To reproduce: 1/ Create a serial with 10 issues. 2/ Set different statuses on each one, with at least 6 missing statuses (not only "Missing"). 3/ Go on the subscription detail page, tab "Summary", the issues with a new missing status are not listed in the missing issues list. 4/ On the "Issues" tab, all missing are listed (normally only 5 should be listed. 5/ Apply the patch. 6/ Edit serial (to rewrite the missing list). 6/ Verify that steps 3 and 4 have now correct behavior. Signed-off-by: Chris Cormack --- C4/Serials.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 2fb639b..bfbf21f 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -772,7 +772,7 @@ sub GetSerials { my @serials; my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes FROM serial - WHERE subscriptionid = ? AND status NOT IN (2,4,5) + WHERE subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5) ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC"; my $sth = $dbh->prepare($query); $sth->execute($subscriptionid); @@ -793,7 +793,7 @@ sub GetSerials { $query = "SELECT serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes FROM serial WHERE subscriptionid = ? - AND (status in (2,4,5)) + AND (status in (2, 4, 41, 42, 43, 44, 5)) ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC "; $sth = $dbh->prepare($query); @@ -1164,13 +1164,13 @@ sub _update_missinglist { my $subscriptionid = shift; my $dbh = C4::Context->dbh; - my @missingserials = GetSerials2($subscriptionid, "4,5"); + my @missingserials = GetSerials2($subscriptionid, "4,41,42,43,44,5"); my $missinglist; - foreach (@missingserials) { - if($_->{'status'} == 4) { - $missinglist .= $_->{'serialseq'} . "; "; - } elsif($_->{'status'} == 5) { - $missinglist .= "not issued " . $_->{'serialseq'} . "; "; + foreach my $missingserial (@missingserials) { + if ( grep { $_ == $missingserial->{status} } qw( 4 41 42 43 44 ) ) { + $missinglist .= $missingserial->{'serialseq'} . "; "; + } elsif($missingserial->{'status'} == 5) { + $missinglist .= "not issued " . $missingserial->{'serialseq'} . "; "; } } $missinglist =~ s/; $//; -- 1.8.5.3