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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit e5b467e81f)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit cb9af9d0e6)

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This commit is contained in:
Marcel de Rooy 2013-04-11 12:48:26 +02:00 committed by Chris Cormack
parent ca21fa1454
commit 9619fde3e9
1 changed files with 5 additions and 8 deletions

View File

@ -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/^; //;