Bugzilla – Attachment 164349 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: Add search on home and holding library's names
Bug-33568-Add-search-on-home-and-holding-librarys-.patch (text/plain), 5.16 KB, created by
Jonathan Druart
on 2024-04-03 07:40:26 UTC
(
hide
)
Description:
Bug 33568: Add search on home and holding library's names
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-04-03 07:40:26 UTC
Size:
5.16 KB
patch
obsolete
>From 4ea503917c5f0806fc2b57a26fa8cd5737d6cb28 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 2 Jun 2023 09:36:11 +0200 >Subject: [PATCH] Bug 33568: Add search on home and holding library's names >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >QUESTION - Do we prefer this or a dropdown list in the column filter >header? > >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/Item.pm | 25 ++++++++++++++++++- > Koha/Schema/Result/Item.pm | 24 ++++++++++++++++++ > api/v1/swagger/definitions/item.yaml | 8 ++++++ > api/v1/swagger/paths/biblios.yaml | 2 ++ > .../tables/items/catalogue_detail.inc | 5 ++-- > 5 files changed, 61 insertions(+), 3 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 17f4ebfe597..aa242188764 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -385,8 +385,19 @@ sub effective_itemtype { > =cut > > sub home_branch { >- my ($self) = @_; >+ return shift->home_library(@_); >+} >+ >+=head3 home_library >+ >+my $library = $item->home_library > >+Return the Koha::Library object representing the home library >+ >+=cut >+ >+sub home_library { >+ my ($self) = @_; > my $hb_rs = $self->_result->homebranch; > > return Koha::Library->_new_from_dbic( $hb_rs ); >@@ -397,6 +408,18 @@ sub home_branch { > =cut > > sub holding_branch { >+ return shift->home_library(@_); >+} >+ >+=head3 holding_library >+ >+my $library = $item->holding_library >+ >+Return the Koha::Library object representing the holding library >+ >+=cut >+ >+sub holding_library { > my ($self) = @_; > > my $hb_rs = $self->_result->holdingbranch; >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index 8320ce4c761..84a0bb84055 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -995,6 +995,30 @@ __PACKAGE__->belongs_to( > { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, > ); > >+__PACKAGE__->belongs_to( >+ "holding_library", >+ "Koha::Schema::Result::Branch", >+ { branchcode => "holdingbranch" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "RESTRICT", >+ on_update => "CASCADE", >+ }, >+); >+ >+__PACKAGE__->belongs_to( >+ "home_library", >+ "Koha::Schema::Result::Branch", >+ { branchcode => "homebranch" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "RESTRICT", >+ on_update => "CASCADE", >+ }, >+); >+ > __PACKAGE__->add_columns( > '+bookable' => { is_boolean => 1 }, > '+exclude_from_local_holds_priority' => { is_boolean => 1 }, >diff --git a/api/v1/swagger/definitions/item.yaml b/api/v1/swagger/definitions/item.yaml >index 5dbde98c702..e74dc1b90f8 100644 >--- a/api/v1/swagger/definitions/item.yaml >+++ b/api/v1/swagger/definitions/item.yaml >@@ -230,6 +230,14 @@ properties: > type: > - object > - "null" >+ home_library: >+ type: >+ - object >+ - "null" >+ holding_library: >+ type: >+ - object >+ - "null" > cover_image_ids: > type: > - array >diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml >index 4e94d041283..24d64d0ed41 100644 >--- a/api/v1/swagger/paths/biblios.yaml >+++ b/api/v1/swagger/paths/biblios.yaml >@@ -423,6 +423,8 @@ > type: string > enum: > - +strings >+ - home_library >+ - holding_library > - biblio.title > - checkout > - checkout.patron >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >index 5b389c90f62..c3d1092930b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >@@ -179,6 +179,7 @@ > [%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] > let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; > let embed = ["+strings,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk,item_type"]; >+ embed.push('home_library', 'holding_library'); > [% IF Koha.Preference('LocalCoverImages') %] > embed.push('cover_image_ids'); > [% END %] >@@ -300,7 +301,7 @@ > }, > [% END %] > { >- data: "me.holding_library_id", >+ data: "me.holding_library_id:holding_library.name", > className: "location", > searchable: true, > orderable: true, >@@ -309,7 +310,7 @@ > } > }, > { >- data: "me.home_library_id", >+ data: "me.home_library_id:home_library.name", > className: "homebranch", > searchable: true, > orderable: true, >-- >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