*/
protected $contactGreetingFields = [];
+ /**
+ * An array of primary IDs of the entity being exported.
+ *
+ * @var array
+ */
+ protected $ids = [];
+
/**
* Get additional non-visible fields for address merge purposes.
*
$this->queryOperator = $queryOperator;
}
+ /**
+ * @return array
+ */
+ public function getIds() {
+ return $this->ids;
+ }
+
+ /**
+ * @param array $ids
+ */
+ public function setIds($ids) {
+ $this->ids = $ids;
+ }
+
/**
* @return array
*/
$queryFields['country']['context'] = 'country';
$queryFields['world_region']['context'] = 'country';
$queryFields['state_province']['context'] = 'province';
+ $queryFields['contact_id'] = ['title' => ts('Contact ID'), 'type' => CRM_Utils_Type::T_INT];
$this->queryFields = $queryFields;
}
switch ($fieldSpec['type']) {
case CRM_Utils_Type::T_INT:
case CRM_Utils_Type::T_BOOLEAN:
+ if (in_array(CRM_Utils_Array::value('data_type', $fieldSpec), ['Country', 'StateProvince', 'ContactReference'])) {
+ return "$fieldName varchar(255)";
+ }
return "$fieldName varchar(16)";
case CRM_Utils_Type::T_STRING:
$length = max(512, CRM_Utils_Array::value('text_length', $queryFields[$columnName]));
return "$fieldName varchar($length)";
- case 'Country':
- case 'StateProvince':
case 'Link':
return "$fieldName varchar(255)";
// call export hook
$headerRows = $this->getHeaderRows();
$exportTempTable = $this->getTemporaryTable();
+ $exportMode = $this->getExportMode();
+ $sqlColumns = $this->getSQLColumns();
+ $componentTable = $this->getComponentTable();
+ $ids = $this->getIds();
CRM_Utils_Hook::export($exportTempTable, $headerRows, $sqlColumns, $exportMode, $componentTable, $ids);
+ if ($exportMode !== $this->getExportMode() || $componentTable !== $this->getComponentTable()) {
+ CRM_Core_Error::deprecatedFunctionWarning('altering the export mode and/or component table in the hook is no longer supported.');
+ }
if ($exportTempTable !== $this->getTemporaryTable()) {
CRM_Core_Error::deprecatedFunctionWarning('altering the export table in the hook is deprecated (in some flows the table itself will be)');
$this->setTemporaryTable($exportTempTable);
while ($dao->fetch()) {
$row = [];
- foreach (array_keys($this->getSQLColumns()) as $column) {
+ foreach (array_keys($sqlColumns) as $column) {
$row[$column] = $dao->$column;
}
$componentDetails[] = $row;