From cd70da6bcff2aab911c11cfc6a8cfddeaed4ce68 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 28 Mar 2024 12:20:10 -0300 Subject: [PATCH] Bug 33568: POD fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomas Cohen Arazi Signed-off-by: Laurence Rault Signed-off-by: Emily Lamancusa Signed-off-by: Tomás Cohen Arazi --- Koha/Item.pm | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 0a955df7e5c..3e1447d2ffe 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -502,6 +502,14 @@ sub item_group { return $item_group; } +=head3 item_group_item + + my $item_group_item = $item->item_group_item; + +Return the item group for this item + +=cut + sub item_group_item { my ( $self ) = @_; my $rs = $self->_result->item_group_item; @@ -792,6 +800,23 @@ sub get_transfer { return Koha::Item::Transfer->_new_from_dbic($transfer) if $transfer; } +=head3 transfer + + my $transfer = $item->transfer; + +Returns the active transfer request. Returns I if no active transfer +is found. + +Note: Transfers are retrieved in a Modified FIFO (First In First Out) order +whereby the most recently sent, but not received, transfer will be returned +if it exists, otherwise the oldest unsatisfied transfer will be returned. + +This allows for transfers to queue, which is the case for stock rotation and +rotating collections where a manual transfer may need to take precedence but +we still expect the item to end up at a final location eventually. + +=cut + sub transfer { return shift->get_transfer(@_); } @@ -1078,6 +1103,14 @@ sub current_holds { return Koha::Holds->_new_from_dbic($hold_rs); } +=head3 first_hold + + my $first_hold = $item->first_hold; + +Returns the first I for the item. + +=cut + sub first_hold { my ( $self ) = @_; return $self->current_holds->next; @@ -1769,7 +1802,7 @@ sub to_api_mapping { my $itemtype = $item->itemtype; - Returns Koha object for effective itemtype +Returns Koha object for effective itemtype =cut @@ -1778,6 +1811,23 @@ sub itemtype { return Koha::ItemTypes->find( $self->effective_itemtype ); } + +=head3 item_type + + my $item_type = $item->item_type; + +Returns the effective I for the item. + +FIXME: it should either return the 'real item type' or undef if no item type +defined. And effective_itemtype should return... the effective itemtype. Right +now it returns an id... This is all inconsistent. And the API should make it clear +if the attribute is part of the resource, or a calculated value i.e. if the item +is not linked to an item type on its own, then the API response should contain +item_type: null! And the effective item type... be another attribute. I understand +that this complicates filtering, but some query trickery could do it in the controller. + +=cut + sub item_type { return shift->itemtype; } @@ -2389,6 +2439,16 @@ sub is_denied_renewal { return 0; } +=head3 analytics_count + + my $analytics_count = $item->analytics_count; + +Return the related analytic records count. + +It returns 0 if I is disabled. + +=cut + sub analytics_count { my ($self) = @_; return C4::Items::GetAnalyticsCount($self->itemnumber); -- 2.34.1