class CRM_Import_Parser

Constants

MAX_ERRORS

Settings

MAX_WARNINGS

Settings

DEFAULT_TIMEOUT

Settings

VALID

Return codes

WARNING

Return codes

ERROR

Return codes

CONFLICT

Return codes

STOP

Return codes

DUPLICATE

Return codes

MULTIPLE_DUPE

Return codes

NO_MATCH

Return codes

UNPARSED_ADDRESS_WARNING

Return codes

MODE_MAPFIELD

Parser modes

MODE_PREVIEW

Parser modes

MODE_SUMMARY

Parser modes

MODE_IMPORT

Parser modes

DUPLICATE_SKIP

Codes for duplicate record handling

DUPLICATE_REPLACE

Codes for duplicate record handling

DUPLICATE_UPDATE

Codes for duplicate record handling

DUPLICATE_FILL

Codes for duplicate record handling

DUPLICATE_NOCHECK

Codes for duplicate record handling

CONTACT_INDIVIDUAL

Contact types

CONTACT_HOUSEHOLD

Contact types

CONTACT_ORGANIZATION

Contact types

Properties

protected $_totalCount Total number of non empty lines
protected $_validCount Running total number of valid lines
protected $_invalidRowCount Running total number of invalid rows
protected int $_maxLinesToProcess Maximum number of non-empty/comment lines to process
protected $_maxErrorCount Maximum number of invalid rows to store
protected $_errors Array of error lines, bounded by MAX_ERROR
protected $_conflictCount Total number of conflict lines
protected $_conflicts Array of conflict lines
protected $_duplicateCount Total number of duplicate (from database) lines
protected $_duplicates Array of duplicate lines
protected $_warningCount Running total number of warnings
protected $_maxWarningCount Maximum number of warnings to store
protected $_warnings Array of warning lines, bounded by MAX_WARNING
protected array $_fields Array of all the fields that could potentially be part of this import process
protected array $_activeFields Array of the fields that are actually part of the import process the position in the array also dictates their position in the import file
protected int $_activeFieldCount Cache the count of active fields
protected array $_rows Cache of preview rows
protected string $_errorFileName Filename of error data
protected string $_conflictFileName Filename of conflict data
protected string $_duplicateFileName Filename of duplicate data
int $_contactType Contact type
int $_contactSubType Contact sub-type

Methods

__construct()

Class constructor.

init()

Abstract function definitions.

mixed
fini()

No description

mixed
mapField(array $values)

Map field.

mixed
preview(array $values)

Preview.

mixed
summary($values)

No description

mixed
import($onDuplicate, $values)

No description

int
setActiveFieldValues(array $elements, $erroneousField)

Set and validate field values.

array
getActiveFieldParams()

Format the field values for input to the api.

array
getSelectValues()

No description

array
getSelectTypes()

No description

array
getHeaderPatterns()

No description

array
getDataPatterns()

No description

static void
encloseScrub(array $values, string $enclosure = "'")

Remove single-quote enclosures from a value array (row).

void
setMaxLinesToProcess(int $max)

Setter function.

static string
errorFileName($type)

Determines the file extension based on error code.

static string
saveFileName($type)

Determines the file name based on error code.

Details

at line 193
__construct()

Class constructor.

at line 201
abstract protected init()

Abstract function definitions.

at line 206
abstract protected mixed fini()

Return Value

mixed

at line 215
abstract protected mixed mapField(array $values)

Map field.

Parameters

array $values

Return Value

mixed

at line 224
abstract protected mixed preview(array $values)

Preview.

Parameters

array $values

Return Value

mixed

at line 231
abstract protected mixed summary($values)

Parameters

$values

Return Value

mixed

at line 239
abstract protected mixed import($onDuplicate, $values)

Parameters

$onDuplicate
$values

Return Value

mixed

at line 251
int setActiveFieldValues(array $elements, $erroneousField)

Set and validate field values.

Parameters

array $elements array.
$erroneousField reference.

Return Value

int

at line 281
array getActiveFieldParams()

Format the field values for input to the api.

Return Value

array (reference) associative array of name/value pairs

at line 298
array getSelectValues()

Return Value

array

at line 309
array getSelectTypes()

Return Value

array

at line 322
array getHeaderPatterns()

Return Value

array

at line 335
array getDataPatterns()

Return Value

array

at line 351
static void encloseScrub(array $values, string $enclosure = "'")

Remove single-quote enclosures from a value array (row).

Parameters

array $values
string $enclosure

Return Value

void

at line 368
void setMaxLinesToProcess(int $max)

Setter function.

Parameters

int $max

Return Value

void

at line 378
static string errorFileName($type)

Determines the file extension based on error code.

Parameters

$type

Return Value

string

at line 417
static string saveFileName($type)

Determines the file name based on error code.

Parameters

$type

Return Value

string