From 9619fde3e9f9c9547ad2240edafccfdc30ddfd8d Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 11 Apr 2013 12:48:26 +0200 Subject: [PATCH] Bug 8896 QA Followup for regex Making sure that the regex does not kill more than it should. Amended: does now only look at separating colons(;) not commas(,). Amended: two index expressions in direct context replaced by same regex for consistency. Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov (cherry picked from commit e5b467e81f494857a0831fe0d4f9ad94127a91bb) Signed-off-by: Jared Camins-Esakov (cherry picked from commit cb9af9d0e667dcdebfdc89e77bdb8fdc2598493d) Signed-off-by: Chris Cormack --- C4/Serials.pm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index d5a0b25fd2..03d287d42f 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1114,21 +1114,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; + $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/^; //; -- 2.39.5