Bugzilla – Attachment 164322 Details for
Bug 33568
Use the REST API to display items on the staff biblio detail view
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33568: Item groups
Bug-33568-Item-groups.patch (text/plain), 4.53 KB, created by
Jonathan Druart
on 2024-04-03 07:38:23 UTC
(
hide
)
Description:
Bug 33568: Item groups
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-04-03 07:38:23 UTC
Size:
4.53 KB
patch
obsolete
>From e98c202bc3a91b40c2652c356b15c435b67bc00b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 18 Apr 2023 09:57:03 +0200 >Subject: [PATCH] Bug 33568: Item groups >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >FIXME - we need tests, but I'd like to make sure there is no an easier >way to do this many to many things. Tomas? >Filter on the "Item group" column needs to be tested! > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Laurence Rault <laurence.rault@biblibre.com> >Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> >--- > 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(-) > >diff --git a/Koha/Biblio/ItemGroup/Item.pm b/Koha/Biblio/ItemGroup/Item.pm >index 67eca6e6a61..5e4a55e8bb8 100644 >--- a/Koha/Biblio/ItemGroup/Item.pm >+++ b/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 >diff --git a/Koha/Item.pm b/Koha/Item.pm >index ba261bfa006..6fa6bd7ae43 100644 >--- a/Koha/Item.pm >+++ b/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; >diff --git a/api/v1/swagger/definitions/item.yaml b/api/v1/swagger/definitions/item.yaml >index 6f4a9d12e80..5c9a0d230d4 100644 >--- a/api/v1/swagger/definitions/item.yaml >+++ b/api/v1/swagger/definitions/item.yaml >@@ -234,6 +234,10 @@ properties: > type: > - array > - "null" >+ item_group_item: >+ type: >+ - object >+ - "null" > _strings: > type: > - object >diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml >index 1277166a8b8..ff3edf6093a 100644 >--- a/api/v1/swagger/paths/biblios.yaml >+++ b/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" >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 f850a1df93b..ca5b0eddec3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/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 %] >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33568
:
151339
|
153791
|
164308
|
164309
|
164310
|
164311
|
164312
|
164313
|
164314
|
164315
|
164316
|
164317
|
164318
|
164319
|
164320
|
164321
|
164322
|
164323
|
164324
|
164325
|
164326
|
164327
|
164328
|
164329
|
164330
|
164331
|
164332
|
164333
|
164334
|
164335
|
164336
|
164337
|
164338
|
164339
|
164340
|
164341
|
164342
|
164343
|
164344
|
164345
|
164346
|
164347
|
164348
|
164349
|
164350
|
164351
|
164352
|
164353
|
164354
|
164355
|
164356
|
164358
|
164359
|
164360
|
164361
|
164362
|
164363
|
164364
|
164365
|
164366
|
164367
|
164368
|
164369
|
164370
|
164371
|
164372
|
164373
|
164374
|
164472
|
164480
|
164482
|
164483
|
164485
|
164528