*
* @param string $contactSubType
*/
- public function setContactSubType(string $contactSubType) {
- $this->contactSubType = $contactSubType;
+ public function setContactSubType($contactSubType) {
+ $this->contactSubType = (string) $contactSubType;
}
/**
}
else {
// Honour legacy chaos factor.
+ if ($field['name'] === ts('- do not import -')) {
+ // This is why we save names not labels people....
+ $field['name'] = 'do_not_import';
+ }
$fields[$index]['name'] = strtolower(str_replace(" ", "_", $field['name']));
// fix for edge cases, CRM-4954
if ($fields[$index]['name'] === 'image_url') {
*/
protected function getNameFromLabel($label) {
$titleMap = array_flip($this->getMetadataTitles());
+ $label = str_replace(' (match to contact)', '', $label);
return $titleMap[$label] ?? '';
}
* @return bool
*/
protected function isValidRelationshipKey($key) {
- return !empty($this->getValidRelationships()[$key]) ? TRUE : FALSE;
+ return !empty($this->getValidRelationships()[$key]);
}
/**
*/
public function getQuickFormJSForField($column) {
$columnNumbersToHide = [];
- if ($this->getRelationshipKey($column)) {
+ if ($this->getFieldName($column) === 'do_not_import') {
+ $columnNumbersToHide = [1, 2, 3];
+ }
+ elseif ($this->getRelationshipKey($column)) {
if (!$this->getWebsiteTypeID($column) && !$this->getLocationTypeID($column)) {
$columnNumbersToHide[] = 2;
}
* @throws \CiviCRM_API3_Exception
*/
public function getSavedQuickformDefaultsForColumn($column) {
+ if ($this->getFieldName($column) === 'do_not_import') {
+ return [];
+ }
if ($this->getValidRelationshipKey($column)) {
if ($this->getWebsiteTypeID($column)) {
return [$this->getValidRelationshipKey($column), $this->getFieldName($column), $this->getWebsiteTypeID($column)];