Re-order Contact fields in table,DAO
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 6 Apr 2023 04:57:04 +0000 (16:57 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 6 Apr 2023 23:59:19 +0000 (11:59 +1200)
CRM/Contact/DAO/Contact.php
xml/schema/Contact/Contact.xml

index 9353b0ce2cb34c3caa249204e3a6bbba6ec4d4c9..339c3e0b494fe46b6c3a669498159c69cc5f91ae 100644 (file)
@@ -74,6 +74,33 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
    */
   public $contact_type;
 
+  /**
+   * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
+   *
+   * @var string|null
+   *   (SQL type: varchar(64))
+   *   Note that values will be retrieved from the database as a string.
+   */
+  public $external_identifier;
+
+  /**
+   * Formatted name representing preferred format for display/print/other output.
+   *
+   * @var string|null
+   *   (SQL type: varchar(128))
+   *   Note that values will be retrieved from the database as a string.
+   */
+  public $display_name;
+
+  /**
+   * Organization Name.
+   *
+   * @var string|null
+   *   (SQL type: varchar(128))
+   *   Note that values will be retrieved from the database as a string.
+   */
+  public $organization_name;
+
   /**
    * May be used to over-ride contact view and edit templates.
    *
@@ -83,6 +110,33 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
    */
   public $contact_sub_type;
 
+  /**
+   * First Name.
+   *
+   * @var string|null
+   *   (SQL type: varchar(64))
+   *   Note that values will be retrieved from the database as a string.
+   */
+  public $first_name;
+
+  /**
+   * Middle Name.
+   *
+   * @var string|null
+   *   (SQL type: varchar(64))
+   *   Note that values will be retrieved from the database as a string.
+   */
+  public $middle_name;
+
+  /**
+   * Last Name.
+   *
+   * @var string|null
+   *   (SQL type: varchar(64))
+   *   Note that values will be retrieved from the database as a string.
+   */
+  public $last_name;
+
   /**
    * @var bool|string
    *   (SQL type: tinyint)
@@ -136,15 +190,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
    */
   public $legal_identifier;
 
-  /**
-   * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
-   *
-   * @var string|null
-   *   (SQL type: varchar(64))
-   *   Note that values will be retrieved from the database as a string.
-   */
-  public $external_identifier;
-
   /**
    * Name used for sorting different contact types
    *
@@ -154,15 +199,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
    */
   public $sort_name;
 
-  /**
-   * Formatted name representing preferred format for display/print/other output.
-   *
-   * @var string|null
-   *   (SQL type: varchar(128))
-   *   Note that values will be retrieved from the database as a string.
-   */
-  public $display_name;
-
   /**
    * Nickname.
    *
@@ -208,16 +244,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
    */
   public $preferred_language;
 
-  /**
-   * Deprecated setting for text vs html mailings
-   *
-   * @var string|null
-   *   (SQL type: varchar(8))
-   *   Note that values will be retrieved from the database as a string.
-   * @deprecated
-   */
-  public $preferred_mail_format;
-
   /**
    * Key for validating requests related to this contact.
    *
@@ -245,33 +271,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
    */
   public $source;
 
-  /**
-   * First Name.
-   *
-   * @var string|null
-   *   (SQL type: varchar(64))
-   *   Note that values will be retrieved from the database as a string.
-   */
-  public $first_name;
-
-  /**
-   * Middle Name.
-   *
-   * @var string|null
-   *   (SQL type: varchar(64))
-   *   Note that values will be retrieved from the database as a string.
-   */
-  public $middle_name;
-
-  /**
-   * Last Name.
-   *
-   * @var string|null
-   *   (SQL type: varchar(64))
-   *   Note that values will be retrieved from the database as a string.
-   */
-  public $last_name;
-
   /**
    * Prefix or Title for name (Ms, Mr...). FK to prefix ID
    *
@@ -450,15 +449,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
    */
   public $primary_contact_id;
 
-  /**
-   * Organization Name.
-   *
-   * @var string|null
-   *   (SQL type: varchar(128))
-   *   Note that values will be retrieved from the database as a string.
-   */
-  public $organization_name;
-
   /**
    * Standard Industry Classification Code.
    *
@@ -512,6 +502,16 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
    */
   public $modified_date;
 
+  /**
+   * Deprecated setting for text vs html mailings
+   *
+   * @var string|null
+   *   (SQL type: varchar(8))
+   *   Note that values will be retrieved from the database as a string.
+   * @deprecated
+   */
+  public $preferred_mail_format;
+
   /**
    * Class constructor.
    */
@@ -622,6 +622,88 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'readonly' => TRUE,
           'add' => '1.1',
         ],
