Skip to content
This repository
Browse code

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...
commit 9a8313dce05d27279675680f1504783d5d61432d 1 parent af2eae7
James Cocker authored August 21, 2012
6  forms/gridfield/GridFieldDeleteAction.php
@@ -133,7 +133,11 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
133 133
 			if($actionName == 'deleterecord' && !$item->canDelete()) {
134 134
 				throw new ValidationException(_t('GridFieldAction_Delete.DeletePermissionsFailure',"No delete permissions"),0);
135 135
 			}
136  
-			$gridField->getList()->remove($item);
  136
+			if($actionName == 'deleterecord') {
  137
+				$item->delete();
  138
+			} else {
  139
+				$gridField->getList()->remove($item);
  140
+			}
137 141
 		} 
138 142
 	}
139 143
 }

1 note on commit 9a8313d

Lukin

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.
Something went wrong with that request. Please try again.