X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FImport%2FDataSource%2FCSV.php;h=79e68a0d7ff21af016d3f4153316d18906047766;hb=f20abb09cde0c320cb082cc7ac9f974017c499e6;hp=d8a64f8c0f5e9aff26e0bc1692c26f04a5f7e0b0;hpb=c968e735e92e64181c9e32c55f6672542c9d36c2;p=civicrm-core.git diff --git a/CRM/Import/DataSource/CSV.php b/CRM/Import/DataSource/CSV.php index d8a64f8c0f..79e68a0d7f 100644 --- a/CRM/Import/DataSource/CSV.php +++ b/CRM/Import/DataSource/CSV.php @@ -68,29 +68,22 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource { } /** - * Process the form submission. - * - * @param array $params - * @param string $db - * @param \CRM_Core_Form $form + * Initialize the datasource, based on the submitted values stored in the user job. * * @throws \API_Exception * @throws \CRM_Core_Exception */ - public function postProcess(&$params, &$db, &$form) { - $file = $params['uploadFile']['name']; - $firstRowIsColumnHeader = $params['skipColumnHeader'] ?? FALSE; + public function initialize(): void { $result = self::_CsvToTable( - $file, - $firstRowIsColumnHeader, - CRM_Utils_Array::value('fieldSeparator', $params, ',') + $this->getSubmittedValue('uploadFile')['name'], + $this->getSubmittedValue('skipColumnHeader'), + $this->getSubmittedValue('fieldSeparator') ?? ',' ); + $this->addTrackingFieldsToTable($result['import_table_name']); - $form->set('originalColHeader', CRM_Utils_Array::value('column_headers', $result)); - $form->set('importTableName', $result['import_table_name']); $this->updateUserJobMetadata('DataSource', [ 'table_name' => $result['import_table_name'], - 'column_headers' => $firstRowIsColumnHeader ? $result['column_headers'] : [], + 'column_headers' => $this->getSubmittedValue('skipColumnHeader') ? $result['column_headers'] : [], 'number_of_columns' => $result['number_of_columns'], ]); }