+        'external_identifier' => [
+          'name' => 'external_identifier',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('External Identifier'),
+          'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
+          'maxlength' => 64,
+          'size' => 8,
+          'usage' => [
+            'import' => TRUE,
+            'export' => TRUE,
+            'duplicate_matching' => TRUE,
+            'token' => FALSE,
+          ],
+          'import' => TRUE,
+          'where' => 'civicrm_contact.external_identifier',
+          'headerPattern' => '/external\s?id/i',
+          'dataPattern' => '/^\d{11,}$/',
+          'export' => TRUE,
+          'table_name' => 'civicrm_contact',
+          'entity' => 'Contact',
+          'bao' => 'CRM_Contact_BAO_Contact',
+          'localizable' => 0,
+          'html' => [
+            'type' => 'Text',
+            'label' => ts("External Identifier"),
+          ],
+          'add' => '1.1',
+        ],
+        'display_name' => [
+          'name' => 'display_name',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('Display Name'),
+          'description' => ts('Formatted name representing preferred format for display/print/other output.'),
+          'maxlength' => 128,
+          'size' => 30,
+          'usage' => [
+            'import' => FALSE,
+            'export' => TRUE,
+            'duplicate_matching' => FALSE,
+            'token' => FALSE,
+          ],
+          'where' => 'civicrm_contact.display_name',
+          'export' => TRUE,
+          'table_name' => 'civicrm_contact',
+          'entity' => 'Contact',
+          'bao' => 'CRM_Contact_BAO_Contact',
+          'localizable' => 0,
+          'html' => [
+            'type' => 'Text',
+          ],
+          'readonly' => TRUE,
+          'add' => '1.1',
+        ],
+        'organization_name' => [
+          'name' => 'organization_name',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('Organization Name'),
+          'description' => ts('Organization Name.'),
+          'maxlength' => 128,
+          'size' => 30,
+          'usage' => [
+            'import' => TRUE,
+            'export' => TRUE,
+            'duplicate_matching' => TRUE,
+            'token' => FALSE,
+          ],
+          'import' => TRUE,
+          'where' => 'civicrm_contact.organization_name',
+          'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
+          'dataPattern' => '/^\w+$/',
+          'export' => TRUE,
+          'contactType' => 'Organization',
+          'table_name' => 'civicrm_contact',
+          'entity' => 'Contact',
+          'bao' => 'CRM_Contact_BAO_Contact',
+          'localizable' => 0,
+          'html' => [
+            'type' => 'Text',
+            'label' => ts("Organization Name"),
+          ],
+          'add' => '1.1',
+        ],
         'contact_sub_type' => [
           'name' => 'contact_sub_type',
           'type' => CRM_Utils_Type::T_STRING,
@@ -656,6 +738,93 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           ],
           'add' => '1.5',
         ],
