CRM_Import_Parser
abstract class CRM_Import_Parser
Constants
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 int | $_totalCount | Total number of non empty lines | |
protected int | $_validCount | Running total number of valid lines | |
protected int | $_invalidRowCount | Running total number of invalid rows | |
protected int | $_maxLinesToProcess | Maximum number of non-empty/comment lines to process | |
protected array | $_errors | Array of error lines, bounded by MAX_ERROR | |
protected int | $_conflictCount | Total number of conflict lines | |
protected array | $_conflicts | Array of conflict lines | |
protected int | $_duplicateCount | Total number of duplicate (from database) lines | |
protected array | $_duplicates | Array of duplicate lines | |
protected int | $_warningCount | Running total number of warnings | |
protected int | $_maxWarningCount | Maximum number of warnings to store | |
protected array | $_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 | $importableFieldsMetadata | Metadata for all available fields, keyed by unique name. | |
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
Get metadata for all importable fields in std getfields style format.
Set metadata for all importable fields in std getfields style format.
Class constructor.
Abstract function definitions.
No description
Map field.
Preview.
No description
No description
Set and validate field values.
Format the field values for input to the api.
Add progress bar to the import process. Calculates time remaining, status etc.
No description
No description
No description
No description
Remove single-quote enclosures from a value array (row).
Setter function.
Determines the file extension based on error code.
Determines the file name based on error code.
Check if contact is a duplicate .
Parse a field which could be represented by a label or name value rather than the DB value.
Details
at line 155
array
getImportableFieldsMetadata()
Get metadata for all importable fields in std getfields style format.
at line 163
setImportableFieldsMetadata(array $importableFieldsMetadata)
Set metadata for all importable fields in std getfields style format.
at line 226
__construct()
Class constructor.
at line 233
abstract protected
init()
Abstract function definitions.
at line 238
abstract protected mixed
fini()
at line 247
abstract protected mixed
mapField(array $values)
Map field.
at line 256
abstract protected mixed
preview(array $values)
Preview.
at line 263
abstract protected mixed
summary($values)
at line 271
abstract protected mixed
import($onDuplicate, $values)
at line 283
int
setActiveFieldValues(array $elements, $erroneousField)
Set and validate field values.
at line 313
array
getActiveFieldParams()
Format the field values for input to the api.
at line 343
NULL|$currTimestamp
progressImport($statusID, bool $startImport = TRUE, $startTimestamp = NULL, $prevTimestamp = NULL, $totalRowCount = NULL)
Add progress bar to the import process. Calculates time remaining, status etc.
at line 385
array
getSelectValues()
at line 396
array
getSelectTypes()
at line 409
array
getHeaderPatterns()
at line 422
array
getDataPatterns()
at line 438
static void
encloseScrub(array $values, string $enclosure = "'")
Remove single-quote enclosures from a value array (row).
at line 455
void
setMaxLinesToProcess(int $max)
Setter function.
at line 465
static string
errorFileName($type)
Determines the file extension based on error code.
at line 504
static string
saveFileName($type)
Determines the file name based on error code.
at line 541
protected array
checkContactDuplicate(array $formatValues)
Check if contact is a duplicate .
at line 563
protected mixed
parsePseudoConstantField(string|int|null $submittedValue, array $fieldSpec)
Parse a field which could be represented by a label or name value rather than the DB value.
We will try to match name first or (per https://lab.civicrm.org/dev/core/issues/1285 if we have an id.
but if not available then see if we have a label that can be converted to a name.