Prepopulated autoselect with email values--found bug caused by other code to be recon...
authorMaggie <maggie.epps@gmail.com>
Fri, 2 May 2014 01:14:24 +0000 (21:14 -0400)
committerMaggie <maggie.epps@gmail.com>
Fri, 2 May 2014 01:14:24 +0000 (21:14 -0400)
CRM/Contact/Form/Task/EmailCommon.php
templates/CRM/Contact/Form/Task/Email.tpl

index 78863890cd78f27af34a3c11ff892c0578239434..0d7e035fcc027ffa1bbc038e34f3714255289a5f 100644 (file)
@@ -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'] . '" &lt;' . $email . '&gt;',
+              'text' => '"' . $value['sort_name'] . '" <' . $email . '>',
               'id' => "$contactId::{$email}",
             );
           }
           elseif (in_array($contactId, $form->_ccContactIds)) {
             $ccArray[] = array(
-              'name' => '"' . $value['sort_name'] . '" &lt;' . $email . '&gt;',
+              'text' => '"' . $value['sort_name'] . '" <' . $email . '>',
               'id' => "$contactId::{$email}",
             );
           }
           elseif (in_array($contactId, $form->_bccContactIds)) {
             $bccArray[] = array(
-              'name' => '"' . $value['sort_name'] . '" &lt;' . $email . '&gt;',
+              'text' => '"' . $value['sort_name'] . '" <' . $email . '>',
               'id' => "$contactId::{$email}",
             );
           }
index 29cf4b922529435ed2c49e17daa34fd985643521..d1f7823e13003d75d15636751734067ff364053a 100644 (file)
@@ -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);
 });