From 1c1d4c2f75e3fb2b5c52175bde739a834ba80777 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 24 Sep 2021 12:19:12 +0100 Subject: [PATCH] Bug 29105: Add effective_itemtype handling for Item API --- Koha/Item.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Koha/Item.pm b/Koha/Item.pm index 60d80a5c3eb..98d154badea 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1104,6 +1104,20 @@ sub _set_found_trigger { return $self; } +=head3 to_api + +Overloaded to_api method to ensure item-level itypes is adhered to. + +=cut + +sub to_api { + my ($self, $params) = @_; + + $self->iteype( $self->effective_itemtype ); + $self->notforloan( $self->itemtype->notforloan ) unless $self->notforloan; + return $self->SUPER::to_api($params); +} + =head3 to_api_mapping This method returns the mapping for representing a Koha::Item object -- 2.20.1