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

[dev/core#3470] Search Kit: Mailing labels don't work #25164

Merged
merged 5 commits into from
Dec 19, 2022

Conversation

alifrumin
Copy link
Contributor

Overview

When one creates a SearchKit Search for the "Contacts" entity the Actions dropdown includes an option: "Mailing labels - Print". This action is broken. This PR fixes it. More details can be found on this issue: https://lab.civicrm.org/dev/core/-/issues/3470.

Before

The Search Kit action "Mailing labels - Print" for contact searches does NOT work.

After

The Search Kit action "Mailing labels - Print" for contact searches work.

@MegaphoneJon
Copy link
Contributor

@alifrumin Style check failures.

];

//break out mailing labels for redirect instead of crmPopup
if ($task['title'] == 'Mailing labels - print') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't run this but I think it would be better to check the loop index $id, to be more translation-friendly. if $id == CRM_Core_Task::LABEL_CONTACTS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion just updated the code

$tasks[$entity['name']]['contact.' . $id] = [
'title' => $task['title'],
'icon' => $task['icon'] ?? 'fa-gear',
'crmPopup' => [
Copy link
Member

Choose a reason for hiding this comment

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

It appears the only difference between these 2 blocks of code is this one line 'crmPopup' vs. 'redirect'. That could be a variable. Like

// Print Labels action does not support popups, open full-screen
$actionType = $id == CRM_Core_Task::LABEL_CONTACTS ? 'redirect' : 'crmPopup';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That does make for a smaller more elegant code change, thanks @colemanw

@colemanw
Copy link
Member

@civicrm-builder retest this please

@colemanw colemanw merged commit 5373550 into civicrm:master Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants