Bugzilla – Attachment 80346 Details for
Bug 15836
Labels: Offer configuration option for splitting call numbers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15836: Handle non-existent regexs
Bug-15836-Handle-non-existent-regexs.patch (text/plain), 2.08 KB, created by
PTFS Europe Sandboxes
on 2018-10-10 13:15:11 UTC
(
hide
)
Description:
Bug 15836: Handle non-existent regexs
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2018-10-10 13:15:11 UTC
Size:
2.08 KB
patch
obsolete
>From cc731cd0ea38895c31c647c344e93c4aa070949d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 27 Jul 2018 09:59:02 -0300 >Subject: [PATCH] Bug 15836: Handle non-existent regexs >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >For other types of split rules > >Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> >--- > Koha/ClassSplitRule.pm | 2 +- > t/db_dependent/Koha/ClassSplitRules.t | 8 ++++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/Koha/ClassSplitRule.pm b/Koha/ClassSplitRule.pm >index 0505120abb..72f467399d 100644 >--- a/Koha/ClassSplitRule.pm >+++ b/Koha/ClassSplitRule.pm >@@ -64,7 +64,7 @@ sub regexs { > my ( $self, $regexs ) = @_; > return $regexs > ? $self->split_regex( to_json($regexs) ) >- : from_json( $self->split_regex ); >+ : from_json( $self->split_regex || '[]' ); > } > > =head3 type >diff --git a/t/db_dependent/Koha/ClassSplitRules.t b/t/db_dependent/Koha/ClassSplitRules.t >index 4f79707516..2224dcc17e 100644 >--- a/t/db_dependent/Koha/ClassSplitRules.t >+++ b/t/db_dependent/Koha/ClassSplitRules.t >@@ -28,7 +28,7 @@ use t::lib::TestBuilder; > my $schema = Koha::Database->new->schema; > > subtest 'store + regexs' => sub { >- plan tests => 1; >+ plan tests => 2; > $schema->storage->txn_begin; > > my @regexs = ('s/\s/\n/g', 's/(\s?=)/\n=/g', 's/^(J|K)\n/$1 /'); >@@ -37,11 +37,15 @@ subtest 'store + regexs' => sub { > class_split_rule => 'split_rule', > description => 'a_split_test_1', > split_routine => 'regex', >- regexs => \@regexs, > } > )->store; > > $rule = Koha::ClassSplitRules->find("split_rule"); >+ is_deeply($rule->regexs, [], '->regexs return an empty array when no regex is defined'); >+ >+ $rule->regexs(\@regexs)->store; >+ >+ $rule = Koha::ClassSplitRules->find("split_rule"); > is_deeply($rule->regexs, \@regexs, '->new and ->regexs correctly serialized/deserialized the regexs'); > > $schema->storage->txn_rollback; >-- >2.11.0
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 15836
:
76691
|
76692
|
76693
|
76694
|
76695
|
76696
|
77061
|
77079
|
77306
|
78791
|
78793
|
78795
|
78796
|
78798
|
78799
|
79029
|
80339
|
80340
|
80341
|
80342
|
80343
|
80344
|
80345
|
80346
|
80347
|
80548
|
80549
|
80550
|
80551
|
80552
|
80553
|
80554
|
80555
|
80556
|
81033
|
81034
|
81035
|
81036
|
81037
|
81038
|
81039
|
81040
|
81041
|
81627
|
81628
|
81629
|
81630
|
81631
|
81632
|
81633
|
81634
|
81635
|
82110
|
82112
|
82113
|
82118
|
82119
|
82120
|
82289
|
82290
|
82291
|
82292
|
82293
|
82294
|
82295
|
82296
|
82297
|
82298
|
82299
|
82300
|
82301
|
82302
|
82317
|
82318
|
82319
|
82321