@@ -, +, @@ --- Koha/Biblio/ItemGroup/Item.pm | 14 ++++++++++++++ Koha/Item.pm | 8 ++++++++ api/v1/swagger/definitions/item.yaml | 4 ++++ api/v1/swagger/paths/biblios.yaml | 1 + .../prog/en/modules/catalogue/detail.tt | 13 ++++++++++--- 5 files changed, 37 insertions(+), 3 deletions(-) --- a/Koha/Biblio/ItemGroup/Item.pm +++ a/Koha/Biblio/ItemGroup/Item.pm @@ -19,12 +19,26 @@ use Modern::Perl; use base qw(Koha::Object); +use Koha::Biblio::ItemGroup; + =head1 NAME Koha::Biblio::ItemGroup::Item - Koha ItemGroup Item Object class =head1 API +=head2 Class methods + +=head3 item_group + +=cut + +sub item_group { + my ($self) = @_; + my $rs = $self->_result->item_group; + return Koha::Biblio::ItemGroup->_new_from_dbic($rs); +} + =head2 Internal methods =head3 _type --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -465,6 +465,14 @@ sub item_group { return $item_group; } +sub item_group_item { + my ( $self ) = @_; + my $rs = $self->_result->item_group_item; + return unless $rs; + return Koha::Biblio::ItemGroup::Item->_new_from_dbic($rs); +} + + =head3 return_claims my $return_claims = $item->return_claims; --- a/api/v1/swagger/definitions/item.yaml +++ a/api/v1/swagger/definitions/item.yaml @@ -234,6 +234,10 @@ properties: type: - array - "null" + item_group_item: + type: + - object + - "null" _strings: type: - object --- a/api/v1/swagger/paths/biblios.yaml +++ a/api/v1/swagger/paths/biblios.yaml @@ -424,6 +424,7 @@ enum: - +strings - cover_image_ids + - item_group_item.item_group.description collectionFormat: csv - $ref: "../swagger.yaml#/parameters/match" - $ref: "../swagger.yaml#/parameters/order_by" --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -2495,6 +2495,9 @@ [% IF Koha.Preference('LocalCoverImages') %] embed.push('cover_image_ids'); [% END %] + [% IF Koha.Preference('EnableItemGroups') %] + embed.push('item_group_item.item_group.description'); + [% END %] let table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %]; var items_table = $("#table_items").kohaTable({ ajax: { url: table_url }, @@ -2605,12 +2608,16 @@ }, [% IF Koha.Preference('EnableItemGroups') %] { - data: "", + data: "item_group_item.item_group.description", className: "item_group", - searchable: false, // FIXME + searchable: true, orderable: true, render: function (data, type, row, meta) { - return "item.item_group.description";// FIXME item.item_group.description + if ( row.item_group_item ) { + return row.item_group_item.item_group.description; + } else { + return ""; + } } }, [% END %] --