luxletter icon indicating copy to clipboard operation
luxletter copied to clipboard

SQL error when soft delete from fe_users table was removed

Open soee opened this issue 1 year ago • 2 comments

There may be projects where removing soft delete functionality from fe_users is a requirement. When we remove soft delete and the related deleted column from the database, Luxletter encounters an issue when attempting to fetch the number of users in frontend groups. This typically occurs when rendering a preview of the newsletter.

Instead of displaying the actual error to users, Luxletter shows a generic validation error message. However, the underlying error is logged in the system log:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1054: An exception occurred while executing a query: Unknown column 'deleted' in 'where clause' | Doctrine\DBAL\Exception\InvalidFieldNameException thrown in file /var/www/html/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php in line 67. Requested URL: https://foo.ddev.site/typo3/ajax/luxletter/wizardUserPreview?token=--AnonymizedToken--&usergroups=2

The issue originates in the UserRepository.php file, line 99, where the deleted column is used directly within a raw SQL query.

soee avatar Nov 14 '24 12:11 soee

Thx for notifying us. I never heard of the possibility to change fe_users like that, but I can image what's the desire behind this change.

At the moment, we don't plan to change the behaviour. Nevertheless, I will keep this issue open. Maybe others are also interested in this feature.

einpraegsam avatar Nov 19 '24 11:11 einpraegsam

There is also a second place, where the same happens: https://github.com/in2code-de/luxletter/blob/develop/Classes/Domain/Repository/QueueRepository.php#L35

So here we have this line:

$query->equals('user.deleted', false),

soee avatar Dec 11 '24 08:12 soee