Merge pull request #15649 from JMAConsulting/core-1346
[civicrm-core.git] / CRM / Activity / Import / Form / DataSource.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
16 */
17
18/**
b6c94f42 19 * This class gets the name of the file to upload.
6a488035 20 */
81c3812a 21class CRM_Activity_Import_Form_DataSource extends CRM_Import_Form_DataSource {
6a488035 22
81c3812a
CW
23 const PATH = 'civicrm/import/activity';
24
25 const IMPORT_ENTITY = 'Activity';
6a488035
TO
26
27 /**
fe482240 28 * Build the form object.
6a488035
TO
29 */
30 public function buildQuickForm() {
81c3812a 31 parent::buildQuickForm();
6a488035 32
81c3812a 33 // FIXME: This 'onDuplicate' form element is never used -- copy/paste error?
be2fb01f 34 $duplicateOptions = [];
6a488035 35 $duplicateOptions[] = $this->createElement('radio',
a05662ef 36 NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP
6a488035
TO
37 );
38 $duplicateOptions[] = $this->createElement('radio',
a05662ef 39 NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE
6a488035
TO
40 );
41 $duplicateOptions[] = $this->createElement('radio',
a05662ef 42 NULL, NULL, ts('Fill'), CRM_Import_Parser::DUPLICATE_FILL
6a488035
TO
43 );
44
45 $this->addGroup($duplicateOptions, 'onDuplicate',
46 ts('On duplicate entries')
47 );
6a488035
TO
48 }
49
50 /**
fe482240 51 * Process the uploaded file.
6a488035
TO
52 */
53 public function postProcess() {
be2fb01f 54 $this->storeFormValues([
81c3812a
CW
55 'onDuplicate',
56 'dateFormats',
57 'savedMapping',
be2fb01f 58 ]);
6a488035 59
81c3812a 60 $this->submitFileForMapping('CRM_Activity_Import_Parser_Activity');
6a488035 61 }
96025800 62
6a488035 63}