+        'first_name' => [
+          'name' => 'first_name',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('First Name'),
+          'description' => ts('First Name.'),
+          'maxlength' => 64,
+          'size' => 30,
+          'usage' => [
+            'import' => TRUE,
+            'export' => TRUE,
+            'duplicate_matching' => TRUE,
+            'token' => FALSE,
+          ],
+          'import' => TRUE,
+          'where' => 'civicrm_contact.first_name',
+          'headerPattern' => '/^first|(f(irst\s)?name)$/i',
+          'dataPattern' => '/^\w+$/',
+          'export' => TRUE,
+          'contactType' => 'Individual',
+          'table_name' => 'civicrm_contact',
+          'entity' => 'Contact',
+          'bao' => 'CRM_Contact_BAO_Contact',
+          'localizable' => 0,
+          'html' => [
+            'type' => 'Text',
+            'label' => ts("First Name"),
+          ],
+          'add' => '1.1',
+        ],
+        'middle_name' => [
+          'name' => 'middle_name',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('Middle Name'),
+          'description' => ts('Middle Name.'),
+          'maxlength' => 64,
+          'size' => 30,
+          'usage' => [
+            'import' => TRUE,
+            'export' => TRUE,
+            'duplicate_matching' => TRUE,
+            'token' => FALSE,
+          ],
+          'import' => TRUE,
+          'where' => 'civicrm_contact.middle_name',
+          'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
+          'dataPattern' => '/^\w+$/',
+          'export' => TRUE,
+          'contactType' => 'Individual',
+          'table_name' => 'civicrm_contact',
+          'entity' => 'Contact',
+          'bao' => 'CRM_Contact_BAO_Contact',
+          'localizable' => 0,
+          'html' => [
+            'type' => 'Text',
+            'label' => ts("Middle Name"),
+          ],
+          'add' => '1.1',
+        ],
+        'last_name' => [
+          'name' => 'last_name',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('Last Name'),
+          'description' => ts('Last Name.'),
+          'maxlength' => 64,
+          'size' => 30,
+          'usage' => [
+            'import' => TRUE,
+            'export' => TRUE,
+            'duplicate_matching' => TRUE,
+            'token' => FALSE,
+          ],
+          'import' => TRUE,
+          'where' => 'civicrm_contact.last_name',
+          'headerPattern' => '/^last|(l(ast\s)?name)$/i',
+          'dataPattern' => '/^\w+(\s\w+)?+$/',
+          'export' => TRUE,
+          'contactType' => 'Individual',
+          'table_name' => 'civicrm_contact',
+          'entity' => 'Contact',
+          'bao' => 'CRM_Contact_BAO_Contact',
+          'localizable' => 0,
+          'html' => [
+            'type' => 'Text',
+            'label' => ts("Last Name"),
+          ],
+          'add' => '1.1',
+        ],
         'do_not_email' => [
           'name' => 'do_not_email',
           'type' => CRM_Utils_Type::T_BOOLEAN,
@@ -823,70 +992,17 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'title' => ts('Legal Identifier'),
           'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.'),
           'maxlength' => 32,
