mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
parse the string to be converted to group codes.
Two fixes. 1. parse the group code by using Convert::raw2url() as it creates duplicate records if the group code is given in upper case letters, spaces etc. 2. assigning to the $_cache_groupByCode has to be really done in the if condition rather than out of it.
This commit is contained in:
parent
1bc7297c8f
commit
411f168f00
@ -40,6 +40,7 @@ class MemberCsvBulkLoader extends CsvBulkLoader {
|
|||||||
if(isset($record['Groups']) && $record['Groups']) {
|
if(isset($record['Groups']) && $record['Groups']) {
|
||||||
$groupCodes = explode(',', $record['Groups']);
|
$groupCodes = explode(',', $record['Groups']);
|
||||||
foreach($groupCodes as $groupCode) {
|
foreach($groupCodes as $groupCode) {
|
||||||
|
$groupCode = Convert::raw2url($groupCode);
|
||||||
if(!isset($_cache_groupByCode[$groupCode])) {
|
if(!isset($_cache_groupByCode[$groupCode])) {
|
||||||
$group = Group::get()->filter('Code', $groupCode)->first();
|
$group = Group::get()->filter('Code', $groupCode)->first();
|
||||||
if(!$group) {
|
if(!$group) {
|
||||||
@ -49,8 +50,8 @@ class MemberCsvBulkLoader extends CsvBulkLoader {
|
|||||||
$group->write();
|
$group->write();
|
||||||
}
|
}
|
||||||
$member->Groups()->add($group);
|
$member->Groups()->add($group);
|
||||||
|
$_cache_groupByCode[$groupCode] = $group;
|
||||||
}
|
}
|
||||||
$_cache_groupByCode[$groupCode] = $group;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user