From 4d0737ae74a8c3d109d0c448ab18283a611d3285 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 22 Apr 2013 11:53:28 +0200 Subject: [PATCH] Bug 10092: Small improvements on serial missinglist and receivedlist Content-Type: text/plain; charset=utf-8 Builds upon report 8896 with changes for missinglist. Similar changes for receivedlist to be consistent. Test plan: Go to serial collection information. Edit serials. Toggle the status through all possible values. On another tab or in the db, check missinglist and receivedlist (subscription detail tab Summary). --- C4/Serials.pm | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index e2748ff..d2cd78b 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1133,18 +1133,25 @@ sub ModSerialStatus { $sth = $dbh->prepare($query); $sth->execute($subscriptionid); my ( $missinglist, $recievedlist ) = $sth->fetchrow; - if ( $status == 2 ) { + + #Arrived: add to received list, remove from missing + if($status==2) { $recievedlist .= "; $serialseq" if $recievedlist!~/(^|;)\s*$serialseq(?=;|$)/; + $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g; } - # in case serial has been previously marked as missing - if (grep /$status/, (1,2,3,7)) { + #Expected,late,claimed: remove optionally from received+missing + if (grep /$status/, (1,3,7)) { + $recievedlist=~ s/(^|;)\s*$serialseq(?=;|$)//g; $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g; } - $missinglist .= "; $serialseq" - if $status==4 && $missinglist!~/(^|;)\s*$serialseq(?=;|$)/; - $missinglist .= "; not issued $serialseq" - if $status==5 && $missinglist!~/(^|;)\s*$serialseq(?=;|$)/; + #Missing, not available: add to missing, remove from received + #No longer putting additional text into missing field + if($status==4 || $status==5) { + $missinglist .= "; $serialseq" + if $missinglist!~/(^|;)\s*$serialseq(?=;|$)/; + $recievedlist=~ s/(^|;)\s*$serialseq(?=;|$)//g; + } $query = "UPDATE subscriptionhistory SET recievedlist=?, missinglist=? WHERE subscriptionid=?"; $sth = $dbh->prepare($query); -- 1.7.7.6