-          'size' => CRM_Utils_Type::MEDIUM,
-          'usage' => [
-            'import' => TRUE,
-            'export' => TRUE,
-            'duplicate_matching' => TRUE,
-            'token' => FALSE,
-          ],
-          'import' => TRUE,
-          'where' => 'civicrm_contact.legal_identifier',
-          'headerPattern' => '/legal\s?id/i',
-          'dataPattern' => '/\w+?\d{5,}/',
-          'export' => TRUE,
-          'table_name' => 'civicrm_contact',
-          'entity' => 'Contact',
-          'bao' => 'CRM_Contact_BAO_Contact',
-          'localizable' => 0,
-          'html' => [
-            'type' => 'Text',
-            'label' => ts("Legal Identifier"),
-          ],
-          'add' => '1.1',
-        ],
-        'external_identifier' => [
-          'name' => 'external_identifier',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('External Identifier'),
-          'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
-          'maxlength' => 64,
-          'size' => 8,
-          'usage' => [
-            'import' => TRUE,
-            'export' => TRUE,
-            'duplicate_matching' => TRUE,
-            'token' => FALSE,
-          ],
-          'import' => TRUE,
-          'where' => 'civicrm_contact.external_identifier',
-          'headerPattern' => '/external\s?id/i',
-          'dataPattern' => '/^\d{11,}$/',
-          'export' => TRUE,
-          'table_name' => 'civicrm_contact',
-          'entity' => 'Contact',
-          'bao' => 'CRM_Contact_BAO_Contact',
-          'localizable' => 0,
-          'html' => [
-            'type' => 'Text',
-            'label' => ts("External Identifier"),
-          ],
-          'add' => '1.1',
-        ],
-        'sort_name' => [
-          'name' => 'sort_name',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Sort Name'),
-          'description' => ts('Name used for sorting different contact types'),
-          'maxlength' => 128,
-          'size' => 30,
+          'size' => CRM_Utils_Type::MEDIUM,
           'usage' => [
-            'import' => FALSE,
+            'import' => TRUE,
             'export' => TRUE,
-            'duplicate_matching' => FALSE,
+            'duplicate_matching' => TRUE,
             'token' => FALSE,
           ],
-          'where' => 'civicrm_contact.sort_name',
+          'import' => TRUE,
+          'where' => 'civicrm_contact.legal_identifier',
+          'headerPattern' => '/legal\s?id/i',
+          'dataPattern' => '/\w+?\d{5,}/',
           'export' => TRUE,
           'table_name' => 'civicrm_contact',
           'entity' => 'Contact',
@@ -894,15 +1010,15 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'localizable' => 0,
           'html' => [
             'type' => 'Text',
+            'label' => ts("Legal Identifier"),
           ],
-          'readonly' => TRUE,
           'add' => '1.1',
         ],
-        'display_name' => [
-          'name' => 'display_name',
+        'sort_name' => [
+          'name' => 'sort_name',
           'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Display Name'),
-          'description' => ts('Formatted name representing preferred format for display/print/other output.'),
+          'title' => ts('Sort Name'),
+          'description' => ts('Name used for sorting different contact types'),
           'maxlength' => 128,
           'size' => 30,
           'usage' => [
@@ -911,7 +1027,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
             'duplicate_matching' => FALSE,
             'token' => FALSE,
           ],
-          'where' => 'civicrm_contact.display_name',
+          'where' => 'civicrm_contact.sort_name',
           'export' => TRUE,
           'table_name' => 'civicrm_contact',
           'entity' => 'Contact',
@@ -1065,36 +1181,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           ],
           'add' => '3.2',
         ],
-        'preferred_mail_format' => [
-          'name' => 'preferred_mail_format',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Preferred Mail Format'),
-          'description' => ts('Deprecated setting for text vs html mailings'),
-          'maxlength' => 8,
-          'size' => CRM_Utils_Type::EIGHT,
-          'usage' => [
-            'import' => FALSE,
-            'export' => FALSE,
-            'duplicate_matching' => FALSE,
-            'token' => FALSE,
-          ],
-          'where' => 'civicrm_contact.preferred_mail_format',
-          'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
-          'default' => 'Both',
-          'table_name' => 'civicrm_contact',
-          'entity' => 'Contact',
-          'bao' => 'CRM_Contact_BAO_Contact',
-          'localizable' => 0,
-          'deprecated' => TRUE,
-          'html' => [
-            'type' => 'Select',
-            'label' => ts("Preferred Mail Format"),
-          ],
-          'pseudoconstant' => [
-            'callback' => 'CRM_Core_SelectValues::pmf',
-          ],
-          'add' => '1.1',
-        ],
         'hash' => [
           'name' => 'hash',
           'type' => CRM_Utils_Type::T_STRING,
@@ -1173,93 +1259,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           ],
           'add' => '1.1',
         ],
