Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.18 #15290

Merged
merged 6 commits into from
Sep 12, 2019
Merged

5.18 #15290

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions CRM/Core/BAO/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ public static function buildMappingForm(&$form, $mappingType, $mappingId, $colum
);
}

$contactTypes = CRM_Contact_BAO_ContactType::basicTypes();
$fields = self::getBasicFields($mappingType);

// Unset groups, tags, notes for component export
Expand All @@ -383,14 +384,21 @@ public static function buildMappingForm(&$form, $mappingType, $mappingId, $colum
}

if ($mappingType == 'Search Builder') {
//build the common contact fields array.
// Build the common contact fields array.
$fields['Contact'] = [];
foreach ($fields['Individual'] as $key => $value) {
if (!empty($fields['Household'][$key]) && !empty($fields['Organization'][$key])) {
foreach ($fields[$contactTypes[0]] as $key => $value) {
// If a field exists across all contact types, move it to the "Contact" selector
$ubiquitious = TRUE;
foreach ($contactTypes as $type) {
if (!isset($fields[$type][$key])) {
$ubiquitious = FALSE;
}
}
if ($ubiquitious) {
$fields['Contact'][$key] = $value;
unset($fields['Organization'][$key],
$fields['Household'][$key],
$fields['Individual'][$key]);
foreach ($contactTypes as $type) {
unset($fields[$type][$key]);
}
}
}
if (array_key_exists('note', $fields['Contact'])) {
Expand Down Expand Up @@ -429,7 +437,7 @@ public static function buildMappingForm(&$form, $mappingType, $mappingId, $colum
}
}

if (array_key_exists('related', $relatedMapperFields[$key])) {
if (isset($relatedMapperFields[$key]['related'])) {
unset($relatedMapperFields[$key]['related']);
}
}
Expand All @@ -451,18 +459,18 @@ public static function buildMappingForm(&$form, $mappingType, $mappingId, $colum

// since we need a hierarchical list to display contact types & subtypes,
// this is what we going to display in first selector
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, FALSE);
$contactTypeSelect = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, FALSE);
if ($mappingType == 'Search Builder') {
$contactTypes = ['Contact' => ts('Contacts')] + $contactTypes;
$contactTypeSelect = ['Contact' => ts('Contacts')] + $contactTypeSelect;
}

$sel1 = ['' => ts('- select record type -')] + $contactTypes + $compArray;
$sel1 = ['' => ts('- select record type -')] + $contactTypeSelect + $compArray;

foreach ($sel1 as $key => $sel) {
if ($key) {
// sort everything BUT the contactType which is sorted separately by
// an initial commit of CRM-13278 (check ksort above)
if (!in_array($key, ['Individual', 'Household', 'Organization'])) {
if (!in_array($key, $contactTypes)) {
asort($mapperFields[$key]);
}
$sel2[$key] = ['' => ts('- select field -')] + $mapperFields[$key];
Expand Down
1 change: 1 addition & 0 deletions CRM/Export/BAO/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public static function exportComponents(
}
$processor->setComponentTable($componentTable);
$processor->setComponentClause($componentClause);
$processor->setIds($ids);

list($query, $queryString) = $processor->runQuery($params, $order);

Expand Down
30 changes: 29 additions & 1 deletion CRM/Export/BAO/ExportProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ class CRM_Export_BAO_ExportProcessor {
*/
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.
*
Expand Down Expand Up @@ -585,6 +592,20 @@ public function setQueryOperator($queryOperator) {
$this->queryOperator = $queryOperator;
}

/**
* @return array
*/
public function getIds() {
return $this->ids;
}

/**
* @param array $ids
*/
public function setIds($ids) {
$this->ids = $ids;
}

/**
* @return array
*/
Expand Down Expand Up @@ -2327,7 +2348,14 @@ public function writeCSVFromTable() {
// 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);
Expand Down Expand Up @@ -2356,7 +2384,7 @@ public function writeCSVFromTable() {
while ($dao->fetch()) {
$row = [];

foreach (array_keys($this->getSQLColumns()) as $column) {
foreach (array_keys($sqlColumns) as $column) {
$row[$column] = $dao->$column;
}
$componentDetails[] = $row;
Expand Down
9 changes: 9 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ Other resources for identifying changes are:
* https://github.com/civicrm/civicrm-joomla
* https://github.com/civicrm/civicrm-wordpress

## CiviCRM 5.17.3

Released September 10, 2019

- **[Synopsis](release-notes/5.17.3.md#synopsis)**
- **[Bugs resolved](release-notes/5.17.3.md#bugs)**
- **[Credits](release-notes/5.17.3.md#credits)**
- **[Feedback](release-notes/5.17.3.md#feedback)**

## CiviCRM 5.17.2

Released September 9, 2019
Expand Down
40 changes: 40 additions & 0 deletions release-notes/5.17.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# CiviCRM 5.17.3

Released September 10, 2019

- **[Synopsis](#synopsis)**
- **[Bugs resolved](#bugs)**
- **[Credits](#credits)**
- **[Feedback](#feedback)**

## <a name="synopsis"></a>Synopsis

| *Does this version...?* | |
|:--------------------------------------------------------------- |:-------:|
| Fix security vulnerabilities? | no |
| Change the database schema? | no |
| Alter the API? | no |
| Require attention to configuration options? | no |
| Fix problems installing or upgrading to a previous version? | no |
| Introduce features? | no |
| **Fix bugs?** | **yes** |

## <a name="bugs"></a>Bugs resolved

- **_Advanced Search_: Fix additional issues with email filtering ([#15275](https://github.com/civicrm/civicrm-core/pull/15275), [#15276](https://github.com/civicrm/civicrm-core/pull/15276))**
- **_CiviReports_: Present reports using backend UI ([#15261](https://github.com/civicrm/civicrm-core/pull/15261))**
- **_Drupal 8_: Resolve new warnings about deprecated `q` variable ([dev/core#52](https://lab.civicrm.org/dev/drupal/issues/52): [#15268](https://github.com/civicrm/civicrm-core/pull/15268))**

## <a name="credits"></a>Credits

This release was developed by the following authors and reviewers:

Wikimedia Foundation - Eileen McNaughton; SemperIT - Karin Gerritsen; John
Kingsnorth; Jens Schuppe; Coop SymbioTIC - Mathieu Lutfy; CiviCRM - Tim
Otten; Australian Greens - Seamus Lee

## <a name="feedback"></a>Feedback

These release notes are edited by Tim Otten and Andrew Hunt. If you'd like to
provide feedback on them, please login to https://chat.civicrm.org/civicrm and
contact `@agh1`.