Bug #2731
Attachments do not work when inserted/changed by editing, easy FIX included
| Status: | Resolved | Start date: | 2009-03-01 | |
|---|---|---|---|---|
| Priority: | Must have | Due date: | ||
| Assignee: | Martin Helmich | % Done: | 0% |
|
| Category: | Forum | |||
| Target version: | 0.1.8 | |||
| Votes: | 0 |
Description
When editing a post and attaching a file, the attachment is not correctly connected to the post.
One will only get an "This attachment does not exist" error.
Background (forum version 0.1.7):
Table tx_mmforum_attachments will contain a valid entry for the new attachment that has been generated in method "performAttachmentUpload". Unfortunately, it will contain the invalid "post_id" of 0 and can thus not be found if you later click on the attachment to download it.
It works well during the initial post creation since the "tx_mmforum_postfactory" updates the according row in line 311.
Solution:
tx_mmforum_pi1->post_edit() function has to be extended.
Lines 2738 following contain the "else" statement that is meant to update or insert file attachments to the existing edited post.
Simply adding the following lines at the end of that "else" (after line 2750) will solve the problem:
$updateArray = array(
'post_id' => $row['uid']
);
$mergedIds = array_merge($attachments,$attachment_ids);
if (count($mergedIds) > 1) $where = 'uid='. implode (' OR uid=', $mergedIds);
else $where = 'uid='.$mergedIds[0];
$GLOBALS['TYPO3_DB']->exec_UPDATEquery(
'tx_mmforum_attachments',
$where,
$updateArray
);
See also this thread (german): http://www.typo3.net/index.php?id=13&action=list_post&tid=66712&page=1
Associated revisions
[Bug 2731] Fix: plugin.tx_seminars.allowRegistrationForEventsWithoutDate is called like a switch available in flexforms but it is not in flexforms
[Bug 2731] Fix: plugin.tx_seminars.allowRegistrationForEventsWithoutDate is called like a switch available in flexforms but it is not in flexforms
History
Updated by Martin Helmich about 4 years ago
- Status changed from New to Resolved
- Assignee set to Martin Helmich
- Target version set to 0.1.8
Fixed in next revision.