Bugzilla – Attachment 98338 Details for
Bug 18936
Move issuingrules into circulation_rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18936: Fix IssuingRules/guess_article_requestable_itemtypes.t
Bug-18936-Fix-IssuingRulesguessarticlerequestablei.patch (text/plain), 3.86 KB, created by
Jonathan Druart
on 2020-02-03 16:09:14 UTC
(
hide
)
Description:
Bug 18936: Fix IssuingRules/guess_article_requestable_itemtypes.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-02-03 16:09:14 UTC
Size:
3.86 KB
patch
obsolete
>From 3e0d505547bafb621bcc2150737bdd73dbf6c2b8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 28 Jan 2020 16:47:39 +0100 >Subject: [PATCH] Bug 18936: Fix > IssuingRules/guess_article_requestable_itemtypes.t >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi> > >Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> >--- > Koha/CirculationRules.pm | 2 +- > .../guess_article_requestable_itemtypes.t | 33 +++++++++++----------- > 2 files changed, 18 insertions(+), 17 deletions(-) > >diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm >index 1e50251fa7..3e54740097 100644 >--- a/Koha/CirculationRules.pm >+++ b/Koha/CirculationRules.pm >@@ -481,7 +481,7 @@ sub guess_article_requestable_itemtypes { > }); > return $res if !$rules; > foreach my $rule ( $rules->as_list ) { >- $res->{ $rule->itemtype } = 1; >+ $res->{ $rule->itemtype // '*' } = 1; > } > $last_article_requestable_guesses->{$key} = $res; > $cache->set_in_cache(GUESSED_ITEMTYPES_KEY, $last_article_requestable_guesses); >diff --git a/t/db_dependent/Koha/IssuingRules/guess_article_requestable_itemtypes.t b/t/db_dependent/Koha/IssuingRules/guess_article_requestable_itemtypes.t >index dc5203dfd5..f5c0f8aa9b 100644 >--- a/t/db_dependent/Koha/IssuingRules/guess_article_requestable_itemtypes.t >+++ b/t/db_dependent/Koha/IssuingRules/guess_article_requestable_itemtypes.t >@@ -21,28 +21,29 @@ subtest 'guess_article_requestable_itemtypes' => sub { > t::lib::Mocks::mock_preference('ArticleRequestsLinkControl', 'calc'); > $cache->clear_from_cache( Koha::CirculationRules::GUESSED_ITEMTYPES_KEY ); > Koha::CirculationRules->delete; >+ my $library = $builder->build_object({ class => 'Koha::Libraries' }); > my $itype1 = $builder->build_object({ class => 'Koha::ItemTypes' }); > my $itype2 = $builder->build_object({ class => 'Koha::ItemTypes' }); > my $catg1 = $builder->build_object({ class => 'Koha::Patron::Categories' }); > my $catg2 = $builder->build_object({ class => 'Koha::Patron::Categories' }); >- my $rule1 = $builder->build_object({ >- class => 'Koha::CirculationRules', >- value => { >- branchcode => 'MPL', # no worries: no FK >- categorycode => '*', >- itemtype => $itype1->itemtype, >- article_requests => 'bib_only', >+ my $rule1 = Koha::CirculationRules->set_rule( >+ { >+ branchcode => $library->branchcode, >+ categorycode => undef, >+ itemtype => $itype1->itemtype, >+ rule_name => 'article_requests', >+ rule_value => 'bib_only', > }, >- }); >- my $rule2 = $builder->build_object({ >- class => 'Koha::CirculationRules', >- value => { >- branchcode => '*', >+ ); >+ my $rule2 = Koha::CirculationRules->set_rule( >+ { >+ branchcode => undef, > categorycode => $catg1->categorycode, >- itemtype => $itype2->itemtype, >- article_requests => 'yes', >+ itemtype => $itype2->itemtype, >+ rule_name => 'article_requests', >+ rule_value => 'yes', > }, >- }); >+ ); > > my $res = Koha::CirculationRules->guess_article_requestable_itemtypes; > is( $res->{'*'}, undef, 'Item type * seems not permitted' ); >@@ -54,7 +55,7 @@ subtest 'guess_article_requestable_itemtypes' => sub { > is( $res->{$itype2->itemtype}, undef, 'Item type 2 seems not permitted' ); > > # Change the rules >- $rule2->itemtype('*')->store; >+ $rule2->itemtype(undef)->store; > $cache->clear_from_cache( Koha::CirculationRules::GUESSED_ITEMTYPES_KEY ); > $res = Koha::CirculationRules->guess_article_requestable_itemtypes; > is( $res->{'*'}, 1, 'Item type * seems permitted' ); >-- >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 18936
:
65247
|
65248
|
65249
|
67629
|
67758
|
68236
|
71034
|
71035
|
71036
|
71037
|
71038
|
71039
|
71040
|
71041
|
72230
|
72231
|
72232
|
72233
|
72234
|
72235
|
72236
|
72237
|
72238
|
91953
|
91954
|
91955
|
91956
|
91957
|
91958
|
91959
|
91960
|
91961
|
91962
|
91963
|
91964
|
91965
|
91966
|
91967
|
91968
|
91969
|
91970
|
91971
|
91972
|
91973
|
91974
|
91975
|
94179
|
94180
|
94181
|
94182
|
94183
|
94184
|
94185
|
94186
|
94187
|
94188
|
94189
|
94190
|
94191
|
94192
|
94193
|
94194
|
94195
|
94196
|
94197
|
94198
|
94199
|
94200
|
98299
|
98300
|
98301
|
98302
|
98303
|
98304
|
98305
|
98306
|
98307
|
98308
|
98309
|
98310
|
98311
|
98312
|
98313
|
98314
|
98315
|
98316
|
98317
|
98318
|
98319
|
98320
|
98321
|
98322
|
98323
|
98324
|
98325
|
98326
|
98327
|
98328
|
98329
|
98330
|
98331
|
98332
|
98333
|
98334
|
98335
|
98336
|
98337
| 98338 |
98339
|
98340
|
98341
|
98342
|
98343
|
98344
|
98345
|
98346
|
98347
|
98407
|
98408