Import/Export - Fix unneeded warning about 'Unable to link...' when no link fields specified

This commit is contained in:
nathangray 2018-12-17 11:09:45 -07:00
parent 6a6ef64793
commit 1b33419bfe

View File

@ -335,15 +335,16 @@ abstract class importexport_basic_import_csv implements importexport_iface_impor
{ {
$id = $record->get_identifier(); $id = $record->get_identifier();
// Warn if there's no ID unless it's a dry_run because there probably won't be an ID then
if(!$this->dry_run && !$id)
{
$this->warnings[$import_csv->get_current_position()] .= "Unable to link, no identifier for record";
return;
}
foreach(self::$special_fields as $field => $desc) { foreach(self::$special_fields as $field => $desc) {
if(!$record->$field) continue; if(!$record->$field) continue;
// Warn if there's no ID unless it's a dry_run because there probably won't be an ID then
if(!$this->dry_run && !$id)
{
$this->warnings[$import_csv->get_current_position()] .= "Unable to link, no identifier for record";
return;
}
if(strpos($field, 'link') === 0) { if(strpos($field, 'link') === 0) {
list($app, $app_id) = explode(':', $record->$field,2); list($app, $app_id) = explode(':', $record->$field,2);