]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8569 - mod/data sorting by numerical field now works with PostgreSQL
authorcataluke <cataluke>
Wed, 18 Apr 2007 02:11:09 +0000 (02:11 +0000)
committercataluke <cataluke>
Wed, 18 Apr 2007 02:11:09 +0000 (02:11 +0000)
Author: Luke Hudson <luke@catalyst.net.nz>

mod/data/view.php

index 02e14c94302902ed0374651b6f312a3c8621371d..f28a7b7f2395825253553cdbd315a56ac07a847e 100755 (executable)
             $sortcontent = $sortfield->get_sort_field();
             $sortcontentfull = $sortfield->get_sort_sql('c.'.$sortcontent);
 
-            $what = ' DISTINCT r.id, r.approved, r.userid, u.firstname, u.lastname, c.'.$sortcontent.' ';
+            $what = ' DISTINCT r.id, r.approved, r.userid, u.firstname, u.lastname, c.'.$sortcontent.', '.$sortcontentfull.' AS _order ';
             $count = ' COUNT(DISTINCT c.recordid) ';
             $tables = $CFG->prefix.'data_content c,'.$CFG->prefix.'data_records r,'.$CFG->prefix.'data_content c1, '.$CFG->prefix.'user u ';
             $where =  'WHERE c.recordid = r.id
                          AND r.dataid = '.$data->id.'
                          AND r.userid = u.id
                          AND c1.recordid = r.id ';
-            $sortorder = ' ORDER BY '.$sortcontentfull.' '.$order.' , r.id ASC ';
+            $sortorder = ' ORDER BY _order '.$order.' , r.id ASC ';
             $searchselect = '';
             
             if (!empty($advanced)) {                                                                                           //If advanced box is checked.