-        'first_name' => [
-          'name' => 'first_name',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('First Name'),
-          'description' => ts('First Name.'),
-          'maxlength' => 64,
-          'size' => 30,
-          'usage' => [
-            'import' => TRUE,
-            'export' => TRUE,
-            'duplicate_matching' => TRUE,
-            'token' => FALSE,
-          ],
-          'import' => TRUE,
-          'where' => 'civicrm_contact.first_name',
-          'headerPattern' => '/^first|(f(irst\s)?name)$/i',
-          'dataPattern' => '/^\w+$/',
-          'export' => TRUE,
-          'contactType' => 'Individual',
-          'table_name' => 'civicrm_contact',
-          'entity' => 'Contact',
-          'bao' => 'CRM_Contact_BAO_Contact',
-          'localizable' => 0,
-          'html' => [
-            'type' => 'Text',
-            'label' => ts("First Name"),
-          ],
-          'add' => '1.1',
-        ],
-        'middle_name' => [
-          'name' => 'middle_name',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Middle Name'),
-          'description' => ts('Middle Name.'),
-          'maxlength' => 64,
-          'size' => 30,
-          'usage' => [
-            'import' => TRUE,
-            'export' => TRUE,
-            'duplicate_matching' => TRUE,
-            'token' => FALSE,
-          ],
-          'import' => TRUE,
-          'where' => 'civicrm_contact.middle_name',
-          'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
-          'dataPattern' => '/^\w+$/',
-          'export' => TRUE,
-          'contactType' => 'Individual',
-          'table_name' => 'civicrm_contact',
-          'entity' => 'Contact',
-          'bao' => 'CRM_Contact_BAO_Contact',
-          'localizable' => 0,
-          'html' => [
-            'type' => 'Text',
-            'label' => ts("Middle Name"),
-          ],
-          'add' => '1.1',
-        ],
-        'last_name' => [
-          'name' => 'last_name',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Last Name'),
-          'description' => ts('Last Name.'),
-          'maxlength' => 64,
-          'size' => 30,
-          'usage' => [
-            'import' => TRUE,
-            'export' => TRUE,
-            'duplicate_matching' => TRUE,
-            'token' => FALSE,
-          ],
-          'import' => TRUE,
-          'where' => 'civicrm_contact.last_name',
-          'headerPattern' => '/^last|(l(ast\s)?name)$/i',
-          'dataPattern' => '/^\w+(\s\w+)?+$/',
-          'export' => TRUE,
-          'contactType' => 'Individual',
-          'table_name' => 'civicrm_contact',
-          'entity' => 'Contact',
-          'bao' => 'CRM_Contact_BAO_Contact',
-          'localizable' => 0,
-          'html' => [
-            'type' => 'Text',
-            'label' => ts("Last Name"),
-          ],
-          'add' => '1.1',
-        ],
         'prefix_id' => [
           'name' => 'prefix_id',
           'type' => CRM_Utils_Type::T_INT,
@@ -1789,35 +1788,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'readonly' => TRUE,
           'add' => '1.1',
         ],
-        'organization_name' => [
-          'name' => 'organization_name',
-          'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Organization Name'),
-          'description' => ts('Organization Name.'),
-          'maxlength' => 128,
-          'size' => 30,
-          'usage' => [
-            'import' => TRUE,
-            'export' => TRUE,
-            'duplicate_matching' => TRUE,
-            'token' => FALSE,
-          ],
-          'import' => TRUE,
-          'where' => 'civicrm_contact.organization_name',
-          'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
-          'dataPattern' => '/^\w+$/',
-          'export' => TRUE,
-          'contactType' => 'Organization',
-          'table_name' => 'civicrm_contact',
-          'entity' => 'Contact',
-          'bao' => 'CRM_Contact_BAO_Contact',
-          'localizable' => 0,
-          'html' => [
-            'type' => 'Text',
-            'label' => ts("Organization Name"),
-          ],
-          'add' => '1.1',
-        ],
         'sic_code' => [
           'name' => 'sic_code',
           'type' => CRM_Utils_Type::T_STRING,
@@ -1980,6 +1950,36 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'readonly' => TRUE,
           'add' => '4.3',
         ],
