edit node removes audio
lutegrass - March 13, 2007 - 15:23
| Project: | Media Field |
| Version: | 4.7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
If you setup your audio field to be single, not multiple values then the audio file is deleted if you edit the file. All ok on initial submit. If you edit node (even uncheck delete box which is wrongly checked) the file is still deleted. Allow multiple files and the bug goes away.

#1
Seems insane to submit a patch for a one line fix so here goes. Here's the offending part of the code ...
Roughly line 286 in current 4.7 dev release :
if (!$field['multiple'] && $delta == 0) {$form[$fieldname][$delta]['remove']['#value'] = 1;
$form[$fieldname][$delta]['replace'] = array(
'#type' => 'markup',
'#value' => t('If a new file is uploaded, this file will be replaced upon submitting this form.'),
);
The offending line is ..
$form[$fieldname][$delta]['remove']['#value'] = 1;Which should be removed. If you leave this line in the code it will always remove a file upon editing the node, even if delete is unchecked. I tested removing this line and the update still does a replace on non-multiple defined fields. This code is attempting to "show" the user that this file will be deleted. But, the file shouldn't be deleted or marked for delete if someone just wants to edit the node description field or whatever. Easy fix. Better to remove this "delete" column and hide all files except for the delta which will replace all previous files. I could create a patch if somebody wants?
#2
Since we don't support 4.7 any more, could you please provide a patch (tested and ready to commit). I will commit it asap.
#3
no new info for over a year, closing.