$this->setFieldMetadata();
}
- /**
- * Handle the values in preview mode.
- *
- * @param array $values
- * The array of values belonging to this line.
- *
- * @return bool
- * the result of this processing
- */
- public function preview(&$values) {
- return $this->summary($values);
- }
-
- /**
- * Handle the values in summary mode.
- *
- * @param array $values
- * The array of values belonging to this line.
- *
- * @return bool
- * the result of this processing
- */
- public function summary(&$values) {
- $params = $this->getMappedRow($values);
- $errors = [];
- try {
- $this->validateParams($params);
- }
- catch (CRM_Core_Exception $e) {
- $errors[] = $e->getMessage();
- }
-
- if ($errors) {
- $tempMsg = "Invalid value for field(s) : " . implode(',', $errors);
- array_unshift($values, $tempMsg);
- return CRM_Import_Parser::ERROR;
- }
- return CRM_Import_Parser::VALID;
- }
-
/**
* Handle the values in import mode.
*
* @param array $values
* The array of values belonging to this line.
- *
- * @return bool
- * the result of this processing
*/
- public function import(&$values) {
+ public function import(array $values): void {
$rowNumber = (int) ($values[array_key_last($values)]);
try {
$params = $this->getMappedRow($values);
$this->_newParticipant[] = $newParticipant->id;
$this->setImportStatus($rowNumber, 'IMPORTED', '', $newParticipant->id);
- return CRM_Import_Parser::VALID;
+ return;
}
throw new CRM_Core_Exception('Matching Participant record not found for Participant ID ' . $formatValues['participant_id'] . '. Row was skipped.');
}
if (is_array($newParticipant['error_message']) &&
($participantID == $newParticipant['error_message']['params'][0])
) {
- array_unshift($values, $url);
- $this->setImportStatus($rowNumber, 'DUPLICATE', '');
- return CRM_Import_Parser::DUPLICATE;
+ $this->setImportStatus($rowNumber, 'DUPLICATE', $url);
+ return;
}
if ($newParticipant['error_message']) {
throw new CRM_Core_Exception($newParticipant['error_message']);
}
}
catch (CRM_Core_Exception $e) {
- array_unshift($values, $e->getMessage());
- $this->setImportStatus($rowNumber, 'ERROR', $e->getMessage());
- return CRM_Import_Parser::ERROR;
- }
- catch (CiviCRM_API3_Exception $e) {
- array_unshift($values, $e->getMessage());
$this->setImportStatus($rowNumber, 'ERROR', $e->getMessage());
- return CRM_Import_Parser::ERROR;
+ return;
}
- $this->setImportStatus($rowNumber, 'IMPORTED', '');
+ $this->setImportStatus($rowNumber, 'IMPORTED', '', $newParticipant['id']);
}
/**