+        'preferred_mail_format' => [
+          'name' => 'preferred_mail_format',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('Preferred Mail Format'),
+          'description' => ts('Deprecated setting for text vs html mailings'),
+          'maxlength' => 8,
+          'size' => CRM_Utils_Type::EIGHT,
+          'usage' => [
+            'import' => FALSE,
+            'export' => FALSE,
+            'duplicate_matching' => FALSE,
+            'token' => FALSE,
+          ],
+          'where' => 'civicrm_contact.preferred_mail_format',
+          'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
+          'default' => 'Both',
+          'table_name' => 'civicrm_contact',
+          'entity' => 'Contact',
+          'bao' => 'CRM_Contact_BAO_Contact',
+          'localizable' => 0,
+          'deprecated' => TRUE,
+          'html' => [
+            'type' => 'Select',
+            'label' => ts("Preferred Mail Format"),
+          ],
+          'pseudoconstant' => [
+            'callback' => 'CRM_Core_SelectValues::pmf',
+          ],
+          'add' => '1.1',
+        ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
     }
@@ -2058,6 +2058,23 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
         'localizable' => FALSE,
         'sig' => 'civicrm_contact::0::contact_type',
       ],
+      'UI_external_identifier' => [
+        'name' => 'UI_external_identifier',
+        'field' => [
+          0 => 'external_identifier',
+        ],
+        'localizable' => FALSE,
+        'unique' => TRUE,
+        'sig' => 'civicrm_contact::1::external_identifier',
+      ],
+      'index_organization_name' => [
+        'name' => 'index_organization_name',
+        'field' => [
+          0 => 'organization_name',
+        ],
+        'localizable' => FALSE,
+        'sig' => 'civicrm_contact::0::organization_name',
+      ],
       'index_contact_sub_type' => [
         'name' => 'index_contact_sub_type',
         'field' => [
@@ -2066,14 +2083,21 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
         'localizable' => FALSE,
         'sig' => 'civicrm_contact::0::contact_sub_type',
       ],
-      'UI_external_identifier' => [
-        'name' => 'UI_external_identifier',
+      'index_first_name' => [
+        'name' => 'index_first_name',
         'field' => [
-          0 => 'external_identifier',
+          0 => 'first_name',
         ],
         'localizable' => FALSE,
-        'unique' => TRUE,
-        'sig' => 'civicrm_contact::1::external_identifier',
+        'sig' => 'civicrm_contact::0::first_name',
+      ],
+      'index_last_name' => [
+        'name' => 'index_last_name',
+        'field' => [
+          0 => 'last_name',
+        ],
+        'localizable' => FALSE,
+        'sig' => 'civicrm_contact::0::last_name',
       ],
       'index_sort_name' => [
         'name' => 'index_sort_name',
@@ -2107,22 +2131,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
         'localizable' => FALSE,
         'sig' => 'civicrm_contact::0::api_key',
       ],
-      'index_first_name' => [
-        'name' => 'index_first_name',
-        'field' => [
-          0 => 'first_name',
-        ],
-        'localizable' => FALSE,
-        'sig' => 'civicrm_contact::0::first_name',
-      ],
-      'index_last_name' => [
-        'name' => 'index_last_name',
-        'field' => [
-          0 => 'last_name',
-        ],
-        'localizable' => FALSE,
-        'sig' => 'civicrm_contact::0::last_name',
-      ],
       'UI_prefix' => [
         'name' => 'UI_prefix',
         'field' => [
@@ -2171,14 +2179,6 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
         'localizable' => FALSE,
         'sig' => 'civicrm_contact::0::household_name',
       ],
-      'index_organization_name' => [
-        'name' => 'index_organization_name',
-        'field' => [
-          0 => 'organization_name',
-        ],
-        'localizable' => FALSE,
-        'sig' => 'civicrm_contact::0::organization_name',
-      ],
       'index_is_deleted_sort_name' => [
         'name' => 'index_is_deleted_sort_name',
         'field' => [
index 59078d8361b0b1c6770e1276d3370aacc82bb2c2..569d40e025bea39673c2d367500be451f50054a6 100644 (file)
     <fieldName>contact_type</fieldName>
     <add>2.1</add>
   </index>
+  <field>
+    <name>external_identifier</name>
+    <type>varchar</type>
+    <length>64</length>
+    <html>
+      <type>Text</type>
+      <size>8</size>
+      <label>External Identifier</label>
+    </html>
+
+    <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>
+  </index>
+  <field>
+    <name>display_name</name>
+    <title>Display Name</title>
+    <type>varchar</type>
+    <length>128</length>
+    <html>
+      <type>Text</type>
+      <size>30</size>
+    </html>
+    <readonly>true</readonly>
+    <export>true</export>
+    <comment>Formatted name representing preferred format for display/print/other output.</comment>
+    <add>1.1</add>
+  </field>
+  <field>
+    <name>organization_name</name>
+    <type>varchar</type>
+    <length>128</length>
+    <html>
+      <type>Text</type>
+      <size>30</size>
+      <label>Organization Name</label>
+    </html>
+    <import>true</import>
+    <headerPattern>/^organization|(o(rganization\s)?name)$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <comment>Organization Name.</comment>
+    <fulltext/>
+    <add>1.1</add>
+    <contactType>Organization</contactType>
+  </field>
+  <index>
+    <name>index_organization_name</name>
+    <fieldName>organization_name</fieldName>
+    <add>1.8</add>
+  </index>
   <field>
     <name>contact_sub_type</name>
     <title>Contact Subtype</title>
     <fieldName>contact_sub_type</fieldName>
     <add>2.1</add>
   </index>
+  <field>
+    <name>first_name</name>
+    <type>varchar</type>
+    <length>64</length>
+    <html>
+      <type>Text</type>
+      <size>30</size>
+      <label>First Name</label>
+    </html>
+    <import>true</import>
+    <headerPattern>/^first|(f(irst\s)?name)$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <fulltext/>
+    <comment>First Name.</comment>
+    <add>1.1</add>
+    <contactType>Individual</contactType>
+  </field>
+  <index>
+    <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>
+    <html>
+      <type>Text</type>
+      <size>30</size>
+      <label>Middle Name</label>
+    </html>
+    <import>true</import>
+    <headerPattern>/^middle|(m(iddle\s)?name)$/i</headerPattern>
+    <dataPattern>/^\w+$/</dataPattern>
+    <fulltext/>
+    <comment>Middle Name.</comment>
+    <add>1.1</add>
+    <contactType>Individual</contactType>
+  </field>
+  <field>
+    <name>last_name</name>
+    <type>varchar</type>
+    <length>64</length>
+    <html>
+      <type>Text</type>
+      <size>30</size>
+      <label>Last Name</label>
+    </html>
+    <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>
+    <contactType>Individual</contactType>
+  </field>
+  <index>
+    <name>index_last_name</name>
+    <fieldName>last_name</fieldName>
+    <add>1.8</add>
+  </index>
   <field>
     <name>do_not_email</name>
     <type>boolean</type>
       <label>Legal Identifier</label>
     </html>
   </field>
-  <field>
-    <name>external_identifier</name>
-    <type>varchar</type>
-    <length>64</length>
-    <html>
-      <type>Text</type>
-      <size>8</size>
-      <label>External Identifier</label>
-    </html>
-
-    <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>
-  </index>
   <field>
     <name>sort_name</name>
     <title>Sort Name</title>
     <fieldName>sort_name</fieldName>
     <add>2.1</add>
   </index>
-  <field>
-    <name>display_name</name>
-    <title>Display Name</title>
-    <type>varchar</type>
-    <length>128</length>
-    <html>
-      <type>Text</type>
-      <size>30</size>
-    </html>
-    <readonly>true</readonly>
-    <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>
     </html>
     <add>3.2</add>
   </field>
-  <field>
-    <name>preferred_mail_format</name>
-    <type>varchar</type>
-    <length>8</length>
-    <default>"Both"</default>
-    <import>false</import>
-    <headerPattern>/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i</headerPattern>
-    <comment>Deprecated setting for text vs html mailings</comment>
-    <add>1.1</add>
-    <pseudoconstant>
-      <callback>CRM_Core_SelectValues::pmf</callback>
-    </pseudoconstant>
-    <html>
-      <type>Select</type>
-      <label>Preferred Mail Format</label>
-    </html>
-    <deprecated>true</deprecated>
-  </field>
   <field>
     <name>hash</name>
     <title>Contact Hash</title>
     <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>
-    <html>
-      <type>Text</type>
-      <size>30</size>
-      <label>First Name</label>
-    </html>
-    <import>true</import>
-    <headerPattern>/^first|(f(irst\s)?name)$/i</headerPattern>
-    <dataPattern>/^\w+$/</dataPattern>
-    <fulltext/>
-    <comment>First Name.</comment>
-    <add>1.1</add>
-    <contactType>Individual</contactType>
-  </field>
-  <index>
-    <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>
-    <html>
-      <type>Text</type>
-      <size>30</size>
-      <label>Middle Name</label>
-    </html>
-    <import>true</import>
-    <headerPattern>/^middle|(m(iddle\s)?name)$/i</headerPattern>
-    <dataPattern>/^\w+$/</dataPattern>
-    <fulltext/>
-    <comment>Middle Name.</comment>
-    <add>1.1</add>
-    <contactType>Individual</contactType>
-  </field>
-  <field>
-    <name>last_name</name>
-    <type>varchar</type>
-    <length>64</length>
-    <html>
-      <type>Text</type>
-      <size>30</size>
-      <label>Last Name</label>
-    </html>
-    <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>
-    <contactType>Individual</contactType>
-  </field>
-  <index>
-    <name>index_last_name</name>
-    <fieldName>last_name</fieldName>
-    <add>1.8</add>
-  </index>
   <field>
     <name>prefix_id</name>
     <title>Individual Prefix</title>
     <add>1.1</add>
     <onDelete>SET NULL</onDelete>
   </foreignKey>
-  <field>
-    <name>organization_name</name>
-    <type>varchar</type>
-    <length>128</length>
-    <html>
-      <type>Text</type>
-      <size>30</size>
-      <label>Organization Name</label>
-    </html>
-    <import>true</import>
-    <headerPattern>/^organization|(o(rganization\s)?name)$/i</headerPattern>
-    <dataPattern>/^\w+$/</dataPattern>
-    <comment>Organization Name.</comment>
-    <fulltext/>
-    <add>1.1</add>
-    <contactType>Organization</contactType>
-  </field>
-  <index>
-    <name>index_organization_name</name>
-    <fieldName>organization_name</fieldName>
-    <add>1.8</add>
-  </index>
   <field>
     <name>sic_code</name>
     <type>varchar</type>
     <fieldName>modified_date</fieldName>
     <add>5.18</add>
   </index>
+  <field>
+    <name>preferred_mail_format</name>
+    <type>varchar</type>
+    <length>8</length>
+    <default>"Both"</default>
+    <import>false</import>
+    <headerPattern>/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i</headerPattern>
+    <comment>Deprecated setting for text vs html mailings</comment>
+    <add>1.1</add>
+    <pseudoconstant>
+      <callback>CRM_Core_SelectValues::pmf</callback>
+    </pseudoconstant>
+    <html>
+      <type>Select</type>
+      <label>Preferred Mail Format</label>
+    </html>
+    <deprecated>true</deprecated>
+  </field>
 </table>