Bug 11689: Take new serial missing statuses into account in more places
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 5 Feb 2014 10:05:19 +0000 (11:05 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 18 Apr 2014 21:07:59 +0000 (21:07 +0000)
Bug 10851 introduced new missing status (codes 41,42,43,44), but in
GetSerials and _update_missinglist, they are not taken into account.

This patch corrects the issue.

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 <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes QA script and tests.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Serials.pm

index c62d1ed..e9ac3d8 100644 (file)
@@ -769,7 +769,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);
@@ -790,7 +790,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);
@@ -1161,13 +1161,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/; $//;