Bugzilla – Attachment 81263 Details for
Bug 21603
Incorrect GROUP BY clause in SearchCourses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21603: Remove incorrect GROUP BY from C4::CourseReserves
Bug-21603-Remove-incorrect-GROUP-BY-from-C4CourseR.patch (text/plain), 2.27 KB, created by
Marcel de Rooy
on 2018-10-26 10:00:38 UTC
(
hide
)
Description:
Bug 21603: Remove incorrect GROUP BY from C4::CourseReserves
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-10-26 10:00:38 UTC
Size:
2.27 KB
patch
obsolete
>From 43c3fb4d6bbb33757f1d33b3392d1902d7f651f9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 18 Oct 2018 18:00:15 -0300 >Subject: [PATCH] Bug 21603: Remove incorrect GROUP BY from C4::CourseReserves >Content-Type: text/plain; charset=utf-8 > >'koha_kohadev.c.department' isn't in GROUP BY > >Test plan: >Prove that the test fail without this patch and pass with this patch >applied (switch on the SQL modes) > >Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >--- > C4/CourseReserves.pm | 8 ++++---- > t/db_dependent/CourseReserves.t | 5 ++++- > 2 files changed, 8 insertions(+), 5 deletions(-) > >diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm >index 4586979..997f725 100644 >--- a/C4/CourseReserves.pm >+++ b/C4/CourseReserves.pm >@@ -966,9 +966,9 @@ sub SearchCourses { > my $enabled = $params{'enabled'} || '%'; > > my @params; >- my $query = "SELECT c.* FROM courses c"; >- >- $query .= " >+ my $query = " >+ SELECT c.course_id, c.department, c.course_number, c.section, c.course_name, c.term, c.staff_note, c.public_note, c.students_count, c.enabled, c.timestamp >+ FROM courses c > LEFT JOIN course_instructors ci > ON ( c.course_id = ci.course_id ) > LEFT JOIN borrowers b >@@ -992,7 +992,7 @@ sub SearchCourses { > ) > AND > c.enabled LIKE ? >- GROUP BY c.course_id >+ GROUP BY c.course_id, c.department, c.course_number, c.section, c.course_name, c.term, c.staff_note, c.public_note, c.students_count, c.enabled, c.timestamp > "; > > $term //= ''; >diff --git a/t/db_dependent/CourseReserves.t b/t/db_dependent/CourseReserves.t >index 2dabc67..42d8d1f 100755 >--- a/t/db_dependent/CourseReserves.t >+++ b/t/db_dependent/CourseReserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 26; >+use Test::More tests => 27; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -136,4 +136,7 @@ DelCourse($course_id); > $course = GetCourse($course_id); > ok( !defined( $course->{'course_id'} ), "DelCourse deleted course successfully" ); > >+$courses = SearchCourses(); # FIXME Lack of tests for SearchCourses >+is( ref($courses), 'ARRAY', 'SearchCourses should not crash and return an arrayref' ); >+ > $schema->storage->txn_rollback; >-- >2.1.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 21603
:
80884
|
81163
| 81263