$search = ($config->includeWildCardInName) ? "%$sortName%" : "$sortName%";
$where[] = "( sort_name LIKE '$search' )";
}
+ if ($cid = CRM_Utils_Array::value('contact_id', $params)) {
+ $where[] = " c.id = $cid ";
+ }
if (is_array($excludeCaseIds) &&
!CRM_Utils_System::isNull($excludeCaseIds)
) {
$defaults['file_on_case_activity_subject'] = $defaults['subject'];
$defaults['file_on_case_target_contact_id'] = $defaults['target_contact'];
+ $cid = CRM_Utils_Request::retrieve('cid', 'Integer');
+ if ($cid) {
+ $cases = CRM_Case_BAO_Case::getUnclosedCases(array('contact_id' => $cid), $this->_currentCaseId);
+ foreach ($cases as $id => $details) {
+ $defaults['file_on_case_unclosed_case_id'] = $id;
+ $value = array('label' => $details['sort_name'] . ' - ' . $details['case_type']);
+ $this->updateElementAttr('file_on_case_unclosed_case_id', array('data-value' => json_encode($value)));
+ break;
+ }
+ }
+
return $defaults;
}
formatSelection: function(row) {
return row.label;
},
+ initSelection: function($el, callback) {
+ callback($el.data('value'));
+ },
ajax: {
url: {/literal}"{crmURL p='civicrm/case/ajax/unclosed' h=0}"{literal},
data: function(term) {