CRM-13161, added unique names for prefix_id, gender_id and suffix_id, also code clean...
authorkurund <kurund@civicrm.org>
Wed, 21 Aug 2013 09:52:37 +0000 (15:22 +0530)
committerkurund <kurund@civicrm.org>
Wed, 21 Aug 2013 09:52:37 +0000 (15:22 +0530)
----------------------------------------
* CRM-13161: Greetings are  not evaluated correctly if it includes prefix / suffix
  http://issues.civicrm.org/jira/browse/CRM-13161

CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Query.php
CRM/Core/BAO/UFGroup.php
CRM/Profile/Selector/Listings.php
xml/schema/Contact/Contact.xml

index e1ae8f5d4e309afefa9f925df04243a13daa8f5e..603dd4e12af682f28722f558c652492b83d1fa75 100644 (file)
@@ -1188,9 +1188,9 @@ WHERE id={$id}; ";
             'middle_name',
             'last_name',
             'job_title',
-            'gender_id',
-            'prefix_id',
-            'suffix_id',
+            'gender',
+            'individual_prefix',
+            'individual_suffix',
             'birth_date',
             'organization_name',
             'legal_name',
@@ -1205,9 +1205,9 @@ WHERE id={$id}; ";
             'middle_name',
             'last_name',
             'job_title',
-            'gender_id',
-            'prefix_id',
-            'suffix_id',
+            'gender',
+            'individual_prefix',
+            'individual_suffix',
             'birth_date',
             'household_name',
             'is_deceased',
@@ -1443,9 +1443,9 @@ WHERE id={$id}; ";
               'middle_name',
               'last_name',
               'job_title',
-              'gender_id',
-              'prefix_id',
-              'suffix_id',
+              'gender',
+              'individual_prefix',
+              'individual_suffix',
               'birth_date',
               'organization_name',
               'legal_name',
@@ -1466,9 +1466,9 @@ WHERE id={$id}; ";
               'middle_name',
               'last_name',
               'job_title',
-              'gender_id',
-              'prefix_id',
-              'suffix_id',
+              'gender',
+              'individual_prefix',
+              'individual_suffix',
               'birth_date',
               'household_name',
               'email_greeting_custom',
