From c66032ba2c54ef0844df17910cc29998dd6595fe Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 25 Nov 2021 12:10:57 +0000 Subject: [PATCH] Bug 28854: Improve lost details display for bundle items This patch adds the return claim details to the bundle item status display on the catalogue details page. Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- 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(-) diff --git a/Koha/Checkouts/ReturnClaims.pm b/Koha/Checkouts/ReturnClaims.pm index c1c2b3bd44..1174cdd1a2 100644 --- a/Koha/Checkouts/ReturnClaims.pm +++ b/Koha/Checkouts/ReturnClaims.pm @@ -60,7 +60,7 @@ sub resolved { return Koha::Checkouts::ReturnClaims->_new_from_dbic( $results ); } -=head3 type +=head3 _type =cut diff --git a/Koha/Item.pm b/Koha/Item.pm index bf377bfe3d..e97867309f 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -455,6 +455,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' }, rows => 1 } )->single; + return unless $claims_rs; + return Koha::Checkouts::ReturnClaim->_new_from_dbic($claims_rs); +} + =head3 holds my $holds = $item->holds(); diff --git a/api/v1/swagger/definitions/item.yaml b/api/v1/swagger/definitions/item.yaml index b525c16484..22df7d4aad 100644 --- a/api/v1/swagger/definitions/item.yaml +++ b/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 diff --git a/api/v1/swagger/paths/items.yaml b/api/v1/swagger/paths/items.yaml index 38399e9908..7c947f6e3f 100644 --- a/api/v1/swagger/paths/items.yaml +++ b/api/v1/swagger/paths/items.yaml @@ -202,6 +202,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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 07674e2ef0..72316d385a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -1568,6 +1568,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 %]