Bug 11518: (follow-up) retrieve syspref value using DBIC
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 10 Apr 2014 17:46:34 +0000 (13:46 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 29 Apr 2014 15:06:06 +0000 (15:06 +0000)
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Koha/Schema/Result/Item.pm

index 6a1e0d2..fd50d15 100644 (file)
@@ -624,11 +624,11 @@ __PACKAGE__->belongs_to(
   { biblioitemnumber => "biblioitemnumber" },
 );
 
-use C4::Context;
 sub effective_itemtype {
     my ( $self ) = @_;
 
-    if ( C4::Context->preference('item-level_itypes') ) {
+    my $pref = $self->result_source->schema->resultset('Systempreference')->find('item-level_itypes');
+    if ( $pref->value() ) {
         return $self->itype();
     } else {
         return $self->biblioitem()->itemtype();