mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #1821 from oddnoc/csvbulkloader-findexisting-2.4
Use the correct variable as the key into $record
This commit is contained in:
commit
ff63d7ae26
@ -152,11 +152,11 @@ class CsvBulkLoader extends BulkLoader {
|
|||||||
foreach($this->duplicateChecks as $fieldName => $duplicateCheck) {
|
foreach($this->duplicateChecks as $fieldName => $duplicateCheck) {
|
||||||
if(is_string($duplicateCheck)) {
|
if(is_string($duplicateCheck)) {
|
||||||
$SQL_fieldName = Convert::raw2sql($duplicateCheck);
|
$SQL_fieldName = Convert::raw2sql($duplicateCheck);
|
||||||
if(!isset($record[$fieldName])) {
|
if(!isset($record[$SQL_fieldName])) {
|
||||||
return false;
|
return false;
|
||||||
//user_error("CsvBulkLoader:processRecord: Couldn't find duplicate identifier '{$fieldName}' in columns", E_USER_ERROR);
|
//user_error("CsvBulkLoader:processRecord: Couldn't find duplicate identifier '{$fieldName}' in columns", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
$SQL_fieldValue = Convert::raw2sql($record[$fieldName]);
|
$SQL_fieldValue = Convert::raw2sql($record[$SQL_fieldName]);
|
||||||
$existingRecord = DataObject::get_one($this->objectClass, "\"$SQL_fieldName\" = '{$SQL_fieldValue}'");
|
$existingRecord = DataObject::get_one($this->objectClass, "\"$SQL_fieldName\" = '{$SQL_fieldValue}'");
|
||||||
if($existingRecord) return $existingRecord;
|
if($existingRecord) return $existingRecord;
|
||||||
} elseif(is_array($duplicateCheck) && isset($duplicateCheck['callback'])) {
|
} elseif(is_array($duplicateCheck) && isset($duplicateCheck['callback'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user