+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
+ | Copyright CiviCRM LLC (c) 2004-2020 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC (c) 2004-2020
*
* Add static functions to include some common functionality used across location sub object BAO classes.
*/
$block->is_primary = FALSE;
$block->save();
}
- $block->free();
}
}
}
}
$blockFields = array_merge($value, $contactFields);
- $baoString = 'CRM_Core_BAO_' . $name;
- $blocks[] = $baoString::add($blockFields);
+ if ($name === 'Email') {
+ // @todo ideally all would call the api which is our main tested function,
+ // and towards that call the create rather than add which is preferred by the
+ // api. In order to be careful with change only email is swapped over here because it
+ // is specifically tested in testImportParserWithUpdateWithContactID
+ // and the primary handling is otherwise bypassed on importing an email update.
+ $blocks[] = CRM_Core_BAO_Email::create($blockFields);
+ }
+ else {
+ $baoString = 'CRM_Core_BAO_' . $name;
+ $blocks[] = $baoString::add($blockFields);
+ }
}
return $blocks;