Bug #52126 ยป 52126_TYPO3_61.diff
typo3/sysext/backend/Classes/Utility/BackendUtility.php | ||
---|---|---|
case 'group':
|
||
// resolve the titles for DB records
|
||
if ($theColConf['internal_type'] === 'db') {
|
||
$finalValues = array();
|
||
$relationTableName = $theColConf['allowed'];
|
||
$explodedValues = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
|
||
foreach ($explodedValues as $explodedValue) {
|
||
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($explodedValue)) {
|
||
$relationTableNameForField = $relationTableName;
|
||
if ($theColConf['MM']) {
|
||
if ($uid) {
|
||
// Display the title of MM related records in lists
|
||
if ($noRecordLookup) {
|
||
$MMfield = $theColConf['foreign_table'] . '.uid';
|
||
} else {
|
||
$MMfields = array($theColConf['foreign_table'] . '.' . $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label']);
|
||
$altLabelFields = explode(',', $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label_alt']);
|
||
foreach ($altLabelFields as $f) {
|
||
$f = trim($f);
|
||
if ($f !== '') {
|
||
$MMfields[] = $theColConf['foreign_table'] . '.' . $f;
|
||
}
|
||
}
|
||
$MMfield = join(',', $MMfields);
|
||
}
|
||
/** @var $dbGroup \TYPO3\CMS\Core\Database\RelationHandler */
|
||
$dbGroup = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
|
||
$dbGroup->start($value, $theColConf['foreign_table'], $theColConf['MM'], $uid, $table, $theColConf);
|
||
$selectUids = $dbGroup->tableArray[$theColConf['foreign_table']];
|
||
if (!empty($selectUids) && is_array($selectUids)) {
|
||
$MMres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
||
'uid, ' . $MMfield,
|
||
$theColConf['foreign_table'],
|
||
'uid IN (' . implode(',', $selectUids) . ')' . static::deleteClause($theColConf['foreign_table'])
|
||
);
|
||
$mmlA = array();
|
||
while ($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres)) {
|
||
// Keep sorting of $selectUids
|
||
$mmlA[array_search($MMrow['uid'], $selectUids)] = $noRecordLookup
|
||
? $MMrow['uid']
|
||
: static::getRecordTitle($theColConf['foreign_table'], $MMrow, FALSE, $forceResult);
|
||
}
|
||
$GLOBALS['TYPO3_DB']->sql_free_result($MMres);
|
||
if (!empty($mmlA)) {
|
||
ksort($mmlA);
|
||
$l = implode('; ', $mmlA);
|
||
} else {
|
||
$l = 'N/A';
|
||
}
|
||
} else {
|
||
$l = 'N/A';
|
||
}
|
||
} else {
|
||
list($relationTableNameForField, $explodedValue) = self::splitTable_Uid($explodedValue);
|
||
$l = 'N/A';
|
||
}
|
||
} else {
|
||
$finalValues = array();
|
||
$relationTableName = $theColConf['allowed'];
|
||
$explodedValues = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
|
||
$relationRecord = static::getRecordWSOL($relationTableNameForField, $explodedValue);
|
||
$finalValues[] = static::getRecordTitle($relationTableNameForField, $relationRecord);
|
||
}
|
||
foreach ($explodedValues as $explodedValue) {
|
||
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($explodedValue)) {
|
||
$relationTableNameForField = $relationTableName;
|
||
} else {
|
||
list($relationTableNameForField, $explodedValue) = self::splitTable_Uid($explodedValue);
|
||
}
|
||
$l = implode(', ', $finalValues);
|
||
$relationRecord = static::getRecordWSOL($relationTableNameForField, $explodedValue);
|
||
$finalValues[] = static::getRecordTitle($relationTableNameForField, $relationRecord);
|
||
}
|
||
$l = implode(', ', $finalValues);
|
||
}
|
||
} else {
|
||
$l = implode(', ', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE));
|
||
}
|