From 55b23586ff42154ef0423943da87aa83ec545099 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 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). Signed-off-by: Koha Team Amu Signed-off-by: Paul Poulain --- C4/Serials.pm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index a2498c8..6898af3 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1138,18 +1138,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.9.5