Bugzilla – Attachment 118360 Details for
Bug 27933
Order patron search broken (dateofbirth, cardnumber, expirationdate)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27933: [ALTERNATIVE PATCH] Fix patron search result ordering
Bug-27933-ALTERNATIVE-PATCH-Fix-patron-search-resu.patch (text/plain), 1.98 KB, created by
Jonathan Druart
on 2021-03-17 09:18:53 UTC
(
hide
)
Description:
Bug 27933: [ALTERNATIVE PATCH] Fix patron search result ordering
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-03-17 09:18:53 UTC
Size:
1.98 KB
patch
obsolete
>From 2f59ccfc99fae00556ce73d67db761192480bcb1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 17 Mar 2021 09:43:49 +0100 >Subject: [PATCH] Bug 27933: [ALTERNATIVE PATCH] Fix patron search result > ordering > >--- > C4/Utils/DataTables.pm | 4 ++-- > t/db_dependent/Utils/Datatables.t | 12 +++++++++++- > 2 files changed, 13 insertions(+), 3 deletions(-) > >diff --git a/C4/Utils/DataTables.pm b/C4/Utils/DataTables.pm >index 6e1af15611..a2f62dc447 100644 >--- a/C4/Utils/DataTables.pm >+++ b/C4/Utils/DataTables.pm >@@ -104,8 +104,8 @@ sub dt_build_orderby { > > return unless @orderbys; > >- # Must be "branches.branchname asc", "borrowers.firstname desc", etc. >- @orderbys = grep { /^\w+\.\w+ (asc|desc)$/ } @orderbys; >+ # Must be "branches.branchname asc", "borrowers.firstname desc", "dateofbirth asc" etc. >+ @orderbys = grep { /^\w*\.?\w+ (asc|desc)$/ } @orderbys; > > my @sanitized_orderbys; > for my $orderby (@orderbys) { >diff --git a/t/db_dependent/Utils/Datatables.t b/t/db_dependent/Utils/Datatables.t >index ae0c61bc4e..7f6dde40d4 100755 >--- a/t/db_dependent/Utils/Datatables.t >+++ b/t/db_dependent/Utils/Datatables.t >@@ -32,7 +32,7 @@ $schema->storage->txn_begin; > my $builder = t::lib::TestBuilder->new; > > subtest 'dt_build_orderby' => sub { >- plan tests => 2; >+ plan tests => 3; > > my $dt_params = { > iSortCol_0 => 5, >@@ -58,4 +58,14 @@ subtest 'dt_build_orderby' => sub { > > $orderby = dt_build_orderby($dt_params); > is( $orderby, " ORDER BY `branches`.`branchname` ASC,`borrowers`.`surname` DESC,`borrowers`.`firstname` DESC ", 'ORDER BY has been correctly built, even with invalid stuff'); >+ >+ $dt_params = { >+ iSortCol_0 => 1, >+ sSortDir_0 => "asc", >+ mDataProp_1 => "dateofbirth", >+ name_sorton => "dateofbirth asc", >+ }; >+ >+ $orderby = dt_build_orderby($dt_params); >+ is( $orderby, " ORDER BY `dateofbirth` ASC ", 'ORDER BY has been correctly built' ); > }; >-- >2.20.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 27933
:
118359
|
118360
|
118413
|
118457