Project

General

Profile

Actions

Bug #14267

closed

sorting must be set for pi_list_query to work

Added by old_cazoo over 20 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
Backend API
Target version:
-
Start date:
2004-08-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.6.2
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In class.tslib_pibase.php the function pi_list_query() specifies "orderBy" as an optional param. However, it fails if no orderBy (can be empty) is set. This also affects pi_exec_query().

For example this code:

$this->pi_list_query("tx_some_table");

... generates non-vaild SQL like this:

" .... ORDER BY tx_some_table. LIMIT x,y"

(issue imported from #M280)

Actions #1

Updated by Ingmar Schlecht over 20 years ago

In the function tslib_pibase::pi_list_query() I suggest to change the following lines from:
// Order by data:
if (!$orderBy) {
if (t3lib_div::inList($this->internal['orderByList'],$this->internal['orderBy'])) {
$orderBy = 'ORDER BY '.$table.'.'.$this->internal['orderBy'].($this->internal['descFlag']?' DESC':'');
}
}

To:
// Order by data:
if (!$orderBy && $this->internal['orderBy']) {
if (t3lib_div::inList($this->internal['orderByList'],$this->internal['orderBy'])) {
$orderBy = 'ORDER BY '.$table.'.'.$this->internal['orderBy'].($this->internal['descFlag']?' DESC':'');
}
}

So the condition includes a check for $this->internal['orderBy'].

Actions #2

Updated by Ingmar Schlecht over 20 years ago

Cazoo, can you please verify that my fix works and does not cause any harm?

I would commit the fix to the CVS then.

Actions #3

Updated by old_cazoo over 20 years ago

I would if I could - my testplatform is currently under re-construction after a HD crash. I will test your fix when I'm and running, but it might take a while.

Actions #4

Updated by Ingmar Schlecht about 20 years ago

did you test it?
Otherwise it will not go into 3.7.

Actions #5

Updated by Ingmar Schlecht over 19 years ago

finally fixed.

Actions

Also available in: Atom PDF