Bugzilla – Attachment 174190 Details for
Bug 38130
Cannot filter items on library name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38130: Allow sorting and filtering on library id and name
Bug-38130-Allow-sorting-and-filtering-on-library-i.patch (text/plain), 5.00 KB, created by
Pedro Amorim
on 2024-11-07 12:44:07 UTC
(
hide
)
Description:
Bug 38130: Allow sorting and filtering on library id and name
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-11-07 12:44:07 UTC
Size:
5.00 KB
patch
obsolete
>From 61ebe5517fcd26fc5946fbc20ac2c4e55d0d4575 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 7 Nov 2024 09:40:03 +0100 >Subject: [PATCH] Bug 38130: Allow sorting and filtering on library id and name > >On the item list of the bib detail page and the patron search we want >the library columns ('holding library', 'home library' and 'library') to >be sorted by library names and to make them searchable on library id and >name. > >Concerns about this approach (comment #8): >""" >If we do it for the library names on this view, we need to do it for all the library columns (thinking about patrons right now but I am sure there are others). And to be consistent, for all the other coded values: "special AVs" (item types, cn source), regular AVs, patron category codes, etc. > >We will introduce additional JOINs and so maybe performance problems. This needs to be investigated before we take this route IMO. >""" > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >--- > Koha/Patron.pm | 2 +- > Koha/Schema/Result/Borrower.pm | 7 +++++++ > .../html_helpers/tables/items/catalogue_detail.inc | 4 ++-- > .../intranet-tmpl/prog/en/includes/patron-search.inc | 9 ++++----- > 4 files changed, 14 insertions(+), 8 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index bc031f8bcf..26ba7a24df 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -505,7 +505,7 @@ Returns a Koha::Library object representing the patron's home library. > > sub library { > my ( $self ) = @_; >- return Koha::Library->_new_from_dbic($self->_result->branchcode); >+ return Koha::Library->_new_from_dbic($self->_result->library); > } > > =head3 sms_provider >diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm >index bf8ba36030..fddaf77201 100644 >--- a/Koha/Schema/Result/Borrower.pm >+++ b/Koha/Schema/Result/Borrower.pm >@@ -2191,6 +2191,13 @@ __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); > # Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-05-02 11:36:36 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jUOMoSonNmA3KwtZKVxqOA > >+__PACKAGE__->belongs_to( >+ "library", >+ "Koha::Schema::Result::Branch", >+ { branchcode => "branchcode" }, >+ { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, >+); >+ > __PACKAGE__->has_many( > "restrictions", > "Koha::Schema::Result::BorrowerDebarment", >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 eb7ac8e0ea..c115c12322 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 >@@ -372,7 +372,7 @@ > }, > [% END %] > { >- data: "me.holding_library_id:holding_library.name", >+ data: "holding_library.name:me.holding_library_id", > className: "location", > searchable: true, > orderable: true, >@@ -381,7 +381,7 @@ > } > }, > { >- data: "me.home_library_id:home_library.name", >+ data: "home_library.name:me.home_library_id", > className: "homebranch", > searchable: true, > orderable: true, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index d2eef529c7..16fc58b7d1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -575,15 +575,14 @@ > } > [% CASE 'branch' %] > { >- "data": "library_id", >+ "data": "library.name:me.library_id", > "searchable": true, > "orderable": true, > "render": function( data, type, row, meta ) { >- let library_name = libraries_map[data].branchname >- if( !singleBranchMode && data == logged_in_library_id ) { >- return "<span class=\"currentlibrary\">" + escape_str(library_name) + "</span>"; >+ if( !singleBranchMode && row.library.library_id == logged_in_library_id ) { >+ return "<span class=\"currentlibrary\">" + escape_str(row.library.name) + "</span>"; > } else { >- return escape_str(library_name); >+ return escape_str(row.library.name); > } > } > } >-- >2.39.5
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 38130
:
172559
|
172574
|
172578
|
174103
|
174189
| 174190