Merge branch 'bug_8896' into 3.14-master
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Mon, 6 May 2013 12:50:15 +0000 (08:50 -0400)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Mon, 6 May 2013 12:50:15 +0000 (08:50 -0400)
C4/Serials.pm

index b8b53ed..e2748ff 100644 (file)
@@ -1134,18 +1134,18 @@ sub ModSerialStatus {
             $sth->execute($subscriptionid);
             my ( $missinglist, $recievedlist ) = $sth->fetchrow;
             if ( $status == 2 ) {
-
                 $recievedlist .= "; $serialseq"
-                  unless ( index( "$recievedlist", "$serialseq" ) >= 0 );
+                    if $recievedlist!~/(^|;)\s*$serialseq(?=;|$)/;
+            }
+            # in case serial has been previously marked as missing
+            if (grep /$status/, (1,2,3,7)) {
+                $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g;
             }
-
-            #         warn "missinglist : $missinglist serialseq :$serialseq, ".index("$missinglist","$serialseq");
             $missinglist .= "; $serialseq"
-              if ( $status == 4
-                and not index( "$missinglist", "$serialseq" ) >= 0 );
+                if $status==4 && $missinglist!~/(^|;)\s*$serialseq(?=;|$)/;
             $missinglist .= "; not issued $serialseq"
-              if ( $status == 5
-                and index( "$missinglist", "$serialseq" ) >= 0 );
+                if $status==5 && $missinglist!~/(^|;)\s*$serialseq(?=;|$)/;
+
             $query = "UPDATE subscriptionhistory SET recievedlist=?, missinglist=? WHERE  subscriptionid=?";
             $sth   = $dbh->prepare($query);
             $recievedlist =~ s/^; //;