Bugzilla – Attachment 102686 Details for
Bug 24903
Special characters like parentheses in numbering pattern cause duplication in recievedlist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24903: Special characters like parentheses in numbering pattern cause duplication in recievedlist
Bug-24903-Special-characters-like-parentheses-in-n.patch (text/plain), 3.07 KB, created by
Biblibre Sandboxes
on 2020-04-10 09:29:40 UTC
(
hide
)
Description:
Bug 24903: Special characters like parentheses in numbering pattern cause duplication in recievedlist
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2020-04-10 09:29:40 UTC
Size:
3.07 KB
patch
obsolete
>From 65f916a73531e86a742cbd63a7344ebdf07eb87e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <mdry@live.nl> >Date: Thu, 19 Mar 2020 14:20:38 +0100 >Subject: [PATCH] Bug 24903: Special characters like parentheses in numbering > pattern cause duplication in recievedlist > >Test plan: >Use serial with a numbering pattern with parentheses like "2018 (No. 1)". >Mark serial issue as arrived, check receivedlist on summary. >Edit issue again, check if not duplicated on receivedlist. >Mark issue as missing or not available, check missinglist. >Mark missing issue as not missing, check list again. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Laurence Rault <laurence.rault@biblibre.com> >--- > C4/Serials.pm | 29 ++++++++++++++++++++++------- > 1 file changed, 22 insertions(+), 7 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 3315959..1c2840e 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1119,19 +1119,16 @@ sub ModSerialStatus { > my ( $missinglist, $recievedlist ) = $sth->fetchrow; > > if ( $status == ARRIVED || ($oldstatus == ARRIVED && $status != ARRIVED) ) { >- $recievedlist .= "; $serialseq" >- if ($recievedlist !~ /(^|;)\s*$serialseq(?=;|$)/); >+ $recievedlist = _handle_seqno($serialseq, $recievedlist); > } > > # in case serial has been previously marked as missing > if (grep /$status/, (EXPECTED, ARRIVED, LATE, CLAIMED)) { >- $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >+ $missinglist = _handle_seqno($serialseq, $missinglist, 'REMOVE'); > } > >- $missinglist .= "; $serialseq" >- if ( ( grep { $_ == $status } ( MISSING_STATUSES ) ) && ( $missinglist !~/(^|;)\s*$serialseq(?=;|$)/ ) ); >- $missinglist .= "; not issued $serialseq" >- if ( $status == NOT_ISSUED && $missinglist !~ /(^|;)\s*$serialseq(?=;|$)/ ); >+ $missinglist = _handle_seqno($serialseq, $missinglist) if grep { $_ == $status } MISSING_STATUSES; >+ $missinglist .= "; not issued $serialseq" if $status == NOT_ISSUED and not _handle_seqno($serialseq, $missinglist, 'CHECK'); > > $query = "UPDATE subscriptionhistory SET recievedlist=?, missinglist=? WHERE subscriptionid=?"; > $sth = $dbh->prepare($query); >@@ -1174,6 +1171,24 @@ sub ModSerialStatus { > return; > } > >+sub _handle_seqno { >+# Adds or removes seqno from list when needed; returns list >+# Or checks and returns true when present >+ >+ my ( $seq, $list, $op ) = @_; # op = ADD | REMOVE | CHECK (default: ADD) >+ my $seq_r = $seq; >+ $seq_r =~ s/([()])/\\$1/g; # Adjust disturbing parentheses for regex, maybe extend in future >+ >+ if( !$op or $op eq 'ADD' ) { >+ $list .= "; $seq" if $list !~ /(^|;)\s*$seq_r(?=;|$)/; >+ } elsif( $op eq 'REMOVE' ) { >+ $list=~ s/(^|;)\s*(not issued )?$seq_r(?=;|$)//g; >+ } else { # CHECK >+ return $list =~ /(^|;)\s*$seq_r(?=;|$)/ ? 1 : q{}; >+ } >+ return $list; >+} >+ > =head2 GetNextExpected > > $nextexpected = GetNextExpected($subscriptionid) >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24903
:
101024
|
101025
|
102686
|
102687
|
102776
|
102777