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

fixes core#2874 - Search Builder on State/Province with Primary and IN #21646

Merged
merged 1 commit into from
Oct 7, 2021
Merged
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
fixes core#2874 - Search Builder on State/Province with Primary and IN
  • Loading branch information
MegaphoneJon committed Sep 27, 2021
commit 0f7d79e9b6d42ad87f666044e751bfdbf832e419
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ public static function formattedFields(&$params, $row = FALSE) {
// CRM-19081 Fix legacy StateProvince Field Values.
// These derive from smart groups created using search builder under older
// CiviCRM versions.
if (!is_numeric($value) && $fldName == 'state_province') {
if ($fldName == 'state_province' && !is_numeric($value) && !is_array($value)) {
$value = CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_Address', 'state_province_id', $value);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
INSERT INTO civicrm_mapping (id,name,description,mapping_type_id) Values
(114, NULL, NULL, NULL);
INSERT INTO `civicrm_mapping_field` (`id`, `mapping_id`, `name`, `contact_type`, `column_number`, `location_type_id`, `phone_type_id`, `im_provider_id`, `relationship_type_id`, `relationship_direction`, `grouping`, `operator`, `value`, `website_type_id`) VALUES
(2846, 114, 'state_province', 'Contact', 0, NULL, NULL, NULL, NULL, NULL, 1, 'IN', '1501,2704', NULL);
INSERT INTO `civicrm_saved_search` (`id`, `form_values`, `mapping_id`, `search_custom_id`) VALUES
(333, 'a:5:{s:6:"mapper";a:1:{i:1;a:1:{i:0;a:3:{i:0;s:7:"Contact";i:1;s:14:"state_province";i:2;s:1:" ";}}}s:8:"operator";a:1:{i:1;a:1:{i:0;s:2:"IN";}}s:5:"value";a:1:{i:1;a:1:{i:0;s:9:"1501,2074";}}s:8:"radio_ts";s:6:"ts_all";s:4:"task";s:0:"";}', '114', NULL);
INSERT INTO `civicrm_group` (`id`, `name`, `title`, `description`, `source`, `saved_search_id`, `is_active`, `visibility`) VALUES (98, 'core_2874', 'Core 2874 test group', NULL, NULL, 333, 1, 'User and User Admin Only');