Bug 20469: Remove effective parameter
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 27 Jul 2020 13:34:21 +0000 (13:34 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 18 Aug 2020 15:39:48 +0000 (17:39 +0200)
Test plan:
Run test Koha/Item.t again

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Koha/Item.pm
t/db_dependent/Koha/Item.t

index 2d66448..8602b9a 100644 (file)
@@ -822,15 +822,15 @@ sub to_api_mapping {
 
 =head3 itemtype
 
-    my $itemtype = $item->itemtype({ effective => 1 });
+    my $itemtype = $item->itemtype;
 
-    Returns Koha object for (effective) itemtype
+    Returns Koha object for effective itemtype
 
 =cut
 
 sub itemtype {
-    my ( $self, $params ) = @_;
-    return Koha::ItemTypes->find( $params->{effective} ?  $self->effective_itemtype : $self->itype ); # no FK
+    my ( $self ) = @_;
+    return Koha::ItemTypes->find( $self->effective_itemtype );
 }
 
 =head2 Internal methods
index e8852ff..44cd0b8 100644 (file)
@@ -504,7 +504,7 @@ subtest 'renewal_branchcode' => sub {
 };
 
 subtest 'Tests for itemtype' => sub {
-    plan tests => 4;
+    plan tests => 2;
     $schema->storage->txn_begin;
 
     my $biblio = $builder->build_sample_biblio;
@@ -512,11 +512,9 @@ subtest 'Tests for itemtype' => sub {
     my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, itype => $itemtype->itemtype });
 
     t::lib::Mocks::mock_preference('item-level_itypes', 1);
-    is( $item->itemtype({ effective => 1 })->itemtype, $item->itype, 'Pref enabled, effective parameter' );
-    is( $item->itemtype->itemtype, $item->itype, 'Pref enabled, no parameter' );
+    is( $item->itemtype->itemtype, $item->itype, 'Pref enabled' );
     t::lib::Mocks::mock_preference('item-level_itypes', 0);
-    is( $item->itemtype({ effective => 1 })->itemtype, $biblio->biblioitem->itemtype, 'Pref disabled, effective parameter' );
-    is( $item->itemtype->itemtype, $item->itype, 'Pref disabled, no parameter' );
+    is( $item->itemtype->itemtype, $biblio->biblioitem->itemtype, 'Pref disabled' );
 
     $schema->storage->txn_rollback;
 };