'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.
* @param string $fieldName
*
* @return mixed|null
- * @throws \CRM_Core_Exception
*/
public function getSubmittedValue(string $fieldName) {
if ($fieldName === 'dataSource') {
* 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();
* all forms.
*
* @return string[]
- * @throws \CRM_Core_Exception
*/
protected function getSubmittableFields(): array {
$dataSourceFields = array_fill_keys($this->getDataSourceFields(), 'DataSource');
*
* @return array
* @throws \API_Exception
- * @throws \CRM_Core_Exception
*/
protected function getMappedFieldLabels(): array {
$mapper = [];
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;
+ }
+
}