From dd33678f4b099924f8b2e15a36fdc0e9bc6b7422 Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Wed, 6 Sep 2017 11:39:53 -0400 Subject: [PATCH] CRM-21113: find cases -- use tag multi-select widget --- CRM/Case/BAO/Query.php | 14 ++++++-------- templates/CRM/Case/Form/Search/Common.tpl | 15 ++++----------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/CRM/Case/BAO/Query.php b/CRM/Case/BAO/Query.php index 3a864d6331..9d6828afd6 100644 --- a/CRM/Case/BAO/Query.php +++ b/CRM/Case/BAO/Query.php @@ -481,11 +481,11 @@ class CRM_Case_BAO_Query extends CRM_Core_BAO_Query { case 'case_tags': $tags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE)); - if (is_array($value)) { - foreach ($value as $k => $v) { + if (!empty($value)) { + $val = explode(',', $value); + foreach ($val as $v) { if ($v) { - $val[$k] = $k; - $names[] = $tags[$k]; + $names[] = $tags[$v]; } } } @@ -701,12 +701,10 @@ case_relation_type.id = case_relationship.relationship_type_id )"; } $form->assign('accessAllCases', $accessAllCases); - $caseTags = CRM_Core_BAO_Tag::getTags('civicrm_case'); + $caseTags = CRM_Core_BAO_Tag::getColorTags('civicrm_case'); if ($caseTags) { - foreach ($caseTags as $tagID => $tagName) { - $form->_tagElement = &$form->addElement('checkbox', "case_tags[$tagID]", NULL, $tagName); - } + $form->add('select2', 'case_tags', ts('Case Tag(s)'), $caseTags, FALSE, array('class' => 'big', 'placeholder' => ts('- select -'), 'multiple' => TRUE)); } $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_case'); diff --git a/templates/CRM/Case/Form/Search/Common.tpl b/templates/CRM/Case/Form/Search/Common.tpl index b7fb19777f..4423f75d79 100644 --- a/templates/CRM/Case/Form/Search/Common.tpl +++ b/templates/CRM/Case/Form/Search/Common.tpl @@ -31,11 +31,10 @@ {$form.case_id.label}
{$form.case_id.html} - + {$form.case_subject.label}
{$form.case_subject.html} - @@ -71,15 +70,9 @@ {/if} - {if $form.case_tags} - -
- {foreach from=$form.case_tags item="tag_val"} -
- {$tag_val.html} -
- {/foreach} -
+ {if $form.case_tags.html} + {$form.case_tags.label}
+ {$form.case_tags.html} {/if} -- 2.25.1