powermail
powermail copied to clipboard
Inconsistency if answer page is deleted (but still used in powermail plugin FlexForm)
If an answer page (the page where the answers are to be stored) is deleted, but an existing plugin has still configured it, it is still possible to send forms and (non-deleted) answers will be added to the answer page:
select m.uid AS uid_form,m.pid,m.hidden,m.deleted AS deleted_form,p.uid AS uid_page,p.deleted AS deleted_page from tx_powermail_domain_model_mail m inner join pages p on m.pid=p.uid;
+----------+--------+--------+--------------+----------+--------------+
| uid_form | pid | hidden | deleted_form | uid_page | deleted_page |
+----------+--------+--------+--------------+----------+--------------+
| 5 | 100041 | 0 | 0 | 100041 | 1 |
However, it is not possible to access the answers since they are on a deleted page.
Additionally, when opening the FlexForm, the setting is empty (which would indicate "on same page"), but the value is still set in the database:
<field index="settings.flexform.main.pid">
<value index="vDEF">100041</value>
</field>
So, there is no visual indication of this problem.
expected behaviour
I would expect (some combination of this):
- ideally, that it is not possible to delete a page if a powermail plugin uses it as answer page (unless on same page and will also be deleted) or at least get a warning when deleting such a page (which would happen if this were a reference in reference index)
- the form to no longer work and an error message displayed if the answer page id deleted
- (or) the answer to be written to a different answer page (e.g. the same page as the form)
- a warning to be displayed when editing the plugin (if the configured answer page was deleted)
- consistency checks for this
Reproduce
- configure a powermail form with a separate answer page
- delete the answer page
- submit the form in the FE
- check the database: the (undeleted) answer will be on the (deleted) page
- check the database: select pi_flexform from tt_content of the powermail form: the field
settings.flexform.main.pidwill still contain the uid of the deleted page - edit the powermail plugin: it will not be shown, that
settings.flexform.main.pidcontains the uid of the deleted page
test for this
I have been using dbdoctor and it shows new problems after a full run after a few days. One of these is that there are powermail answers on deleted pages.
dbdoctor would just set them as deleted as well.
check:
Scan for not-deleted records on pages set to deleted
----------------------------------------------------
Class: TcaTablesPidDeleted
Actions: soft-delete, remove, workspace-remove
TCA records have a pid field set to a single page. This page must exist.
This scan finds deleted=0 records pointing to pages having deleted=1.
Affected records are soft deleted if possible, or removed.
[WARNING] Found affected records in 1 tables:
"tx_powermail_domain_model_answer": 595 records
versions
- TYPO3 11.5.33
- powermail: 10.7.4