X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FImport%2FParser.php;h=3c71a3ca33a1d485a6673d65be1d09759a3d10fe;hb=b1498fdac6ad37161424c6b48f3facf7936c8666;hp=c37bc4daf2c7185b9932465e5b96ec1f88bc609e;hpb=01fcf9d6be949c51b4a3eb1b2c1511ddb8c88f79;p=civicrm-core.git diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index c37bc4daf2..3c71a3ca33 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -59,16 +59,19 @@ abstract class CRM_Import_Parser { /** * Total number of non empty lines + * @var int */ protected $_totalCount; /** * Running total number of valid lines + * @var int */ protected $_validCount; /** * Running total number of invalid rows + * @var int */ protected $_invalidRowCount; @@ -81,41 +84,49 @@ abstract class CRM_Import_Parser { /** * Array of error lines, bounded by MAX_ERROR + * @var array */ protected $_errors; /** * Total number of conflict lines + * @var int */ protected $_conflictCount; /** * Array of conflict lines + * @var array */ protected $_conflicts; /** * Total number of duplicate (from database) lines + * @var int */ protected $_duplicateCount; /** * Array of duplicate lines + * @var array */ protected $_duplicates; /** * Running total number of warnings + * @var int */ protected $_warningCount; /** * Maximum number of warnings to store + * @var int */ protected $_maxWarningCount = self::MAX_WARNINGS; /** * Array of warning lines, bounded by MAX_WARNING + * @var array */ protected $_warnings; @@ -126,6 +137,33 @@ abstract class CRM_Import_Parser { */ protected $_fields; + /** + * Metadata for all available fields, keyed by unique name. + * + * This is intended to supercede $_fields which uses a special sauce format which + * importableFieldsMetadata uses the standard getfields type format. + * + * @var array + */ + protected $importableFieldsMetadata = []; + + /** + * Get metadata for all importable fields in std getfields style format. + * + * @return array + */ + public function getImportableFieldsMetadata(): array { + return $this->importableFieldsMetadata; + } + + /** + * Set metadata for all importable fields in std getfields style format. + * @param array $importableFieldsMetadata + */ + public function setImportableFieldsMetadata(array $importableFieldsMetadata) { + $this->importableFieldsMetadata = $importableFieldsMetadata; + } + /** * Array of the fields that are actually part of the import process * the position in the array also dictates their position in the import @@ -273,7 +311,7 @@ abstract class CRM_Import_Parser { * (reference) associative array of name/value pairs */ public function &getActiveFieldParams() { - $params = array(); + $params = []; for ($i = 0; $i < $this->_activeFieldCount; $i++) { if (isset($this->_activeFields[$i]->_value) && !isset($params[$this->_activeFields[$i]->_name]) @@ -309,7 +347,7 @@ abstract class CRM_Import_Parser { if ($startImport) { $status = "