X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FImport%2FForms.php;h=0b37ea76b221e8e4ffae146d797c176a319a77a0;hb=96d9c94a6d9c49a84cd38ab3b3d68167b3274d47;hp=cd81aa4585f96471974edacf10b71bd26c218b80;hpb=c1939ae7af961b262e404dc4f648990a0009e858;p=civicrm-core.git diff --git a/CRM/Import/Forms.php b/CRM/Import/Forms.php index cd81aa4585..0b37ea76b2 100644 --- a/CRM/Import/Forms.php +++ b/CRM/Import/Forms.php @@ -118,6 +118,7 @@ class CRM_Import_Forms extends CRM_Core_Form { 'onDuplicate' => 'DataSource', 'disableUSPS' => 'DataSource', 'doGeocodeAddress' => 'DataSource', + 'multipleCustomData' => 'DataSource', // Note we don't add the save mapping instructions for MapField here // (eg 'updateMapping') - as they really are an action for that form // rather than part of the mapping config. @@ -131,7 +132,6 @@ class CRM_Import_Forms extends CRM_Core_Form { * @param string $fieldName * * @return mixed|null - * @throws \CRM_Core_Exception */ public function getSubmittedValue(string $fieldName) { if ($fieldName === 'dataSource') { @@ -300,8 +300,6 @@ class CRM_Import_Forms extends CRM_Core_Form { * This is called as a snippet in DataSourceConfig and * also from DataSource::buildForm to add the fields such * that quick form picks them up. - * - * @throws \CRM_Core_Exception */ protected function getDataSourceFields(): array { $className = $this->getDataSourceClassName(); @@ -329,7 +327,6 @@ class CRM_Import_Forms extends CRM_Core_Form { * all forms. * * @return string[] - * @throws \CRM_Core_Exception */ protected function getSubmittableFields(): array { $dataSourceFields = array_fill_keys($this->getDataSourceFields(), 'DataSource'); @@ -578,7 +575,6 @@ class CRM_Import_Forms extends CRM_Core_Form { * * @return array * @throws \API_Exception - * @throws \CRM_Core_Exception */ protected function getMappedFieldLabels(): array { $mapper = []; @@ -638,4 +634,20 @@ class CRM_Import_Forms extends CRM_Core_Form { return $this->getParser()->getHeaderPatterns(); } + /** + * Has the user chosen to update existing records. + * @return bool + */ + protected function isUpdateExisting(): bool { + return ((int) $this->getSubmittedValue('onDuplicate')) === CRM_Import_Parser::DUPLICATE_UPDATE; + } + + /** + * Has the user chosen to update existing records. + * @return bool + */ + protected function isSkipExisting(): bool { + return ((int) $this->getSubmittedValue('onDuplicate')) === CRM_Import_Parser::DUPLICATE_SKIP; + } + }