Commit | Line | Data |
---|---|---|
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 | |
bc77d7c0 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | /** | |
616eac7e | 19 | * This class acts like a psuedo-BAO for transient import job tables. |
6a488035 | 20 | */ |
719a6fec | 21 | class CRM_Contact_Import_ImportJob { |
6a488035 | 22 | |
6a488035 TO |
23 | protected $_onDuplicate; |
24 | protected $_dedupe; | |
25 | protected $_newGroupName; | |
6a488035 TO |
26 | protected $_groups; |
27 | protected $_allGroups; | |
28 | protected $_newTagName; | |
6a488035 | 29 | protected $_tag; |
6a488035 TO |
30 | |
31 | protected $_mapper; | |
affcc9d2 | 32 | protected $_mapperKeys = []; |
6a488035 TO |
33 | protected $_mapFields; |
34 | ||
10716b26 EM |
35 | /** |
36 | * @var CRM_Contact_Import_Parser_Contact | |
37 | */ | |
6a488035 TO |
38 | protected $_parser; |
39 | ||
10716b26 EM |
40 | protected $_userJobID; |
41 | ||
86538308 | 42 | /** |
91971b3c | 43 | * Has the job completed. |
86538308 EM |
44 | * |
45 | * @return bool | |
86538308 | 46 | */ |
3377d521 EM |
47 | public function isComplete(): bool { |
48 | return $this->_parser->isComplete(); | |
6a488035 TO |
49 | } |
50 | ||
86538308 | 51 | /** |
c490a46a | 52 | * @param array $params |
86538308 | 53 | */ |
6a488035 TO |
54 | public function setJobParams(&$params) { |
55 | foreach ($params as $param => $value) { | |
0e6e8724 DL |
56 | $fldName = "_$param"; |
57 | $this->$fldName = $value; | |
6a488035 TO |
58 | } |
59 | } | |
60 | ||
86538308 | 61 | /** |
c490a46a | 62 | * @param CRM_Core_Form $form |
86538308 EM |
63 | * @param int $timeout |
64 | */ | |
6a488035 | 65 | public function runImport(&$form, $timeout = 55) { |
353ffa53 | 66 | $mapper = $this->_mapper; |
6a488035 | 67 | foreach ($mapper as $key => $value) { |
4b9ffb80 | 68 | $this->_mapperKeys[$key] = $mapper[$key][0] ?? NULL; |
6a488035 TO |
69 | } |
70 | ||
6a488035 TO |
71 | } |
72 | ||
86538308 EM |
73 | /** |
74 | * @param $form | |
75 | */ | |
6a488035 | 76 | public function setFormVariables($form) { |
a05662ef | 77 | $this->_parser->set($form, CRM_Import_Parser::MODE_IMPORT); |
6a488035 TO |
78 | } |
79 | ||
6a488035 | 80 | } |