Project

General

Profile

Feature #25223 ยป typo3-6.1.1-displayCond.patch

David Frerich, 2013-07-02 15:21

View differences:

typo3_src-6.1.1-patched//typo3/sysext/backend/Classes/Form/ElementConditionMatcher.php 2013-07-02 14:49:22.000000000 +0200
* @var array
*/
protected $record = array();
/**
* @var string
*/
protected $recordTable = '';
/**
* Evaluates the provided condition and returns TRUE if the form
......
}
return $result;
}
/**
* @param string $recordTable
* @return ElementConditionMatcher
*/
public function setRecordTable($recordTable)
{
$this->recordTable = $recordTable;
return $this;
}
/**
* Evaluates the provided condition and returns TRUE if the form
......
}
return $result;
}
/**
* @param string $fieldName
* @param array $record
* @return string
*/
protected function getRecordFieldValue($fieldName, $record, $recordTable = '')
{
if (strpos($fieldName, '.') !== false) {
$fieldValue = null;
$fieldNameParts = explode('.', $fieldName, 2);
$parentFieldName = $fieldNameParts[0];
$subFieldName = $fieldNameParts[1];
if (array_key_exists($parentFieldName, $record) && $record[$parentFieldName]) {
$recordFieldValue = $record[$parentFieldName];
if ($recordTable) {
$fieldTCA = $GLOBALS['TCA'][$recordTable]['columns'][$parentFieldName];
$subRecordTable = '';
$subRecordUid = 0;
switch ($fieldTCA['config']['type']) {
case 'select':
break;
case 'group':
if ($fieldTCA['config']['internal_type'] == 'db') {
$recordFieldValues = explode(',', $recordFieldValue);
$allowedTables = array_map('trim', explode(',', $fieldTCA['config']['allowed']));
if (count($allowedTables) === 1 || is_numeric($recordFieldValues)) {
$subRecordTable = array_shift($allowedTables);
} else {
foreach ($allowedTables as $table) {
if (strpos($recordFieldValues[0], $table) === 0) {
$subRecordTable = $table;
break;
}
}
}
$subRecordUid = (int)array_shift(explode('|', str_replace($subRecordTable . '_', '', $recordFieldValue)));
}
break;
case 'inline':
break;
}
if ($subRecordTable && $subRecordUid) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $subRecordTable, 'uid=' . $subRecordUid . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($subRecordTable));
$subRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
if ($subRecord) {
\TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid($subRecordTable, $subRecord);
$fieldValue = $this->getRecordFieldValue($subFieldName, $subRecord, $subRecordTable);
}
}
}
}
} else {
$fieldValue = $record[$fieldName];
}
return $fieldValue;
}
/**
* Evaluates conditions concerning a field of the current record.
......
$fieldValue = $this->record[$fieldName][$this->flexformValueKey];
}
} else {
$fieldValue = $this->record[$fieldName];
$fieldValue = $this->getRecordFieldValue($fieldName, $this->record, $this->recordTable);
}
$result = FALSE;
typo3_src-6.1.1-patched//typo3/sysext/backend/Classes/Form/FormEngine.php 2013-07-02 13:53:07.000000000 +0200
if (is_array($PA['fieldConf']) && $PA['fieldConf']['displayCond'] && is_array($row)) {
/** @var $elementConditionMatcher \TYPO3\CMS\Backend\Form\ElementConditionMatcher */
$elementConditionMatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\ElementConditionMatcher');
$elementConditionMatcher->setRecordTable($table);
$displayConditionResult = $elementConditionMatcher->match($PA['fieldConf']['displayCond'], $row);
}
......
/** @var $elementConditionMatcher \TYPO3\CMS\Backend\Form\ElementConditionMatcher */
$elementConditionMatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\ElementConditionMatcher');
$elementConditionMatcher->setRecordTable($table);
foreach ($rotateLang as $vDEFkey) {
$vDEFkey = 'v' . $vDEFkey;
    (1-1/1)