Fix some incorrect / unwanted import warnings

This commit is contained in:
nathan 2023-08-31 08:57:46 -06:00
parent 3803c4ebee
commit 8e7c09c905
2 changed files with 2 additions and 2 deletions

View File

@ -100,7 +100,7 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
$definition->plugin_options['contact_owner'] : $this->user; $definition->plugin_options['contact_owner'] : $this->user;
// Check to make sure target addressbook is valid // Check to make sure target addressbook is valid
if(!in_array($contact_owner, array_keys($this->bocontacts->get_addressbooks(Api\Acl::ADD)))) if($contact_owner != 'personal' && !in_array($contact_owner, array_keys($this->bocontacts->get_addressbooks(Api\Acl::ADD))))
{ {
$this->warnings[0] = lang("Unable to import into %1, using %2", $this->warnings[0] = lang("Unable to import into %1, using %2",
$contact_owner . ' (' . (is_numeric($contact_owner) ? Api\Accounts::username($contact_owner) : $contact_owner) . ')', $contact_owner . ' (' . (is_numeric($contact_owner) ? Api\Accounts::username($contact_owner) : $contact_owner) . ')',

View File

@ -358,7 +358,7 @@ class importexport_import_csv implements importexport_iface_import_record { //,
if ($record[$name]) { if ($record[$name]) {
// Automatically handle text owner without explicit translation // Automatically handle text owner without explicit translation
$new_owner = importexport_helper_functions::account_name2id($record[$name]); $new_owner = importexport_helper_functions::account_name2id($record[$name]);
if(!is_array($new_owner) || count($new_owner) != count(explode(',', $record[$name]))) if(!$new_owner || is_array($record[$name]) && count($record[$name]) || $record[$name])
{ {
// Unable to parse value into account // Unable to parse value into account
$warnings[] = $name . ': ' .lang('%1 is not a known user or group', $record[$name]); $warnings[] = $name . ': ' .lang('%1 is not a known user or group', $record[$name]);