Permalink
Browse files

BUGFIX: GridField delete icon now correctly deletes, rather than alwa…

…ys just unlinking (Fixes 7801)

Fixes the handleAction function of GridFieldDeleteAction which wasn't differentiating between a 'deleterecord' action and an 'unlinkrelation' action.

Fixes http://open.silverstripe.org/ticket/7801
  • Loading branch information...
1 parent af2eae7 commit 9a8313dce05d27279675680f1504783d5d61432d @purplespider purplespider committed Aug 21, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 forms/gridfield/GridFieldDeleteAction.php
@@ -133,7 +133,11 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
if($actionName == 'deleterecord' && !$item->canDelete()) {
throw new ValidationException(_t('GridFieldAction_Delete.DeletePermissionsFailure',"No delete permissions"),0);
}
- $gridField->getList()->remove($item);
+ if($actionName == 'deleterecord') {
+ $item->delete();
+ } else {
+ $gridField->getList()->remove($item);
+ }
}
}
}

1 comment on commit 9a8313d

@Lukin
Lukin commented on 9a8313d Jan 17, 2013

HI, the remove function deletes the related entry, but keeps the relatio of it in the relation table. THis is not how it should be I guess.
v 3.03

Please sign in to comment.