-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL Error in Redirect Module #22
Comments
@SicorDev This one is unfortunately not that easy. The problem is that TYPO3 saves the record on type change. In that cases all validations in the form are skipped, probably because the fields might change with the type change. I tried to improve the behaviour by removing the empty default option in the domain select, so the redirect would in any case show in in the list and would not disappear. Unfortunately this could also lead to that duplicate key sql error because the url to the homepage has an empty path. I also made the I update all 3.x branches. Please try the change and let me know what you think. |
@thommyhh I've got another idea, how to prevent the error in all cases: ext_tables.php $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/Hook.php:Hook'; Hook.php function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, &$pObj) {
if ($table == 'tx_naworkuri_uri' && $status === 'new') {
if(!$fieldArray['path']) {
$fieldArray['path'] = 'default-value' . time();
}
}
} |
@SicorDev The problem is, that the SQL errors occurs when saving, meaning a default value must be set before. On the other hand, it could theoretically be possible to have an empty path. If I remember correctly, the url for the homepage has an empty path, which doesn't really makes sense. Maybe the fix is, to not allow empty paths at all, and handle an empty path as the homepage. Adding the default value, if the record was saved by the type change with an empty path. |
My Environment:
TYPO3 7
PHP 5.6
Nawork: master/3.1.x/3.0.x version
How to reproduce:
It creates an empty redirect, which is not visible in the backend. The normal user has no way of editing or deleting this empty redirect.
I was only able to manually remove the record from the database to resolve this error.
It would make sense to mark the required fields in the backend mask and only save the record if these fields are filled correctly.
The text was updated successfully, but these errors were encountered: