Bugzilla – Attachment 49102 Details for
Bug 11998
Syspref caching issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11998: Use C4::Context->preference in Koha/Schema/Result/Item.pm
Bug-11998-Use-C4Context-preference-in-KohaSchemaRe.patch (text/plain), 2.45 KB, created by
Jacek Ablewicz
on 2016-03-14 15:22:01 UTC
(
hide
)
Description:
Bug 11998: Use C4::Context->preference in Koha/Schema/Result/Item.pm
Filename:
MIME Type:
Creator:
Jacek Ablewicz
Created:
2016-03-14 15:22:01 UTC
Size:
2.45 KB
patch
obsolete
>From 8f51e3a119281a8b5ef7045dac177bf3736603d9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 4 Mar 2016 13:21:39 +0000 >Subject: [PATCH] Bug 11998: Use C4::Context->preference in > Koha/Schema/Result/Item.pm > >Otherwise some tests won't pass > >Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar> >Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl> >--- > Koha/Schema/Result/Item.pm | 7 ++++--- > t/db_dependent/Items.t | 4 ++-- > 2 files changed, 6 insertions(+), 5 deletions(-) > >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index c3c4b33..36e1e91 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -652,15 +652,16 @@ __PACKAGE__->belongs_to( > { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, > ); > >+use C4::Context; > sub effective_itemtype { > my ( $self ) = @_; > >- my $pref = $self->result_source->schema->resultset('Systempreference')->find('item-level_itypes'); >- if ( $pref->value() && $self->itype() ) { >+ my $pref = C4::Context->preference('item-level_itypes'); >+ if ( $pref && $self->itype() ) { > return $self->itype(); > } else { > warn "item-level_itypes set but no itemtype set for item ($self->itemnumber)" >- if $pref->value(); >+ if $pref; > return $self->biblioitemnumber()->itemtype(); > } > } >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 5f8dac3..5df6eb5 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -245,10 +245,10 @@ subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { > my ( $item ) = $bi[0]->items(); > > t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); >- ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' ); >+ is( $item->effective_itemtype(), 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' ); > > t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); >- ok( $item->effective_itemtype() eq 'ITEM_LEVEL', '$item->itemtype() returns items.itype when item-level_itypes is enabled' ); >+ is( $item->effective_itemtype(), 'ITEM_LEVEL', '$item->itemtype() returns items.itype when item-level_itypes is enabled' ); > > # If itemtype is not defined and item-level_level item types are set > # fallback to biblio-level itemtype (Bug 14651) and warn >-- >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 11998
:
26575
|
26621
|
26714
|
26716
|
26717
|
27382
|
31801
|
31802
|
32870
|
32871
|
32872
|
32873
|
32874
|
33183
|
33447
|
33670
|
33671
|
33685
|
33724
|
33725
|
33746
|
33829
|
33940
|
36523
|
36524
|
36525
|
36526
|
36527
|
36528
|
36529
|
36530
|
36531
|
36532
|
36533
|
36534
|
36571
|
36583
|
36584
|
36585
|
36586
|
36587
|
36588
|
36589
|
36590
|
36591
|
36592
|
36593
|
36594
|
36595
|
48640
|
48652
|
48655
|
48687
|
48688
|
48727
|
48758
|
48928
|
48929
|
48930
|
48931
|
48932
|
48933
|
48934
|
48935
|
48936
|
48961
|
49022
|
49023
|
49024
|
49025
|
49026
|
49027
|
49028
|
49029
|
49030
|
49100
|
49101
| 49102 |
49103
|
49104
|
49105
|
49106
|
49107
|
49108