Project

General

Profile

Actions

Bug #16956

closed

Redundant comma in label_alt_force

Added by Julian Kleinhans about 17 years ago. Updated about 17 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2007-02-08
Due date:
% Done:

0%

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

Description

If there ist activate the "label_alt_force" in tt_content [ctrl] with eg this label_alt "title, subtitle", and the subtitle is empty, the result in db_list.php is

MyTitle,

Is the title and the subtitle empty the result is only a comma
,

i have written a patch in

t3lib/class.t3lib_befunc.php
function: getRecordTitle

line:1848
if ($TCA[$table]['ctrl']['label_alt_force'])
// PATCH begin {
foreach($tA as $key => $value){
if($value != ''){
$tATmp .= $value.', ';
}
}

$t = substr($tATmp,0,-2);                     
}
// PATCH end

(issue imported from #M4943)


Files

0004943.diff (876 Bytes) 0004943.diff Administrator Admin, 2007-02-09 08:34
patch_bug_0004943.txt (898 Bytes) patch_bug_0004943.txt Administrator Admin, 2007-02-09 09:30
Actions #1

Updated by Thomas Hempel about 17 years ago

Hi,
I have added a new patch which is a bit cleaner in my eyes. Anyway, I'm not sure what the normal bevahior should be.

I think it makes only sense if the comma is removed if it is the last one. All other commas should be kept because it will be very hard to determine in which colume is empty in a dataset.

username, email, name, whatever
username, email, name
username, , name, whatever

Any recommendations?

Greets,
Thomas

P.S.: The patch only removes empty string from the list of labels!

Actions #2

Updated by Julian Kleinhans about 17 years ago

example:

label = title
label_alt = subtitle
label_alt_force = 1

in your patch, the problem is, when a record has a subtitle but no title, the result is

, mySubtitle

correct is only the subtitle without a comma before when there is no title

Actions #3

Updated by David Bruehlmeier about 17 years ago

Hi,

it's debatable if this is really a bug or a feature... Quote from the Core API doc:

"label_alt_force: If set, then the "label_alt" fields are always shown in the title separated by comma."

That's exactly what the function does. But I agree that the result is not very nice and probably not what a user might expect to see.

The attached patch (patch_bug_0004943.txt) makes sure that only values from fields which are not empty are displayed, separated by comma. Thus, no "redundant" commas anymore! :-)

regards,
Dave

Actions #4

Updated by Ingmar Schlecht about 17 years ago

Thomas, can you take care of this and send one of the patches as an RFC to the core list?

Thanks!

- Ingmar

Actions #5

Updated by Thomas Hempel about 17 years ago

@Ingmar: I will do it

Greets,
Thomas

Actions #6

Updated by Thomas Hempel about 17 years ago

Commited to trunk in SVN.

Greets,
Thomas

Actions #7

Updated by Sebastian Kurfuerst about 17 years ago

test

Actions

Also available in: Atom PDF