Remove remaining refs to onDuplicate
[civicrm-core.git] / CRM / Import / Parser.php
index 2421640b8aac23b9b84269de0cec83f452755a53..9cec7a68a891a97c666cf4b9c9e164306a28d351 100644 (file)
@@ -151,7 +151,8 @@ abstract class CRM_Import_Parser {
    *
    * @return mixed
    *
-   * @throws \API_Exception
+   * @noinspection PhpDocMissingThrowsInspection
+   * @noinspection PhpUnhandledExceptionInspection
    */
   protected function getSubmittedValue(string $fieldName) {
     return $this->getUserJob()['metadata']['submitted_values'][$fieldName];
@@ -329,6 +330,15 @@ abstract class CRM_Import_Parser {
     return ((int) $this->getSubmittedValue('onDuplicate')) === CRM_Import_Parser::DUPLICATE_SKIP;
   }
 
+  /**
+   * Did the user specify duplicates should be filled with missing data.
+   *
+   * @return bool
+   */
+  protected function isFillDuplicates(): bool {
+    return ((int) $this->getSubmittedValue('onDuplicate')) === CRM_Import_Parser::DUPLICATE_FILL;
+  }
+
   /**
    * Array of the fields that are actually part of the import process
    * the position in the array also dictates their position in the import
@@ -1710,7 +1720,7 @@ abstract class CRM_Import_Parser {
       $values = array_values($row);
 
       try {
-        $parser->import($parser->getSubmittedValue('onDuplicate'), $values);
+        $parser->import($values);
       }
       catch (CiviCRM_API3_Exception $e) {
         // When we catch errors here we are not adding to the errors array - mostly