Improve error messages when linking goes awry

This commit is contained in:
Nathan Gray 2012-12-19 20:21:51 +00:00
parent 2f1e5b5078
commit 8ff5f6f99f

View File

@ -330,9 +330,11 @@ class importexport_import_csv implements importexport_iface_import_record { //,
{ {
$exact_count++; $exact_count++;
$app_id = $id; $app_id = $id;
continue;
} }
unset($results[$id]);
} }
if($exact_count != 1) if($exact_count > 1)
{ {
$warnings[] = lang('Unable to link to %1 "%2"', $warnings[] = lang('Unable to link to %1 "%2"',
lang($links[$name]), $record[$name]). lang($links[$name]), $record[$name]).
@ -340,9 +342,12 @@ class importexport_import_csv implements importexport_iface_import_record { //,
$record[$name] = null; $record[$name] = null;
continue; continue;
} }
elseif ($exact_count == 1)
{
$record[$name] = $app_id; $record[$name] = $app_id;
} }
else if (count($results) == 0) }
if (count($results) == 0)
{ {
$warnings[] = lang('Unable to link to %1 "%2"', $warnings[] = lang('Unable to link to %1 "%2"',
lang($links[$name]), $record[$name]). lang($links[$name]), $record[$name]).