convert some form elements in email to addfield
authorTim Mallezie <tim.mallezie@chiro.be>
Sun, 17 May 2015 13:20:50 +0000 (15:20 +0200)
committerTim Mallezie <tim.mallezie@chiro.be>
Sun, 17 May 2015 13:20:50 +0000 (15:20 +0200)
CRM/Contact/Form/Edit/Email.php
xml/schema/Core/Email.xml

index d86c8f5645b7a3cc1a18c8113eefb531c76c0ade..81ddd1cff855ed61475df052260d0eeb836a41e7 100644 (file)
@@ -62,16 +62,13 @@ class CRM_Contact_Form_Edit_Email {
     $form->applyFilter('__ALL__', 'trim');
 
     //Email box
-    $form->addElement('text', "email[$blockId][email]", ts('Email'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', 'email'));
+    $form->addField("email[$blockId][email]", array('entity' => 'email'));
     $form->addRule("email[$blockId][email]", ts('Email is not valid.'), 'email');
     if (isset($form->_contactType) || $blockEdit) {
       //Block type
-      $form->addSelect("email[$blockId][location_type_id]", array(
-          'entity' => 'email',
-          'class' => 'eight',
-          'placeholder' => NULL,
-        ));
+      $form->addField("email[$blockId][location_type_id]", array('entity' => 'email', 'placeholder' => NULL, 'class' => 'eight'));
 
+      //TODO: Refactor on_hold field to select.
       $multipleBulk = CRM_Core_BAO_Email::isMultipleBulkMail();
 
       //On-hold select
@@ -84,7 +81,7 @@ class CRM_Contact_Form_Edit_Email {
         $form->addElement('select', "email[$blockId][on_hold]", '', $holdOptions);
       }
       else {
-        $form->addElement('advcheckbox', "email[$blockId][on_hold]", NULL);
+        $form->addField("email[$blockId][on_hold]", array('entity' => 'email'));
       }
 
       //Bulkmail checkbox
index 9e60f7f804dbc20ee99af7c648e679e57a255c3a..bc9cedb87736ebecb3eaabe5847653cd730dcb1f 100644 (file)
     <required>true</required>
     <comment>Is this address on bounce hold?</comment>
     <add>1.1</add>
+    <html>
+      <type>CheckBox</type>
+    </html>
   </field>
   <field>
     <name>is_bulkmail</name>