From a03d5ab9c5c2206068d243951e32ff6f41338d0a Mon Sep 17 00:00:00 2001 From: Maggie Date: Thu, 1 May 2014 21:14:24 -0400 Subject: [PATCH] Prepopulated autoselect with email values--found bug caused by other code to be reconciled later --- CRM/Contact/Form/Task/EmailCommon.php | 8 ++++---- templates/CRM/Contact/Form/Task/Email.tpl | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index 78863890cd..0d7e035fcc 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -133,7 +133,7 @@ class CRM_Contact_Form_Task_EmailCommon { if (count($form->_contactIds) > 1) { $form->_single = FALSE; } - + $emailAttributes = array( 'class' => 'huge', ); @@ -224,19 +224,19 @@ class CRM_Contact_Form_Task_EmailCommon { if (in_array($contactId, $form->_toContactIds)) { $form->_toContactDetails[$contactId] = $form->_contactDetails[$contactId]; $toArray[] = array( - 'name' => '"' . $value['sort_name'] . '" <' . $email . '>', + 'text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "$contactId::{$email}", ); } elseif (in_array($contactId, $form->_ccContactIds)) { $ccArray[] = array( - 'name' => '"' . $value['sort_name'] . '" <' . $email . '>', + 'text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "$contactId::{$email}", ); } elseif (in_array($contactId, $form->_bccContactIds)) { $bccArray[] = array( - 'name' => '"' . $value['sort_name'] . '" <' . $email . '>', + 'text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "$contactId::{$email}", ); } diff --git a/templates/CRM/Contact/Form/Task/Email.tpl b/templates/CRM/Contact/Form/Task/Email.tpl index 29cf4b9225..d1f7823e13 100644 --- a/templates/CRM/Contact/Form/Task/Email.tpl +++ b/templates/CRM/Contact/Form/Task/Email.tpl @@ -107,7 +107,7 @@ CRM.$(function($){ var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}"; - function emailSelect(el){ + function emailSelect(el, prepopulate){ $(el).data('api-entity', 'contact').crmSelect2({ minimumInputLength: 1, multiple: true, @@ -124,11 +124,11 @@ CRM.$(function($){ }; } } - }); + }).select2('data', prepopulate); } - emailSelect('#to'); - emailSelect('#cc_id'); - emailSelect('#bcc_id'); + emailSelect('#to', toContact); + emailSelect('#cc_id', ccContact); + emailSelect('#bcc_id', bccContact); }); -- 2.25.1