index 0485f70ff044780474f0babc8c443a69bdac887f..fb4e52c37a88d1e53fde5ba4a9618e09d5771ef1 100644 (file)
@@ -711,13 +711,22 @@ class CRM_Contact_BAO_Query {
               if (in_array($tName, array('country', 'state_province', 'county'))) {
                 $pf = ($tName == 'state_province') ? 'state_province_name' : $name;
                 $this->_pseudoConstantsSelect[$pf] =
-                  array('pseudoField' => "{$tName}_id", 'idCol' => "{$tName}_id", 'bao' => 'CRM_Core_BAO_Address',
-                    'table' => "civicrm_{$tName}", 'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id ");
+                  array(
+                    'pseudoField' => "{$tName}_id",
+                    'idCol' => "{$tName}_id",
+                    'bao' => 'CRM_Core_BAO_Address',
+                    'table' => "civicrm_{$tName}",
+                    'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id "
+                  );
 
                 if ($tName == 'state_province') {
                   $this->_pseudoConstantsSelect[$tName] =
-                    array('pseudoField' => 'state_province_abbreviation', 'idCol' => "{$tName}_id",
-                      'table' => "civicrm_{$tName}", 'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id ");
+                    array(
+                      'pseudoField' => 'state_province_abbreviation',
+                      'idCol' => "{$tName}_id",
+                      'table' => "civicrm_{$tName}",
+                      'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id "
+                    );
                 }
 
                 $this->_select["{$tName}_id"] = "civicrm_address.{$tName}_id as {$tName}_id";
@@ -747,14 +756,26 @@ class CRM_Contact_BAO_Query {
                   $this->_select[$name] = "IF ( contact_a.contact_type = 'Individual', NULL, contact_a.organization_name ) as organization_name";
                 }
                 elseif ($fieldName != 'id') {
-                  if ($fieldName == 'prefix_id') {
-                    $this->_pseudoConstantsSelect['individual_prefix'] = array('pseudoField' => 'prefix_id', 'idCol' => "prefix_id", 'bao' => 'CRM_Contact_BAO_Contact');
+                  if ($name == 'individual_prefix') {
+                    $this->_pseudoConstantsSelect['individual_prefix'] = array(
+                      'pseudoField' => 'prefix_id',
+                      'idCol' => "individual_prefix",
+                      'bao' => 'CRM_Contact_BAO_Contact'
+                    );
                   }
-                  if ($fieldName == 'suffix_id') {
-                    $this->_pseudoConstantsSelect['individual_suffix'] = array('pseudoField' => 'suffix_id', 'idCol' => "suffix_id", 'bao' => 'CRM_Contact_BAO_Contact');
+                  if ($name == 'individual_suffix') {
+                    $this->_pseudoConstantsSelect['individual_suffix'] = array(
+                      'pseudoField' => 'suffix_id',
+                      'idCol' => "individual_suffix",
+                      'bao' => 'CRM_Contact_BAO_Contact'
+                    );
                   }
-                  if ($fieldName == 'gender_id') {
-                    $this->_pseudoConstantsSelect['gender'] = array('pseudoField' => 'gender_id', 'idCol' => "gender_id", 'bao' => 'CRM_Contact_BAO_Contact');
+                  if ($name == 'gender') {
+                    $this->_pseudoConstantsSelect['gender'] = array(
+                      'pseudoField' => 'gender_id',
+                      'idCol' => "gender",
+                      'bao' => 'CRM_Contact_BAO_Contact'
+                    );
                   }
                   $this->_select[$name] = "contact_a.{$fieldName}  as `$name`";
                 }
@@ -1820,6 +1841,12 @@ class CRM_Contact_BAO_Query {
     if (!$field) {
       $field = CRM_Utils_Array::value($locType[0], $this->_fields);
 
+      // handling for special fields like gender
+      $specialFields = array('gender_id' => 'gender');
+      if (!$field && array_key_exists($name, $specialFields)) {
+        $field = $this->_fields[$specialFields[$name]];
+      }
+
       if (!$field) {
         return;
       }
@@ -3827,7 +3854,6 @@ WHERE  id IN ( $groupIDs )
       }
     }
 
-
     $relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
     $relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
     $relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
@@ -3981,10 +4007,10 @@ civicrm_relationship.start_date > {$today}
           'first_name' => 1,
           'middle_name' => 1,
           'last_name' => 1,
-          'prefix_id' => 1,
-          'suffix_id' => 1,
+          'individual_prefix' => 1,
+          'individual_suffix' => 1,
           'birth_date' => 1,
-          'gender_id' => 1,
+          'gender' => 1,
           'street_address' => 1,
           'supplemental_address_1' => 1,
           'supplemental_address_2' => 1,
@@ -5006,7 +5032,14 @@ AND   displayRelType.is_active = 1
       $qill = $value;
     }
 
-    $pseudoFields = array('email_greeting', 'postal_greeting', 'addressee', 'gender_id', 'prefix_id', 'suffix_id');
+    $pseudoFields = array(
+      'email_greeting',
+      'postal_greeting',
+      'addressee',
+      'gender',
+      'individual_prefix',
+      'individual_suffix',
+    );
 
     if (is_numeric($value)) {
       $qill = $selectValues[(int ) $value];
@@ -5040,7 +5073,7 @@ AND   displayRelType.is_active = 1
     }
 
     if (in_array($name, $pseudoFields)) {
-      if (!in_array($name, array('gender_id', 'prefix_id', 'suffix_id'))) {
+      if (!in_array($name, array('gender', 'individual_prefix', 'individual_suffix'))) {
         $wc = "contact_a.{$name}_id";
       }
       $dataType = 'Positive';
@@ -5115,6 +5148,9 @@ AND   displayRelType.is_active = 1
           $dao->$key = NULL;
         }
         elseif ($baoName = CRM_Utils_Array::value('bao', $value, NULL)) {
+          //preserve id value
+          $idColumn = "{$key}_id";
+          $dao->$idColumn = $val;
           $dao->$key = CRM_Core_PseudoConstant::getLabel($baoName, $value['pseudoField'], $val);
         }
         elseif ($value['pseudoField'] == 'state_province_abbreviation') {
index 7b9e18cf996fb7c980045e4bb86f91d85e0e5d63..149b02f630ffa1aedd0f9278695983b8f9a15a15 100644 (file)
@@ -949,9 +949,10 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup {
       // hack for CRM-665
       if (isset($details->$name) || $name == 'group' || $name == 'tag') {
         // to handle gender / suffix / prefix
-        if (in_array(substr($name, 0, -3), array('gender', 'prefix', 'suffix'))) {
-          $values[$index] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $name, $details->$name);
-          $params[$index] = $details->$name;
+        if (in_array(substr($name, -6), array('gender', 'prefix', 'suffix'))) {
+          $values[$index] = $details->$name;
+          $idColumn = "{$name}_id";
+          $params[$index] = $details->$idColumn;
         }
         elseif (in_array($name, CRM_Contact_BAO_Contact::$_greetingTypes)) {
           $dname          = $name . '_display';
@@ -1846,7 +1847,7 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
           '' => ts('- select -')) + CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'), $required
       );
     }
-    elseif ($fieldName === 'gender_id') {
+    elseif ($fieldName === 'gender') {
       $genderOptions = array();
       $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
       foreach ($gender as $key => $var) {
@@ -1857,13 +1858,13 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
         $form->addRule($name, ts('%1 is a required field.', array(1 => $title)), 'required');
       }
     }
-    elseif ($fieldName === 'prefix_id') {
+    elseif ($fieldName === 'individual_prefix') {
       $form->add('select', $name, $title,
         array(
           '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'), $required
       );
     }
-    elseif ($fieldName === 'suffix_id') {
+    elseif ($fieldName === 'individual_suffix') {
       $form->add('select', $name, $title,
         array(
           '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'), $required
index 39fd3d4de55d915b826a7fb7cb25eb9d15f164ca..7046fb14dcdb3b2bb638d61bf2a9e5c9384d79ab 100644 (file)
@@ -618,9 +618,6 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR
         elseif ($name == 'preferred_language') {
           $row[] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'preferred_language', $result->$name);
         }
-        elseif (in_array(substr($name, 0, -3), array('gender', 'prefix', 'suffix'))) {
-          $row[] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $name, $result->$name);
-        }
         elseif ($multipleSelectFields &&
           array_key_exists($name, $multipleSelectFields)
         ) {
index 6c90dc3b9866f35b77f17413d8890a7ca17525e0..ed1afdfea8b83c7975c0c53f595d7c6dc52af6fa 100644 (file)
   <comment>Contact objects are defined by a civicrm_contact record plus a related civicrm_contact_type record.</comment>
   <add>1.1</add>
   <log>true</log>
- <field>
-      <name>id</name>
-      <type>int unsigned</type>
-      <title>Internal Contact ID</title>
-      <import>true</import>
-      <headerPattern>/internal|contact?|id$/i</headerPattern>
-      <required>true</required>
-      <comment>Unique Contact ID</comment>
-      <add>1.1</add>
 <field>
+    <name>id</name>
+    <type>int unsigned</type>
+    <title>Internal Contact ID</title>
+    <import>true</import>
+    <headerPattern>/internal|contact?|id$/i</headerPattern>
+    <required>true</required>
+    <comment>Unique Contact ID</comment>
+    <add>1.1</add>
   </field>
   <primaryKey>
-       <name>id</name>
-       <autoincrement>true</autoincrement>
+    <name>id</name>
+    <autoincrement>true</autoincrement>
   </primaryKey>
   <field>
-       <name>contact_type</name>
-       <title>Contact Type</title>
-       <type>varchar</type>
-       <length>64</length>
-       <comment>Type of Contact.</comment>
-       <export>true</export>
-       <pseudoconstant>
-        <table>civicrm_contact_type</table>
-        <keyColumn>name</keyColumn>
-        <labelColumn>label</labelColumn>
-        <condition>parent_id IS NULL</condition>
-      </pseudoconstant>
-       <add>1.1</add>
-       <change>3.1</change>
+    <name>contact_type</name>
+    <title>Contact Type</title>
+    <type>varchar</type>
+    <length>64</length>
+    <comment>Type of Contact.</comment>
+    <export>true</export>
+    <pseudoconstant>
+      <table>civicrm_contact_type</table>
+      <keyColumn>name</keyColumn>
+      <labelColumn>label</labelColumn>
+      <condition>parent_id IS NULL</condition>
+    </pseudoconstant>
+    <add>1.1</add>
+    <change>3.1</change>
   </field>
   <index>
-       <name>index_contact_type</name>
-       <fieldName>contact_type</fieldName>
-       <add>2.1</add>
+    <name>index_contact_type</name>
+    <fieldName>contact_type</fieldName>
+    <add>2.1</add>
   </index>
   <field>
-       <name>contact_sub_type</name>
-       <title>Contact Subtype</title>
-       <type>varchar</type>
-       <length>255</length>
-       <export>true</export>
-       <import>true</import>
-       <headerPattern>/C(ontact )?(subtype|sub-type|sub type)/i</headerPattern>
-       <comment>May be used to over-ride contact view and edit templates.</comment>
-       <pseudoconstant>
-        <table>civicrm_contact_type</table>
-        <keyColumn>name</keyColumn>
-        <labelColumn>label</labelColumn>
-        <condition>parent_id IS NOT NULL</condition>
-      </pseudoconstant>
-       <add>1.5</add>
+    <name>contact_sub_type</name>
+    <title>Contact Subtype</title>
+    <type>varchar</type>
+    <length>255</length>
+    <export>true</export>
+    <import>true</import>
+    <headerPattern>/C(ontact )?(subtype|sub-type|sub type)/i</headerPattern>
+    <comment>May be used to over-ride contact view and edit templates.</comment>
+    <pseudoconstant>
+      <table>civicrm_contact_type</table>
+      <keyColumn>name</keyColumn>
+      <labelColumn>label</labelColumn>
+      <condition>parent_id IS NOT NULL</condition>
+    </pseudoconstant>
+    <add>1.5</add>
   </field>
   <index>
-       <name>index_contact_sub_type</name>
-       <fieldName>contact_sub_type</fieldName>
-       <add>2.1</add>
+    <name>index_contact_sub_type</name>
+    <fieldName>contact_sub_type</fieldName>
+    <add>2.1</add>
   </index>
   <field>
-       <name>do_not_email</name>
-       <type>boolean</type>
-       <import>true</import>
-       <headerPattern>/d(o )?(not )?(email)/i</headerPattern>
-       <dataPattern>/^\d{1,}$/</dataPattern>
-       <default>0</default>
-       <add>1.1</add>
-</field>
-<field>
-       <name>do_not_phone</name>
-       <type>boolean</type>
-       <default>0</default>
-       <import>true</import>
-       <headerPattern>/d(o )?(not )?(call|phone)/i</headerPattern>
-       <dataPattern>/^\d{1,}$/</dataPattern>
-       <add>1.1</add>
- </field>
- <field>
-       <name>do_not_mail</name>
-       <type>boolean</type>
-       <import>true</import>
-       <headerPattern>/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i</headerPattern>
-       <dataPattern>/^\d{1,}$/</dataPattern>
-       <default>0</default>
-       <add>1.1</add>
-  </field>
-  <field>
-       <name>do_not_sms</name>
-       <type>boolean</type>
-       <import>true</import>
-       <headerPattern>/d(o )?(not )?(sms)/i</headerPattern>
-       <dataPattern>/^\d{1,}$/</dataPattern>
-       <default>0</default>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>do_not_trade</name>
-       <type>boolean</type>
-       <import>true</import>
-       <headerPattern>/d(o )?(not )?(trade)/i</headerPattern>
-       <dataPattern>/^\d{1,}$/</dataPattern>
-       <default>0</default>
-       <add>1.1</add>
+    <name>do_not_email</name>
+    <type>boolean</type>
+    <import>true</import>
+    <headerPattern>/d(o )?(not )?(email)/i</headerPattern>
+    <dataPattern>/^\d{1,}$/</dataPattern>
+    <default>0</default>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>do_not_phone</name>
+    <type>boolean</type>
+    <default>0</default>
+    <import>true</import>
+    <headerPattern>/d(o )?(not )?(call|phone)/i</headerPattern>
+    <dataPattern>/^\d{1,}$/</dataPattern>
+    <add>1.1</add>
 </field>
 <field>
+    <name>do_not_mail</name>
+    <type>boolean</type>
+    <import>true</import>
+    <headerPattern>/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i</headerPattern>
+    <dataPattern>/^\d{1,}$/</dataPattern>
+    <default>0</default>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>do_not_sms</name>
+    <type>boolean</type>
+    <import>true</import>
+    <headerPattern>/d(o )?(not )?(sms)/i</headerPattern>
+    <dataPattern>/^\d{1,}$/</dataPattern>
+    <default>0</default>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>do_not_trade</name>
+    <type>boolean</type>
+    <import>true</import>
+    <headerPattern>/d(o )?(not )?(trade)/i</headerPattern>
+    <dataPattern>/^\d{1,}$/</dataPattern>
+    <default>0</default>
+    <add>1.1</add>
   </field>
   <field>
     <name>is_opt_out</name>
     <add>1.1</add>
   </field>
   <field>
-       <name>legal_identifier</name>
-       <type>varchar</type>
-       <length>32</length>
-       <import>true</import>
-       <headerPattern>/legal\s?id/i</headerPattern>
-       <dataPattern>/\w+?\d{5,}/</dataPattern>
-       <comment>May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.</comment>
-      <add>1.1</add>
+    <name>legal_identifier</name>
+    <type>varchar</type>
+    <length>32</length>
+    <import>true</import>
+    <headerPattern>/legal\s?id/i</headerPattern>
+    <dataPattern>/\w+?\d{5,}/</dataPattern>
+    <comment>May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
+    </comment>
+    <add>1.1</add>
   </field>
   <field>
-       <name>external_identifier</name>
-       <type>varchar</type>
-       <length>32</length>
-       <size>EIGHT</size>
-       <import>true</import>
-       <headerPattern>/external\s?id/i</headerPattern>
-       <dataPattern>/^\d{11,}$/</dataPattern>
-       <comment>Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.</comment>
-      <add>1.1</add>
+    <name>external_identifier</name>
+    <type>varchar</type>
+    <length>32</length>
+    <size>EIGHT</size>
+    <import>true</import>
+    <headerPattern>/external\s?id/i</headerPattern>
+    <dataPattern>/^\d{11,}$/</dataPattern>
+    <comment>Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping
+      operations.
+    </comment>
+    <add>1.1</add>
   </field>
   <index>
-       <name>UI_external_identifier</name>
-       <unique>true</unique>
-       <fieldName>external_identifier</fieldName>
-       <add>1.7</add>
+    <name>UI_external_identifier</name>
+    <unique>true</unique>
+    <fieldName>external_identifier</fieldName>
+    <add>1.7</add>
   </index>
   <field>
-       <name>sort_name</name>
-       <title>Sort Name</title>
-       <type>varchar</type>
-       <length>128</length>
-       <size>BIG</size>
-       <export>true</export>
-       <comment>Name used for sorting different contact types</comment>
-      <add>1.1</add>
+    <name>sort_name</name>
+    <title>Sort Name</title>
+    <type>varchar</type>
+    <length>128</length>
+    <size>BIG</size>
+    <export>true</export>
+    <comment>Name used for sorting different contact types</comment>
+    <add>1.1</add>
   </field>
   <index>
-       <name>index_sort_name</name>
-       <fieldName>sort_name</fieldName>
-       <add>2.1</add>
+    <name>index_sort_name</name>
+    <fieldName>sort_name</fieldName>
+    <add>2.1</add>
   </index>
   <field>
-       <name>display_name</name>
-       <title>Display Name</title>
-       <type>varchar</type>
-       <length>128</length>
-       <size>BIG</size>
-       <export>true</export>
-       <comment>Formatted name representing preferred format for display/print/other output.</comment>
-       <add>1.1</add>
-  </field>
-  <field>
-       <name>nick_name</name>
-       <title>Nickname</title>
-       <type>varchar</type>
-       <length>128</length>
-       <size>BIG</size>
-       <import>true</import>
-       <headerPattern>/n(ick\s)name|nick$/i</headerPattern>
-       <dataPattern>/^\w+$/</dataPattern>
-       <comment>Nickname.</comment>
-       <fulltext/>
-       <add>1.1</add>
-  </field>
-  <field>
-       <name>legal_name</name>
-       <type>varchar</type>
-       <length>128</length>
-       <size>BIG</size>
-       <import>true</import>
-       <headerPattern>/^legal|(l(egal\s)?name)$/i</headerPattern>
-       <comment>Legal Name.</comment>
-       <fulltext/>
-       <add>1.1</add>
-  </field>
-  <field>
-       <name>home_URL</name>
-       <rule>url</rule>
-       <title>Website</title>
-       <type>varchar</type>
-       <length>128</length>
-       <size>BIG</size>
-       <import>true</import>
-       <headerPattern>/^(home\sURL)|URL|web|site/i</headerPattern>
-       <dataPattern>/^[\w\/\:\.]+$/</dataPattern>
-       <comment>optional "home page" URL for this contact.</comment>
-       <add>1.1</add>
-       <drop>3.2</drop>
-  </field>
-  <field>
-       <name>image_URL</name>
-       <type>varchar</type>
-       <length>255</length>
-       <import>true</import>
-       <comment>optional URL for preferred image (photo, logo, etc.) to display for this contact.</comment>
-       <add>1.1</add>
-  </field>
-  <field>
-      <name>preferred_communication_method</name>
-      <title>Preferred Communication Method</title>
-      <type>varchar</type>
-      <length>255</length>
-      <import>true</import>
-      <headerPattern>/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i</headerPattern>
-      <dataPattern>/^\w+$/</dataPattern>
-      <comment>What is the preferred mode of communication.</comment>
-      <add>1.1</add>
-      <pseudoconstant>
-        <optionGroupName>preferred_communication_method</optionGroupName>
-      </pseudoconstant>
+    <name>display_name</name>
+    <title>Display Name</title>
+    <type>varchar</type>
+    <length>128</length>
+    <size>BIG</size>
+    <export>true</export>
+    <comment>Formatted name representing preferred format for display/print/other output.</comment>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>nick_name</name>
+    <title>Nickname</title>
+    <type>varchar</type>
+    <length>128</length>
+    <size>BIG</size>
+    <import>true</import>
+    <headerPattern>/n(ick\s)name|nick$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <comment>Nickname.</comment>
+    <fulltext/>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>legal_name</name>
+    <type>varchar</type>
+    <length>128</length>
+    <size>BIG</size>
+    <import>true</import>
+    <headerPattern>/^legal|(l(egal\s)?name)$/i</headerPattern>
+    <comment>Legal Name.</comment>
+    <fulltext/>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>home_URL</name>
+    <rule>url</rule>
+    <title>Website</title>
+    <type>varchar</type>
+    <length>128</length>
+    <size>BIG</size>
+    <import>true</import>
+    <headerPattern>/^(home\sURL)|URL|web|site/i</headerPattern>
+    <dataPattern>/^[\w\/\:\.]+$/</dataPattern>
+    <comment>optional "home page" URL for this contact.</comment>
+    <add>1.1</add>
+    <drop>3.2</drop>
+  </field>
+  <field>
+    <name>image_URL</name>
+    <type>varchar</type>
+    <length>255</length>
+    <import>true</import>
+    <comment>optional URL for preferred image (photo, logo, etc.) to display for this contact.</comment>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>preferred_communication_method</name>
+    <title>Preferred Communication Method</title>
+    <type>varchar</type>
+    <length>255</length>
+    <import>true</import>
+    <headerPattern>/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <comment>What is the preferred mode of communication.</comment>
+    <add>1.1</add>
+    <pseudoconstant>
+      <optionGroupName>preferred_communication_method</optionGroupName>
+    </pseudoconstant>
   </field>
   <index>
-       <name>index_preferred_communication_method</name>
-       <fieldName>preferred_communication_method</fieldName>
-       <add>1.6</add>
+    <name>index_preferred_communication_method</name>
+    <fieldName>preferred_communication_method</fieldName>
+    <add>1.6</add>
   </index>
   <field>
-      <name>preferred_language</name>
-      <title>Preferred Language</title>
-      <type>varchar</type>
-      <length>5</length>
-      <comment>Which language is preferred for communication. FK to languages in civicrm_option_value.</comment>
-      <headerPattern>/^lang/i</headerPattern>
-      <import>true</import>
-      <pseudoconstant>
-        <optionGroupName>languages</optionGroupName>
-        <keyColumn>name</keyColumn>
-      </pseudoconstant>
-      <add>3.2</add>
-  </field>
-  <field>
-       <name>preferred_mail_format</name>
-       <type>enum</type>
-       <values>Text, HTML, Both</values>
-       <default>"Both"</default>
-       <import>true</import>
-       <headerPattern>/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i</headerPattern>
-       <comment>What is the preferred mode of sending an email.</comment>
-       <add>1.1</add>
-  </field>
-  <field>
-      <name>hash</name>
-      <title>Contact Hash</title>
-      <type>varchar</type>
-      <length>32</length>
-      <comment>Key for validating requests related to this contact.</comment>
-      <add>1.1</add>
-      <change>1.5</change>
-       <export>true</export>
+    <name>preferred_language</name>
+    <title>Preferred Language</title>
+    <type>varchar</type>
+    <length>5</length>
+    <comment>Which language is preferred for communication. FK to languages in civicrm_option_value.</comment>
+    <headerPattern>/^lang/i</headerPattern>
+    <import>true</import>
+    <pseudoconstant>
+      <optionGroupName>languages</optionGroupName>
+      <keyColumn>name</keyColumn>
+    </pseudoconstant>
+    <add>3.2</add>
+  </field>
+  <field>
+    <name>preferred_mail_format</name>
+    <type>enum</type>
+    <values>Text, HTML, Both</values>
+    <default>"Both"</default>
+    <import>true</import>
+    <headerPattern>/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i</headerPattern>
+    <comment>What is the preferred mode of sending an email.</comment>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>hash</name>
+    <title>Contact Hash</title>
+    <type>varchar</type>
+    <length>32</length>
+    <comment>Key for validating requests related to this contact.</comment>
+    <add>1.1</add>
+    <change>1.5</change>
+    <export>true</export>
   </field>
   <index>
-       <name>index_hash</name>
-       <fieldName>hash</fieldName>
-       <add>2.1</add>
+    <name>index_hash</name>
+    <fieldName>hash</fieldName>
+    <add>2.1</add>
   </index>
   <field>
-      <name>api_key</name>
-      <type>varchar</type>
-      <length>32</length>
-      <comment>API Key for validating requests related to this contact.</comment>
-      <add>2.2</add>
+    <name>api_key</name>
+    <type>varchar</type>
+    <length>32</length>
+    <comment>API Key for validating requests related to this contact.</comment>
+    <add>2.2</add>
   </field>
   <index>
-       <name>index_api_key</name>
-       <fieldName>api_key</fieldName>
-       <add>2.1</add>
+    <name>index_api_key</name>
+    <fieldName>api_key</fieldName>
+    <add>2.1</add>
   </index>
   <field>
-       <name>source</name>
-       <title>Source of Contact Data</title>
-       <uniqueName>contact_source</uniqueName>
-       <type>varchar</type>
-       <length>255</length>
-       <size>BIG</size>
-       <import>true</import>
-       <headerPattern>/(S(ource\s)?o(f\s)?C(ontact\s)?Data)$/i</headerPattern>
-       <comment>where contact come from, e.g. import, donate module insert...</comment>
-       <add>1.1</add>
-  </field>
-  <field>
-       <name>first_name</name>
-       <type>varchar</type>
-       <length>64</length>
-       <size>BIG</size>
-       <import>true</import>
-       <headerPattern>/^first|(f(irst\s)?name)$/i</headerPattern>
-       <dataPattern>/^\w+$/</dataPattern>
-       <fulltext/>
-       <comment>First Name.</comment>
-      <add>1.1</add>
+    <name>source</name>
+    <title>Source of Contact Data</title>
+    <uniqueName>contact_source</uniqueName>
+    <type>varchar</type>
+    <length>255</length>
+    <size>BIG</size>
+    <import>true</import>
+    <headerPattern>/(S(ource\s)?o(f\s)?C(ontact\s)?Data)$/i</headerPattern>
+    <comment>where contact come from, e.g. import, donate module insert...</comment>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>first_name</name>
+    <type>varchar</type>
+    <length>64</length>
+    <size>BIG</size>
+    <import>true</import>
+    <headerPattern>/^first|(f(irst\s)?name)$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <fulltext/>
+    <comment>First Name.</comment>
+    <add>1.1</add>
   </field>
   <index>
-      <name>index_first_name</name>
-      <fieldName>first_name</fieldName>
-      <add>1.8</add>
+    <name>index_first_name</name>
+    <fieldName>first_name</fieldName>
+    <add>1.8</add>
   </index>
   <field>
-       <name>middle_name</name>
-       <type>varchar</type>
-       <length>64</length>
-       <size>MEDIUM</size>
-       <import>true</import>
-       <headerPattern>/^middle|(m(iddle\s)?name)$/i</headerPattern>
-       <dataPattern>/^\w+$/</dataPattern>
-       <fulltext/>
-       <comment>Middle Name.</comment>
-      <add>1.1</add>
-  </field>
-  <field>
-       <name>last_name</name>
-       <type>varchar</type>
-       <length>64</length>
-       <size>BIG</size>
-       <import>true</import>
-       <headerPattern>/^last|(l(ast\s)?name)$/i</headerPattern>
-       <dataPattern>/^\w+(\s\w+)?+$/</dataPattern>
-       <comment>Last Name.</comment>
-       <fulltext/>
-      <add>1.1</add>
+    <name>middle_name</name>
+    <type>varchar</type>
+    <length>64</length>
+    <size>MEDIUM</size>
+    <import>true</import>
+    <headerPattern>/^middle|(m(iddle\s)?name)$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <fulltext/>
+    <comment>Middle Name.</comment>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>last_name</name>
+    <type>varchar</type>
+    <length>64</length>
+    <size>BIG</size>
+    <import>true</import>
+    <headerPattern>/^last|(l(ast\s)?name)$/i</headerPattern>
+    <dataPattern>/^\w+(\s\w+)?+$/</dataPattern>
+    <comment>Last Name.</comment>
+    <fulltext/>
+    <add>1.1</add>
   </field>
   <index>
-      <name>index_last_name</name>
-      <fieldName>last_name</fieldName>
-      <add>1.8</add>
+    <name>index_last_name</name>
+    <fieldName>last_name</fieldName>
+    <add>1.8</add>
   </index>
   <field>
-      <name>prefix_id</name>
-      <title>Individual Prefix</title>
-      <type>int unsigned</type>
-      <comment>Prefix or Title for name (Ms, Mr...). FK to prefix ID</comment>
-      <pseudoconstant>
-        <optionGroupName>individual_prefix</optionGroupName>
-      </pseudoconstant>
-      <headerPattern>/^(prefix|title)/i</headerPattern>
-      <dataPattern>/^(mr|ms|mrs|sir|dr)\.?$/i</dataPattern>
-      <import>true</import>
-      <add>1.2</add>
+    <name>prefix_id</name>
+    <uniqueName>individual_prefix</uniqueName>
+    <title>Individual Prefix</title>
+    <type>int unsigned</type>
+    <comment>Prefix or Title for name (Ms, Mr...). FK to prefix ID</comment>
+    <pseudoconstant>
+      <optionGroupName>individual_prefix</optionGroupName>
+    </pseudoconstant>
+    <headerPattern>/^(prefix|title)/i</headerPattern>
+    <dataPattern>/^(mr|ms|mrs|sir|dr)\.?$/i</dataPattern>
+    <import>true</import>
+    <add>1.2</add>
   </field>
   <index>
-      <name>UI_prefix</name>
-      <fieldName>prefix_id</fieldName>
-      <add>1.6</add>
+    <name>UI_prefix</name>
+    <fieldName>prefix_id</fieldName>
+    <add>1.6</add>
   </index>
   <field>
-      <name>suffix_id</name>
-      <title>Individual Suffix</title>
-      <type>int unsigned</type>
-      <pseudoconstant>
-        <optionGroupName>individual_suffix</optionGroupName>
-      </pseudoconstant>
-      <import>true</import>
-      <comment>Suffix for name (Jr, Sr...). FK to suffix ID</comment>
-      <headerPattern>/^suffix$/i</headerPattern>
-      <dataPattern>/^(sr|jr)\.?|i{2,}$/</dataPattern>
-      <add>1.2</add>
+    <name>suffix_id</name>
+    <uniqueName>individual_suffix</uniqueName>
+    <title>Individual Suffix</title>
+    <type>int unsigned</type>
+    <pseudoconstant>
+      <optionGroupName>individual_suffix</optionGroupName>
+    </pseudoconstant>
+    <import>true</import>
+    <comment>Suffix for name (Jr, Sr...). FK to suffix ID</comment>
+    <headerPattern>/^suffix$/i</headerPattern>
+    <dataPattern>/^(sr|jr)\.?|i{2,}$/</dataPattern>
+    <add>1.2</add>
   </field>
   <index>
-      <name>UI_suffix</name>
-      <fieldName>suffix_id</fieldName>
-      <add>1.6</add>
+    <name>UI_suffix</name>
+    <fieldName>suffix_id</fieldName>
+    <add>1.6</add>
   </index>
   <field>
-       <name>greeting_type</name>
-       <type>varchar</type>
-       <length>128</length>
-       <import>true</import>
-       <comment>Preferred greeting format.</comment>
-       <add>1.1</add>
-       <drop>2.2</drop>
-  </field>
+    <name>greeting_type</name>
+    <type>varchar</type>
+    <length>128</length>
+    <import>true</import>
+    <comment>Preferred greeting format.</comment>
+    <add>1.1</add>
+    <drop>2.2</drop>
+  </field>
+  <field>
+    <name>greeting_type_id</name>
+    <title>Greeting Type</title>
+    <type>int unsigned</type>
+    <comment>FK to civicrm_option_value.id, that has to be valid, registered Greeting type.</comment>
+    <add>2.2</add>
+    <drop>3.0</drop>
+  </field>
+  <field>
+    <name>custom_greeting</name>
+    <type>varchar</type>
+    <length>128</length>
+    <import>true</import>
+    <comment>Custom greeting message.</comment>
+    <add>1.1</add>
+    <drop>3.0</drop>
+  </field>
+  <field>
+    <name>email_greeting_id</name>
+    <type>int unsigned</type>
+    <title>Email Greeting ID</title>
+    <comment>FK to civicrm_option_value.id, that has to be valid registered Email Greeting.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>email_greeting_custom</name>
+    <type>varchar</type>
+    <length>128</length>
+    <import>true</import>
+    <export>false</export>
+    <comment>Custom Email Greeting.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>email_greeting_display</name>
+    <title>Email Greeting</title>
+    <type>varchar</type>
+    <length>255</length>
+    <comment>Cache Email Greeting.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>postal_greeting_id</name>
+    <type>int unsigned</type>
+    <title>Postal Greeting ID</title>
+    <comment>FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>postal_greeting_custom</name>
+    <type>varchar</type>
+    <length>128</length>
+    <import>true</import>
+    <export>false</export>
+    <comment>Custom Postal greeting.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>postal_greeting_display</name>
+    <title>Postal Greeting</title>
+    <type>varchar</type>
+    <length>255</length>
+    <comment>Cache Postal greeting.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>addressee_id</name>
+    <type>int unsigned</type>
+    <title>Addressee ID</title>
+    <comment>FK to civicrm_option_value.id, that has to be valid registered Addressee.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>addressee_custom</name>
+    <type>varchar</type>
+    <length>128</length>
+    <import>true</import>
+    <export>false</export>
+    <comment>Custom Addressee.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>addressee_display</name>
+    <title>Addressee</title>
+    <type>varchar</type>
+    <length>255</length>
+    <comment>Cache Addressee.</comment>
+    <add>3.0</add>
+  </field>
+  <field>
+    <name>job_title</name>
+    <type>varchar</type>
+    <length>255</length>
+    <size>MEDIUM</size>
+    <import>true</import>
+    <headerPattern>/^job|(j(ob\s)?title)$/i</headerPattern>
+    <dataPattern>//</dataPattern>
+    <comment>Job Title</comment>
+    <add>1.1</add>
+  </field>
   <field>
-       <name>greeting_type_id</name>
-       <title>Greeting Type</title>
-       <type>int unsigned</type>
-       <comment>FK to civicrm_option_value.id, that has to be valid, registered Greeting type.</comment>
-       <add>2.2</add>
-       <drop>3.0</drop>
-  </field>
-  <field>
-       <name>custom_greeting</name>
-       <type>varchar</type>
-       <length>128</length>
-       <import>true</import>
-       <comment>Custom greeting message.</comment>
-       <add>1.1</add>
-       <drop>3.0</drop>
-  </field>
-  <field>
-       <name>email_greeting_id</name>
-       <type>int unsigned</type>
-       <title>Email Greeting ID</title>
-       <comment>FK to civicrm_option_value.id, that has to be valid registered Email Greeting.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>email_greeting_custom</name>
-       <type>varchar</type>
-       <length>128</length>
-       <import>true</import>
-       <export>false</export>
-       <comment>Custom Email Greeting.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>email_greeting_display</name>
-       <title>Email Greeting</title>
-       <type>varchar</type>
-       <length>255</length>
-       <comment>Cache Email Greeting.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>postal_greeting_id</name>
-       <type>int unsigned</type>
-       <title>Postal Greeting ID</title>
-       <comment>FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>postal_greeting_custom</name>
-       <type>varchar</type>
-       <length>128</length>
-       <import>true</import>
-       <export>false</export>
-       <comment>Custom Postal greeting.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>postal_greeting_display</name>
-       <title>Postal Greeting</title>
-       <type>varchar</type>
-       <length>255</length>
-       <comment>Cache Postal greeting.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>addressee_id</name>
-       <type>int unsigned</type>
-       <title>Addressee ID</title>
-       <comment>FK to civicrm_option_value.id, that has to be valid registered Addressee.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>addressee_custom</name>
-       <type>varchar</type>
-       <length>128</length>
-       <import>true</import>
-       <export>false</export>
-       <comment>Custom Addressee.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>addressee_display</name>
-       <title>Addressee</title>
-       <type>varchar</type>
-       <length>255</length>
-       <comment>Cache Addressee.</comment>
-       <add>3.0</add>
-  </field>
-  <field>
-       <name>job_title</name>
-       <type>varchar</type>
-       <length>255</length>
-       <size>MEDIUM</size>
-       <import>true</import>
-       <headerPattern>/^job|(j(ob\s)?title)$/i</headerPattern>
-       <dataPattern>//</dataPattern>
-       <comment>Job Title</comment>
-       <add>1.1</add>
-  </field>
-  <field>
-      <name>gender_id</name>
-      <title>Gender</title>
-      <type>int unsigned</type>
-      <pseudoconstant>
-        <optionGroupName>gender</optionGroupName>
-      </pseudoconstant>
-      <headerPattern>/^gender$/i</headerPattern>
-      <comment>FK to gender ID</comment>
-      <import>true</import>
-      <add>1.2</add>
+    <name>gender_id</name>
+    <uniqueName>gender</uniqueName>
+    <title>Gender</title>
+    <type>int unsigned</type>
+    <pseudoconstant>
+      <optionGroupName>gender</optionGroupName>
+    </pseudoconstant>
+    <headerPattern>/^gender$/i</headerPattern>
+    <comment>FK to gender ID</comment>
+    <import>true</import>
+    <add>1.2</add>
   </field>
   <index>
-     <name>UI_gender</name>
-     <fieldName>gender_id</fieldName>
-     <add>1.6</add>
+    <name>UI_gender</name>
+    <fieldName>gender_id</fieldName>
+    <add>1.6</add>
   </index>
   <field>
-       <name>birth_date</name>
-       <type>date</type>
-       <import>true</import>
-       <headerPattern>/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i</headerPattern>
-       <dataPattern>/\d{4}-?\d{2}-?\d{2}/</dataPattern>
-       <comment>Date of birth</comment>
-       <add>1.1</add>
-  </field>
-  <field>
-       <name>is_deceased</name>
-       <title>Is Deceased</title>
-       <import>true</import>
-       <export>true</export>
-       <headerPattern>/i(s\s)?d(eceased)$/i</headerPattern>
-       <type>boolean</type>
-       <default>0</default>
-       <add>1.1</add>
-  </field>
-  <field>
-       <name>deceased_date</name>
-       <type>date</type>
-       <import>true</import>
-       <export>true</export>
-       <headerPattern>/^deceased|(d(eceased\s)?date)$/i</headerPattern>
-       <comment>Date of deceased</comment>
-       <add>1.5</add>
-  </field>
-  <field>
-      <name>mail_to_household_id</name>
-      <title>Mail to Household ID</title>
-      <type>int unsigned</type>
-      <comment>OPTIONAL FK to civicrm_contact_household record. If NOT NULL, direct mail communications to household rather than individual location.</comment>
-      <export>true</export>
-      <add>1.1</add>
-      <drop>3.3</drop>
+    <name>birth_date</name>
+    <type>date</type>
+    <import>true</import>
+    <headerPattern>/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i</headerPattern>
+    <dataPattern>/\d{4}-?\d{2}-?\d{2}/</dataPattern>
+    <comment>Date of birth</comment>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>is_deceased</name>
+    <title>Is Deceased</title>
+    <import>true</import>
+    <export>true</export>
+    <headerPattern>/i(s\s)?d(eceased)$/i</headerPattern>
+    <type>boolean</type>
+    <default>0</default>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>deceased_date</name>
+    <type>date</type>
+    <import>true</import>
+    <export>true</export>
+    <headerPattern>/^deceased|(d(eceased\s)?date)$/i</headerPattern>
+    <comment>Date of deceased</comment>
+    <add>1.5</add>
+  </field>
+  <field>
+    <name>mail_to_household_id</name>
+    <title>Mail to Household ID</title>
+    <type>int unsigned</type>
+    <comment>OPTIONAL FK to civicrm_contact_household record. If NOT NULL, direct mail communications to household
+      rather than individual location.
+    </comment>
+    <export>true</export>
+    <add>1.1</add>
+    <drop>3.3</drop>
   </field>
   <foreignKey>
-       <name>mail_to_household_id</name>
-       <table>civicrm_contact</table>
-       <key>id</key>
-       <add>2.1</add>
-       <onDelete>SET NULL</onDelete>
-       <drop>3.3</drop>
+    <name>mail_to_household_id</name>
+    <table>civicrm_contact</table>
+    <key>id</key>
+    <add>2.1</add>
+    <onDelete>SET NULL</onDelete>
+    <drop>3.3</drop>
   </foreignKey>
   <field>
-       <name>household_name</name>
-       <type>varchar</type>
-       <length>128</length>
-       <size>BIG</size>
-       <import>true</import>
-       <headerPattern>/^household|(h(ousehold\s)?name)$/i</headerPattern>
-       <dataPattern>/^\w+$/</dataPattern>
-       <comment>Household Name.</comment>
-       <fulltext/>
-       <add>1.1</add>
+    <name>household_name</name>
+    <type>varchar</type>
+    <length>128</length>
+    <size>BIG</size>
+    <import>true</import>
+    <headerPattern>/^household|(h(ousehold\s)?name)$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <comment>Household Name.</comment>
+    <fulltext/>
+    <add>1.1</add>
   </field>
   <index>
-      <name>index_household_name</name>
-      <fieldName>household_name</fieldName>
-      <add>1.8</add>
+    <name>index_household_name</name>
+    <fieldName>household_name</fieldName>
+    <add>1.8</add>
   </index>
   <field>
-      <name>primary_contact_id</name>
-      <type>int unsigned</type>
-      <title>Household Primary Contact ID</title>
-      <comment>Optional FK to Primary Contact for this household.</comment>
-       <add>1.1</add>
+    <name>primary_contact_id</name>
+    <type>int unsigned</type>
+    <title>Household Primary Contact ID</title>
+    <comment>Optional FK to Primary Contact for this household.</comment>
+    <add>1.1</add>
   </field>
   <foreignKey>
-       <name>primary_contact_id</name>
-       <table>civicrm_contact</table>
-       <key>id</key>
-       <add>1.1</add>
-       <onDelete>SET NULL</onDelete>
+    <name>primary_contact_id</name>
+    <table>civicrm_contact</table>
+    <key>id</key>
+    <add>1.1</add>
+    <onDelete>SET NULL</onDelete>
   </foreignKey>
   <field>
-       <name>organization_name</name>
-       <type>varchar</type>
-       <length>128</length>
-       <size>BIG</size>
-       <import>true</import>
-       <headerPattern>/^organization|(o(rganization\s)?name)$/i</headerPattern>
-       <dataPattern>/^\w+$/</dataPattern>
-       <comment>Organization Name.</comment>
-       <fulltext/>
-       <add>1.1</add>
+    <name>organization_name</name>
+    <type>varchar</type>
+    <length>128</length>
+    <size>BIG</size>
+    <import>true</import>
+    <headerPattern>/^organization|(o(rganization\s)?name)$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <comment>Organization Name.</comment>
+    <fulltext/>
+    <add>1.1</add>
   </field>
   <index>
-      <name>index_organization_name</name>
-      <fieldName>organization_name</fieldName>
-      <add>1.8</add>
+    <name>index_organization_name</name>
+    <fieldName>organization_name</fieldName>
+    <add>1.8</add>
   </index>
   <field>
-       <name>sic_code</name>
-       <type>varchar</type>
-       <length>8</length>
-       <import>true</import>
-       <headerPattern>/^sic|(s(ic\s)?code)$/i</headerPattern>
-       <comment>Standard Industry Classification Code.</comment>
-       <add>1.1</add>
-  </field>
-  <field>
-       <name>user_unique_id</name>
-       <rule>url</rule>
-       <title>Unique ID (OpenID)</title>
-       <type>varchar</type>
-       <length>255</length>
-       <import>true</import>
-       <headerPattern>/^Open\s?ID|u(niq\w*)?\s?ID/i</headerPattern>
-       <dataPattern>/^[\w\/\:\.]+$/</dataPattern>
-       <comment>the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM</comment>
-       <add>2.0</add>
-  </field>
-  <field>
-      <name>employer_id</name>
-      <title>Current Employer ID</title>
-      <uniqueName>current_employer_id</uniqueName>
-      <type>int unsigned</type>
-      <comment>OPTIONAL FK to civicrm_contact record.</comment>
-      <export>true</export>
-      <add>2.1</add>
+    <name>sic_code</name>
+    <type>varchar</type>
+    <length>8</length>
+    <import>true</import>
+    <headerPattern>/^sic|(s(ic\s)?code)$/i</headerPattern>
+    <comment>Standard Industry Classification Code.</comment>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>user_unique_id</name>
+    <rule>url</rule>
+    <title>Unique ID (OpenID)</title>
+    <type>varchar</type>
+    <length>255</length>
+    <import>true</import>
+    <headerPattern>/^Open\s?ID|u(niq\w*)?\s?ID/i</headerPattern>
+    <dataPattern>/^[\w\/\:\.]+$/</dataPattern>
+    <comment>the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for
+      logging in to CiviCRM
+    </comment>
+    <add>2.0</add>
+  </field>
+  <field>
+    <name>employer_id</name>
+    <title>Current Employer ID</title>
+    <uniqueName>current_employer_id</uniqueName>
+    <type>int unsigned</type>
+    <comment>OPTIONAL FK to civicrm_contact record.</comment>
+    <export>true</export>
+    <add>2.1</add>
   </field>
   <foreignKey>
-       <name>employer_id</name>
-       <table>civicrm_contact</table>
-       <key>id</key>
-       <add>2.1</add>
-       <onDelete>SET NULL</onDelete>
+    <name>employer_id</name>
+    <table>civicrm_contact</table>
+    <key>id</key>
+    <add>2.1</add>
+    <onDelete>SET NULL</onDelete>
   </foreignKey>
   <field>
     <name>is_deleted</name>