Bugzilla – Attachment 21917 Details for
Bug 8015
Add MARC Modifications Templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8015: Get rid of eval for evaluating =~ m//
Bug-8015-Get-rid-of-eval-for-evaluating--m.patch (text/plain), 4.33 KB, created by
Bernardo Gonzalez Kriegel
on 2013-10-09 14:28:21 UTC
(
hide
)
Description:
Bug 8015: Get rid of eval for evaluating =~ m//
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2013-10-09 14:28:21 UTC
Size:
4.33 KB
patch
obsolete
>From fffa61fa7b8be3b3ce72c1f983b2fffb0e99adfa Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 26 Sep 2013 14:15:15 +0200 >Subject: [PATCH] Bug 8015: Get rid of eval for evaluating =~ m// > >Koha::SimpleMarc::field_equals uses eval in order to check if a string >matches a pattern. >Now this eval is removed and the "regex" variable does not contain the >regex separated character (/ or |). > >Regression: Before this patch, the user was able to user a modifier. Now >it is not possible. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >--- > Koha/SimpleMARC.pm | 2 +- > .../modules/tools/marc_modification_templates.tt | 12 ++++++++---- > t/db_dependent/MarcModificationTemplates.t | 2 +- > 3 files changed, 10 insertions(+), 6 deletions(-) > >diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm >index e78fc92..94f6ab1 100644 >--- a/Koha/SimpleMARC.pm >+++ b/Koha/SimpleMARC.pm >@@ -239,7 +239,7 @@ sub field_equals { > > if ( $regex ) { > C4::Koha::Log( "Testing '$field_value' =~ m$value" ) if $debug >= 3; >- return eval "\$field_value =~ m$value"; >+ return $field_value =~ m/$value/; > } else { > return $field_value eq $value; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >index 85c983b..f3538ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >@@ -9,6 +9,8 @@ $(document).ready(function() { > $('#select_template').change(function() { > $('#select_template').submit(); > }); >+ $("span.match_regex_prefix" ).hide(); >+ $("span.match_regex_suffix" ).hide(); > }); > //]]> > </script> >@@ -97,9 +99,11 @@ function onToFieldRegexChange( checkboxObj ) { > > function onConditionalRegexChange( checkboxObj ) { > if ( checkboxObj.checked ) { >- document.getElementById( 'match_regex_prefix' ).style.visibility='visible'; >+ $("span.match_regex_prefix" ).show(); >+ $("span.match_regex_suffix" ).show(); > } else { >- document.getElementById( 'match_regex_prefix' ).style.visibility='hidden'; >+ $("span.match_regex_prefix" ).hide(); >+ $("span.match_regex_suffix" ).hide(); > } > } > >@@ -346,7 +350,7 @@ function setSelectByValue( selectId, value ) { > [% IF ( ActionsLoo.conditional_comparison_equals ) %] matches [% END %] > [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %] > >- [% IF ( ActionsLoo.conditional_regex ) %] RegEx m[% END %]<strong>[% ActionsLoo.conditional_value %]</strong> >+ [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %]<strong>[% ActionsLoo.conditional_value %]/</strong> > [% END %] > </td> > <td>[% ActionsLoo.description %]</td> >@@ -438,7 +442,7 @@ function setSelectByValue( selectId, value ) { > > <span name="conditional_comparison_block" id="conditional_comparison_block" style="display:none;"> > >- <span id="match_regex_prefix" style="visibility:hidden;">m</span><input type="text" id="conditional_value" name="conditional_value" /> >+ <span class="match_regex_prefix">m/</span><input type="text" id="conditional_value" name="conditional_value" /><span class="match_regex_suffix">/</span> > > <sup> > <label for="conditional_regex">RegEx</label> >diff --git a/t/db_dependent/MarcModificationTemplates.t b/t/db_dependent/MarcModificationTemplates.t >index c31983e..ed2652d 100644 >--- a/t/db_dependent/MarcModificationTemplates.t >+++ b/t/db_dependent/MarcModificationTemplates.t >@@ -178,7 +178,7 @@ is( AddModificationTemplateAction( > $template_id, 'move_field', 0, > '952', 'd', '', > '952', 'e', '', >- 'if', '952', 'c', 'equals', '/^GEN/', '1', >+ 'if', '952', 'c', 'equals', '^GEN', '1', > 'Move field 952$d to 952$e if 952$c =~ /^GE/' > ), 1, 'Add fourth action: move field 952$d to 952$e if 952$c =~ /^GE/'); > >-- >1.7.9.5
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 8015
:
9313
|
9329
|
9330
|
9331
|
10089
|
11579
|
11607
|
11608
|
12280
|
12288
|
12569
|
12570
|
12571
|
12572
|
12839
|
12856
|
12857
|
12858
|
12859
|
12860
|
13121
|
13138
|
13495
|
14030
|
14031
|
14032
|
14033
|
14034
|
14035
|
14040
|
16330
|
16331
|
16332
|
16333
|
16334
|
16335
|
16363
|
16376
|
16377
|
16378
|
16379
|
16413
|
16415
|
16423
|
16455
|
16468
|
16470
|
16471
|
16472
|
16473
|
16475
|
16476
|
16477
|
16478
|
16479
|
16480
|
17036
|
17037
|
17038
|
18372
|
18441
|
21024
|
21025
|
21026
|
21027
|
21028
|
21029
|
21030
|
21031
|
21032
|
21033
|
21034
|
21035
|
21036
|
21037
|
21038
|
21371
|
21484
|
21485
|
21486
|
21487
|
21808
|
21809
|
21876
|
21901
|
21902
|
21903
|
21904
|
21905
|
21906
|
21907
|
21908
|
21909
|
21910
|
21911
|
21912
|
21913
|
21914
|
21915
|
21916
|
21917
|
21918
|
21919
|
21920
|
22185
|
22186
|
22187
|
22188
|
22189
|
22190
|
22284
|
22285
|
22290
|
22293
|
22392
|
22393
|
22394
|
22395
|
22396
|
22397
|
22398
|
22399
|
22400
|
22401