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