Add some debug into infolog csv import

This commit is contained in:
nathangray 2020-12-04 10:20:34 -07:00
parent 20f6f7a43b
commit c158707718

View File

@ -257,7 +257,11 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin
if($record['info_link_id'] && !is_numeric($record['info_link_id'])) if($record['info_link_id'] && !is_numeric($record['info_link_id']))
{ {
// But try to search for it as a contact // But try to search for it as a contact
$record['info_contact'] = $record['info_link_id']; if(!$record['info_contact'])
{
$record['info_contact'] = $record['info_link_id'];
$record['info_des'] .= "\nTried to import text into info_link_id: " . $record['info_link_id'];
}
unset($record['info_link_id']); unset($record['info_link_id']);
} }
// If contact or from is set and not an ID, find it. Use quotes for exact match. // If contact or from is set and not an ID, find it. Use quotes for exact match.
@ -266,12 +270,14 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin
if ($record[$field] && is_string($record[$field])) if ($record[$field] && is_string($record[$field]))
{ {
$contacts = Link::query('addressbook', '"' . $record[$field] . '"'); $contacts = Link::query('addressbook', '"' . $record[$field] . '"');
$record['info_des'] .= "\nImport text into $field: " . $record[$field]."\nMatches:\n".print_r($contacts,true);
if ($contacts) if ($contacts)
{ {
$record['info_contact'] = array( $record['info_contact'] = array(
'id' => array_key_first($contacts), 'id' => array_key_first($contacts),
'app' => 'addressbook' 'app' => 'addressbook'
); );
$record['info_des'] .= "\ninfo_contact: " .print_r($record['info_contact'],true);
} }
} }
} }