3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2019
33 class CRM_Activity_Import_Field
{
42 * Title of the field to be used in display
54 * Is this field required
60 * Data to be carried for use by a derived class
66 * Regexp to match the CSV header of this column/field
69 public $_headerPattern;
72 * Regexp to match the pattern of data from various column/fields
87 * @param string $headerPattern
88 * @param string $dataPattern
90 public function __construct($name, $title, $type = CRM_Utils_Type
::T_INT
, $headerPattern = '//', $dataPattern = '//') {
92 $this->_title
= $title;
94 $this->_headerPattern
= $headerPattern;
95 $this->_dataPattern
= $dataPattern;
100 public function resetValue() {
101 $this->_value
= NULL;
105 * The value is in string format. convert the value to the type of this field
106 * and set the field value with the appropriate type
109 public function setValue($value) {
110 $this->_value
= $value;
116 public function validate() {
118 if (CRM_Utils_System
::isNull($this->_value
)) {