Enotice fix
[civicrm-core.git] / CRM / Contact / Import / ImportJob.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 acts like a psuedo-BAO for transient import job tables.
20 */
21 class CRM_Contact_Import_ImportJob {
22
23 protected $_onDuplicate;
24 protected $_dedupe;
25 protected $_newGroupName;
26 protected $_groups;
27 protected $_allGroups;
28 protected $_newTagName;
29 protected $_tag;
30
31 protected $_mapper;
32 protected $_mapperKeys = [];
33 protected $_mapFields;
34
35 /**
36 * @var CRM_Contact_Import_Parser_Contact
37 */
38 protected $_parser;
39
40 protected $_userJobID;
41
42 /**
43 * Has the job completed.
44 *
45 * @return bool
46 */
47 public function isComplete(): bool {
48 return $this->_parser->isComplete();
49 }
50
51 /**
52 * @param array $params
53 */
54 public function setJobParams(&$params) {
55 foreach ($params as $param => $value) {
56 $fldName = "_$param";
57 $this->$fldName = $value;
58 }
59 }
60
61 /**
62 * @param CRM_Core_Form $form
63 * @param int $timeout
64 */
65 public function runImport(&$form, $timeout = 55) {
66 $mapper = $this->_mapper;
67 foreach ($mapper as $key => $value) {
68 $this->_mapperKeys[$key] = $mapper[$key][0] ?? NULL;
69 }
70
71 }
72
73 /**
74 * @param $form
75 */
76 public function setFormVariables($form) {
77 $this->_parser->set($form, CRM_Import_Parser::MODE_IMPORT);
78 }
79
80 }