Bugzilla – Attachment 67043 Details for
Bug 19277
TT syntax - Data is not ordered in notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19277: TT syntax - Display ordered data
Bug-19277-TT-syntax---Display-ordered-data.patch (text/plain), 2.31 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-09-11 14:21:00 UTC
(
hide
)
Description:
Bug 19277: TT syntax - Display ordered data
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-09-11 14:21:00 UTC
Size:
2.31 KB
patch
obsolete
>From bc79a4200186c36aea6689170ef139afe84f98d4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 8 Sep 2017 09:38:28 -0300 >Subject: [PATCH] Bug 19277: TT syntax - Display ordered data > >This issue has been highlighted by a failing test: ISSUESLIP displays checkouts in random order > >I thought it was because of dates comparison, but it comes from the following line in C4::Letters::_get_tt_params > my $objects = $module->search( { $key => { -in => $values } } ); > >The DBMS will return data like there is ordered in the DB. >For instance: > select borrowernumber from borrowers where borrowernumber in (5, 3, 1); >or > select borrowernumber from borrowers where borrowernumber=5 or borrowernumber=3 or borrowernumber=1; > >will return 1, 3, 5 > >I did not find a generic way to do that, so used "ORDER BY FIELD" which will not be portable. > >Test plan: >If you do not apply this patch, the tests will sometime fail > >Signed-off-by: Lee Jamison <ldjamison@marywood.edu> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Letters.pm | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 759594e..3f23090 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1596,7 +1596,18 @@ sub _get_tt_params { > croak "ERROR processing table $table. Wrong API call."; > } > my $key = $pk ? $pk : $fk; >- my $objects = $module->search( { $key => { -in => $values } } ); >+ # $key does not come from user input >+ my $objects = $module->search( >+ { $key => $values }, >+ { >+ # We want to retrieve the data in the same order >+ # FIXME MySQLism >+ # field is a MySQLism, but they are no other way to do it >+ # To be generic we could do it in perl, but we will need to fetch >+ # all the data then order them >+ @$values ? ( order_by => \[ "field($key, " . join( ', ', @$values ) . ")" ] ) : () >+ } >+ ); > $params->{ $config->{$table}->{plural} } = $objects; > } > elsif ( $ref eq q{} || $ref eq 'HASH' ) { >-- >2.7.4
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 19277
:
66985
|
66986
|
67000
|
67001
| 67043 |
67044