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

Expose mapping search task to Search Kit #19561

Merged
merged 1 commit into from
Mar 31, 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
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static function preProcessCommon(&$form) {
$form->_contactIds = [];
$form->_contactTypes = [];

$isStandAlone = in_array('task', $form->urlPath) || in_array('standalone', $form->urlPath);
$isStandAlone = in_array('task', $form->urlPath) || in_array('standalone', $form->urlPath) || in_array('map', $form->urlPath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could call $form->isStandAlone() & then on the CRM_Contact_Form_Task_Map form it could return TRUE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton is that a new function or just something I haven't come across but yeh I'm thinking that might be what is needed, the map task does get used in a number of different contexts so will need to check if this does anything to them (don't think so but maybe)

if ($isStandAlone) {
[$form->_task, $title] = CRM_Contact_Task::getTaskAndTitleByClass(get_class($form));
if (!array_key_exists($form->_task, CRM_Contact_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission()))) {
Expand Down
2 changes: 2 additions & 0 deletions CRM/Contact/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ public static function tasks() {
'title' => ts('Map contacts'),
'class' => 'CRM_Contact_Form_Task_Map',
'result' => FALSE,
'url' => 'civicrm/contact/map',
'icon' => 'fa-map',
);
}

Expand Down
11 changes: 6 additions & 5 deletions templates/CRM/Contact/Form/Task/Map/OpenStreetMaps.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@
popup.create(evt);
}

if (window.addEventListener) {
window.addEventListener("load", initMap, false);
} else if (window.attachEvent) {
document.attachEvent("onreadystatechange", initMap);
}
var checkExist = setInterval(function() {
if (typeof OpenLayers !== 'undefined') {
clearInterval(checkExist);
initMap();
}
}, 100); // check every 100ms

function gpopUp() {
var from = document.getElementById('from').value;
Expand Down