From 171b16e6c9488fe316818b48441a52c4c3ff1cde Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 4 Oct 2010 06:10:33 +0000 Subject: [PATCH] BUGFIX: keep ModelAdmin from importing data twice (from r101795) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@111646 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/ModelAdmin.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index 8ea8ad52..3226a8b3 100755 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -517,13 +517,11 @@ class ModelAdmin_CollectionController extends Controller { Director::redirectBack(); return false; } - - $results = $loader->load($_FILES['_CsvFile']['tmp_name']); + if (!empty($data['EmptyBeforeImport']) && $data['EmptyBeforeImport']) { //clear database before import - $results = $loader->load($_FILES['_CsvFile']['tmp_name'], '512M', true); - } else { //normal import without clearing - $results = $loader->load($_FILES['_CsvFile']['tmp_name']); + $loader->deleteExistingRecords = true; } + $results = $loader->load($_FILES['_CsvFile']['tmp_name']); $message = ''; if($results->CreatedCount()) $message .= sprintf(