mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT Adjusted ModelAdmin->import() to new BulkLoader_Result API (see r62403)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@62397 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
11bb677150
commit
a4dc629837
@ -281,10 +281,15 @@ abstract class ModelAdmin extends LeftAndMain {
|
||||
$importerClass = $importers[$data['ClassName']];
|
||||
|
||||
$loader = new $importerClass($data['ClassName']);
|
||||
$resultsCount = $loader->load($_FILES['_CsvFile']['tmp_name']);
|
||||
//$resultsCount = ($results) ? $results->Count() : 0;
|
||||
$results = $loader->load($_FILES['_CsvFile']['tmp_name']);
|
||||
|
||||
Session::setFormMessage('Form_ImportForm', "Loaded {$resultsCount} items", 'good');
|
||||
$message = '';
|
||||
if($results->CreatedCount()) $message .= "Imported " . $results->CreatedCount() . " records. ";
|
||||
if($results->UpdatedCount()) $message .= "Updated " . $results->UpdatedCount() . " records. ";
|
||||
if($results->DeletedCount()) $message .= "Deleted " . $results->DeletedCount() . " records. ";
|
||||
if(!$results->CreatedCount() && !$results->UpdatedCount()) $message .= "Nothing to import";
|
||||
|
||||
Session::setFormMessage('Form_ImportForm', $message, 'good');
|
||||
Director::redirect($_SERVER['HTTP_REFERER'] . '#Form_ImportForm_holder');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user