Project

General

Profile

Actions

Bug #19042

closed

TCEmain doesn't respect given value for sorting

Added by Steffen Kamper over 16 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2008-07-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

if you create a new record with TCEmain and you give a value for sorting field, eg
$recData['sys_template']['NEW'] = array(
'pid' => $id,
'title' => "+ext",
'sorting' => time()
);
(as found in core)

the sorting field is not respected and overwritten by internal function.

attached patch fixes this.

(issue imported from #M8872)


Files

8872_sortrow.diff (1.31 KB) 8872_sortrow.diff Administrator Admin, 2008-07-01 14:24
8872_sortrow2.diff (3.44 KB) 8872_sortrow2.diff Administrator Admin, 2008-07-01 16:34
0008872_v3.patch (3.45 KB) 0008872_v3.patch Administrator Admin, 2008-07-01 20:41
Actions #1

Updated by Steffen Kamper over 16 years ago

i will make a new patch, where you don't define the value of sort field, but giving "top" or "bottom" as predefined to influence the inserted position.

Actions #2

Updated by Steffen Kamper over 16 years ago

ok, attached is a new patch.

default is insert new record as "first" element.
New is the option to insert element as "last" element by defining:

'sorting' => 'last'

This is done for records having pid>0, for workspace records i didn't touch the behaviour.

Actions #3

Updated by Oliver Hader over 16 years ago

I changed your patch a bit and added a new property for $TCA[table]['ctrl']:
-> insertAsLast: boolean
Thus, it can be defined, that new records which are not inserted after an already existing record, are inserted as first or last element in the listing.

Actions #4

Updated by Steffen Kamper over 16 years ago

thx olly, patch works fine!
I tested it with this array :

$recData['sys_template'][$newID] = array(
'pid' => $id,
'title' => "+ext",
'_INSERTAS' => 'last'
);

and result is as expected.

Actions #5

Updated by Dmitry Dulepov over 16 years ago

Guys, wait. TCEmain does not work this way. It determines sorting according to special rules. Your patch may break it.

Actions #6

Updated by Dmitry Dulepov over 16 years ago

Steffen, just set pid to negative uid value of the "previous" record. This is official supported way.

Actions #7

Updated by Steffen Kamper over 16 years ago

Dmitry, i tested it with the negative pid and it works, i also found it in documentation.

Anyway i had troubles to follow the code (2nd part in sorting-function).
It's bad documented and hard to undertand (my opinion).

Actions #8

Updated by Dmitry Dulepov over 16 years ago

I agree :( TCEmain is a very tricky and badly documented thing. Things like negitive pids for sorting are frustrating (why cannot it be done in a "normal" way?). But they already exist, we have to use them as is...

Once I spent several days (!) stepping torough code and analyzing how it works. I think I will write a set of articles about TCEmain some time later.

Actions #9

Updated by Alexander Opitz over 11 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

Actions #10

Updated by Alexander Opitz about 11 years ago

  • Status changed from Needs Feedback to Closed
  • Is Regression set to No

No feedback for over 90 days.

Actions

Also available in: Atom PDF