Bugzilla – Attachment 27163 Details for
Bug 11630
AgeRestrictionMarker doesn't handle marker immediately followed by age
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Improve AgeRestrictionMarker to consider the case where the marker is immediately followed by the age, eg. "K16" in Finland.
Improve-AgeRestrictionMarker-to-consider-the-case-.patch (text/plain), 2.67 KB, created by
Jonathan Druart
on 2014-04-16 10:56:51 UTC
(
hide
)
Description:
Improve AgeRestrictionMarker to consider the case where the marker is immediately followed by the age, eg. "K16" in Finland.
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-04-16 10:56:51 UTC
Size:
2.67 KB
patch
obsolete
>From 45ee2d6c165f0e70966a6a837c27989b1de8e0d9 Mon Sep 17 00:00:00 2001 >From: Pasi Kallinen <pasi.kallinen@pttk.fi> >Date: Wed, 29 Jan 2014 09:37:18 +0200 >Subject: [PATCH] Improve AgeRestrictionMarker to consider the case where the > marker is immediately followed by the age, eg. "K16" in > Finland. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >How I tested: >Configure Age Restricition (see Syspref AgeRestrictionMarker) and have a biblio record with e.g. PEGI 99 in age restriction field >Try to check out to a patron with age < 99 >Check out should be blocked >Change entry in age restriction field to PEGI99 >Checkout should be possible >Apply patch >Checkout schould now be blocked > >Patch behaves as expected > >http://bugs.koha-community.org/show_bug.cgi?id=11630 >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Circulation.pm | 25 ++++++++++++------------- > 1 file changed, 12 insertions(+), 13 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 91056e5..cddab0a 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -982,30 +982,29 @@ sub CanBookBeIssued { > if (($markers)&&($bibvalues)) > { > # Split $bibvalues to something like FSK 16 or PEGI 6 >- my @values = split ' ', $bibvalues; >+ my @values = split ' ', uc($bibvalues); > > # Search first occurence of one of the markers >- my @markers = split /\|/, $markers; >+ my @markers = split /\|/, uc($markers); > my $index = 0; >- my $take = -1; >+ my $restrictionyear = 0; > for my $value (@values) { > $index ++; > for my $marker (@markers) { > $marker =~ s/^\s+//; #remove leading spaces > $marker =~ s/\s+$//; #remove trailing spaces >- if (uc($marker) eq uc($value)) { >- $take = $index; >+ if ($marker eq $value) { >+ if ($index <= $#values) { >+ $restrictionyear += $values[$index]; >+ } >+ last; >+ } elsif ($value =~ /^\Q$marker\E(\d+)$/) { >+ # Perhaps it is something like "K16" (as in Finland) >+ $restrictionyear += $1; > last; > } > } >- if ($take > -1) { >- last; >- } >- } >- # Index points to the next value >- my $restrictionyear = 0; >- if (($take <= $#values) && ($take >= 0)){ >- $restrictionyear += $values[$take]; >+ last if ($restrictionyear > 0); > } > > if ($restrictionyear > 0) { >-- >1.7.10.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 11630
:
24857
|
26996
|
27089
|
27156
| 27163 |
27164
|
27165