From c194b7a2d9fddfb555c953e63325bfc6ccda0650 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 Content-Type: text/plain; charset=utf-8 Making sure that the regex does not kill more than it should. Here are my test results when removing serialseq 3 :) 3 => 3 => 3; => 1;3 => 1 1; 3 => 1 1; 3; => 1 3;1 => 1 3; 1 => 1 3 ;1 => 1 3 ; 1 => 1 1;3;31 => 1;31 1;3 ;31 => 1;31 1;3; 31 => 1;31 1; 3;31;3A => 1;31;3A 2;3;31;; ;,, ;;,, ,;,;,;4 => 2;31;4 Signed-off-by: Marcel de Rooy --- C4/Serials.pm | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 784916c..a186bc1 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1140,7 +1140,11 @@ sub ModSerialStatus { } # in case serial has been previously marked as missing if (grep /$status/, (1,2,3,7)) { - $missinglist =~ s/[,;]?\s?$serialseq//g; + #delete e.g. 3 not 31: therefore check what is before/after + $missinglist =~ s/(^|\s|[,;])$serialseq(?=[,;\s]|$)//g; + #cleanup the ; mess :) + $missinglist =~ s/[,;\s]+/;/g; + $missinglist =~ s/^[,;\s]+|[,;\s]+$//; } # warn "missinglist : $missinglist serialseq :$serialseq, ".index("$missinglist","$serialseq"); $missinglist .= "; $serialseq" -- 1.7.7.6