@@ -, +, @@ --- Koha/Checkouts/ReturnClaims.pm | 2 +- Koha/Item.pm | 17 +++++++++++++++++ api/v1/swagger/definitions/item.yaml | 8 ++++++++ api/v1/swagger/paths/items.yaml | 3 +++ .../prog/en/modules/catalogue/detail.tt | 18 +++++++++++++----- 5 files changed, 42 insertions(+), 6 deletions(-) --- a/Koha/Checkouts/ReturnClaims.pm +++ a/Koha/Checkouts/ReturnClaims.pm @@ -60,7 +60,7 @@ sub resolved { return Koha::Checkouts::ReturnClaims->_new_from_dbic( $results ); } -=head3 type +=head3 _type =cut --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -418,6 +418,23 @@ sub return_claims { return Koha::Checkouts::ReturnClaims->_new_from_dbic( $claims_rs ); } +=head3 return_claim + + my $return_claim = $item->return_claim; + +Returns the most recent unresolved return_claims associated with this item + +=cut + +sub return_claim { + my ( $self ) = @_; + my $claims_rs = + $self->_result->return_claims->search( { resolution => undef }, + { order_by => { '-desc' => 'created_on' } } )->single; + return unless $claims_rs; + return Koha::Checkouts::ReturnClaim->_new_from_dbic( $claims_rs ); +} + =head3 holds my $holds = $item->holds(); --- a/api/v1/swagger/definitions/item.yaml +++ a/api/v1/swagger/definitions/item.yaml @@ -212,6 +212,14 @@ properties: exclude_from_local_holds_priority: type: boolean description: Exclude this item from local holds priority. + return_claims: + type: array + description: An array of all return claims associated with this item + return_claim: + type: + - object + - "null" + description: A return claims object if one exists that's unresolved additionalProperties: false required: - item_id --- a/api/v1/swagger/paths/items.yaml +++ a/api/v1/swagger/paths/items.yaml @@ -201,6 +201,9 @@ x-koha-embed: - biblio - checkout + - return_claims + - return_claim + - return_claim.patron /items/{item_id}/bundled_items/{bundled_item_id}: delete: x-mojo-to: Items#remove_from_bundle --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -1381,6 +1381,7 @@ Note that permanent location is a code, and location may be an authval. [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] [% INCLUDE 'columns_settings.inc' %] [% INCLUDE 'js-date-format.inc' %] + [% INCLUDE 'js-patron-format.inc' %] [% Asset.js("js/browser.js") | $raw %] [% Asset.js("js/table_filters.js") | $raw %]