Introduce new `communication_style` field for Contacts
authorOlaf Buddenhagen <antrik@digitalcourage.de>
Tue, 13 Aug 2013 21:58:07 +0000 (23:58 +0200)
committerOlaf Buddenhagen <antrik@digitalcourage.de>
Wed, 9 Oct 2013 10:16:23 +0000 (12:16 +0200)
Add new field in the Communication Preferences block, mostly for driving
the new conditional greeting templates. (Though other uses are
possible of course.)

The Communication Style field is implemented as radio buttons defined
through an option group (pseudoconstant), similar to the Gender field.
Unlike Gender, it has a default value assigned automatically for new
contacts.

The field is placed just above the Email Greeting, Postal Greeting, and
Addresse controls, as it's meant to be used as a kind of master switch
driving the various greeting templates. Just like the Prefix/Suffix
fields in the name block for Individual contacts, the Communication
Style field is automatically hidden from all forms and views if no
option values are defined for the field.

The database field comes with an index, like all(?) pseudoconstant
fields. Presently the index is not used much (probably the only place
being deletion of existing option values); but this is likely to change
when more functionality is added around this field in the future.
(Search etc.)

The handling of the new field throughout the CiviCRM code base should be
mostly complete. We deliberately punted on some of the obvious, larger
pieces of functionality (search, import, profiles) for now, as they
would require considerable additional effort, so we treat them as extra
features to be implemented seperately upon need. We tried to be complete
with all smaller bits (mostly by grepping for `gender`, which requires
similar handling in most places...); but we might have omitted some,
and/or done some that aren't actually necessary -- it's rather hard to
tell sometimes what a particular piece of code is all about...

20 files changed:
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Query.php
CRM/Contact/Form/Edit/CommunicationPreferences.php
CRM/Contact/Form/Inline/CommunicationPreferences.php
CRM/Contact/Page/Inline/CommunicationPreferences.php
CRM/Contact/Page/View/Summary.php
CRM/Core/BAO/OptionValue.php
CRM/Dedupe/Merger.php
CRM/Event/BAO/Event.php
CRM/Export/BAO/Export.php
CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl
CRM/Utils/Address.php
CRM/Utils/Migrate/ExportJSON.php
CRM/Utils/Token.php
templates/CRM/Contact/Form/Contact.hlp
templates/CRM/Contact/Form/Edit/CommunicationPreferences.tpl
templates/CRM/Contact/Form/Inline/CommunicationPreferences.tpl
templates/CRM/Contact/Page/Inline/CommunicationPreferences.tpl
xml/schema/Contact/Contact.xml
xml/templates/civicrm_data.tpl

index 57768039f5af549fc91837b516d1de6adea8a76b..64e029841cf53450edf71aa16094b04710ede2fc 100644 (file)
@@ -520,6 +520,7 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
     CRM_Utils_Array::lookupValue($defaults, 'prefix', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'), $reverse);
     CRM_Utils_Array::lookupValue($defaults, 'suffix', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'), $reverse);
     CRM_Utils_Array::lookupValue($defaults, 'gender', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), $reverse);
+    CRM_Utils_Array::lookupValue($defaults, 'communication_style', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id'), $reverse);
 
     //lookup value of email/postal greeting, addressee, CRM-4575
     foreach (self::$_greetingTypes as $greeting) {
index 064308d6577c7f5ec9ba312def9c278f1003446e..a8432dc1950a7d7032cba7c1adb43829e990a158 100644 (file)
@@ -756,6 +756,9 @@ class CRM_Contact_BAO_Query {
                   if ($fieldName == 'gender_id') {
                     $this->_pseudoConstantsSelect['gender'] = array('pseudoField' => 'gender_id', 'idCol' => "gender_id", 'bao' => 'CRM_Contact_BAO_Contact');
                   }
+                  if ($name == 'communication_style_id') {
+                    $this->_pseudoConstantsSelect['communication_style'] = array('pseudoField' => 'communication_style_id', 'idCol' => "communication_style_id", 'bao' => 'CRM_Contact_BAO_Contact');
+                  }
                   $this->_select[$name] = "contact_a.{$fieldName}  as `$name`";
                 }
               }
@@ -3988,6 +3991,7 @@ civicrm_relationship.start_date > {$today}
           'prefix_id' => 1,
           'suffix_id' => 1,
           'formal_title' => 1,
+          'communication_style_id' => 1,
           'birth_date' => 1,
           'gender_id' => 1,
           'street_address' => 1,
@@ -4540,6 +4544,7 @@ SELECT COUNT( civicrm_contribution.total_amount ) as cancel_count,
         'prefix_id' => 1,
         'suffix_id' => 1,
         'formal_title' => 1,
+        'communication_style_id' => 1,
         'email_greeting' => 1,
         'postal_greeting' => 1,
         'addressee' => 1,
@@ -5017,7 +5022,7 @@ 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_id', 'prefix_id', 'suffix_id', 'communication_style_id');
 
     if (is_numeric($value)) {
       $qill = $selectValues[(int ) $value];
@@ -5051,7 +5056,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_id', 'prefix_id', 'suffix_id', 'communication_style_id'))) {
         $wc = "contact_a.{$name}_id";
       }
       $dataType = 'Positive';
index bf2a39e8aac6dd7b02758eab8e5f1ec84ae26098..905a5dc7bcc91d4cd0fe1905d4cd1feacfed71cd 100644 (file)
@@ -99,6 +99,18 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
     $form->add('select', 'preferred_mail_format', ts('Email Format'), CRM_Core_SelectValues::pmf());
     $form->add('checkbox', 'is_opt_out', ts('NO BULK EMAILS (User Opt Out)'));
 
+    $communicationStyleOptions = array();
+    $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id', array('localize' => TRUE));
+    foreach ($communicationStyle as $key => $var) {
+      $communicationStyleOptions[$key] = $form->createElement('radio', NULL,
+        ts('Communication Style'), $var, $key,
+        array('id' => "civicrm_communication_style_{$var}_{$key}")
+      );
+    }
+    if (!empty($communicationStyleOptions)) {
+      $form->addGroup($communicationStyleOptions, 'communication_style_id', ts('Communication Style'));
+    }
+
     //check contact type and build filter clause accordingly for greeting types, CRM-4575
     $greetings = self::getGreetingFields($form->_contactType);
 
@@ -171,6 +183,10 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
       $defaults['preferred_language'] = $config->lcMessages;
     }
 
+    if (empty($defaults['communication_style_id'])) {
+      $defaults['communication_style_id'] = array_pop(CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND is_default = 1'));
+    }
+
     //set default from greeting types CRM-4575, CRM-9739
     if ($form->_action & CRM_Core_Action::ADD) {
       foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
index e3894a6371c8d7fa08973b32160adfbb9c6ff051..729ce157f8c3d12e1bbca7d11a1a98268d012afc 100644 (file)
@@ -69,6 +69,10 @@ class CRM_Contact_Form_Inline_CommunicationPreferences extends CRM_Contact_Form_
       $defaults['preferred_language'] = $config->lcMessages;
     }
 
+    if (empty($defaults['communication_style_id'])) {
+      $defaults['communication_style_id'] = array_pop(CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND is_default = 1'));
+    }
+
     foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
       $name = "{$greeting}_display";
       $this->assign($name, CRM_Utils_Array::value($name, $defaults));
index 445b6a60b8b29d8b7a7b7e3a92363c5b75629f73..30e95eb1cd94d17834682f5aa72182fcc2030150 100644 (file)
@@ -58,6 +58,17 @@ class CRM_Contact_Page_Inline_CommunicationPreferences extends CRM_Core_Page {
     CRM_Contact_BAO_Contact::getValues( $params, $defaults );
     $defaults['privacy_values'] = CRM_Core_SelectValues::privacy();
 
+    $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id');
+    if (!empty($communicationStyle)) {
+      if (CRM_Utils_Array::value('communication_style_id', $defaults)) {
+        $defaults['communication_style_display'] = $communicationStyle[CRM_Utils_Array::value('communication_style_id', $defaults)];
+      }
+      else {
+        // Make sure the field is displayed as long as it is active, even if it is unset for this contact.
+        $defaults['communication_style_display'] = '';
+      }
+    }
+
     $this->assign('contactId', $contactId);
     $this->assign($defaults);
 
index c09ffc481041e5e548f30178bf754173ac954eeb..b1d09b9eebd06e6056175f27b04bb8982c967cc4 100644 (file)
@@ -211,6 +211,17 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
       $defaults['gender_display'] = $gender[CRM_Utils_Array::value('gender_id', $defaults)];
     }
 
+    $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id');
+    if (!empty($communicationStyle)) {
+      if (CRM_Utils_Array::value('communication_style_id', $defaults)) {
+        $defaults['communication_style_display'] = $communicationStyle[CRM_Utils_Array::value('communication_style_id', $defaults)];
+      }
+      else {
+        // Make sure the field is displayed as long as it is active, even if it is unset for this contact.
+        $defaults['communication_style_display'] = '';
+      }
+    }
+
     // to make contact type label available in the template -
     $contactType = array_key_exists('contact_sub_type', $defaults) ? $defaults['contact_sub_type'] : $defaults['contact_type'];
     $defaults['contact_type_label'] = CRM_Contact_BAO_ContactType::contactTypePairs(TRUE, $contactType, ', ');
index fab3a17efd8fb6f9b2f96f407605b51542114666..9dfbb190e3b7f725e4894afecff56d6fa608fd82 100644 (file)
@@ -295,6 +295,7 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
       'gender' => 'gender_id',
       'individual_prefix' => 'prefix_id',
       'individual_suffix' => 'suffix_id',
+      'communication_style' => 'communication_style_id', // Not only Individuals -- but the code seems to be generic for all contact types, despite the naming...
     );
     $contributions = array('payment_instrument' => 'payment_instrument_id');
     $activities    = array('activity_type' => 'activity_type_id');
index e3d2791416e9d339858dfb6f234ab8985c1a8074..49bc4fe0dfcb4d9491b8df3f1efb571fd7e4d4c7 100644 (file)
@@ -1272,6 +1272,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     $names['gender'] = array('newName' => 'gender_id', 'groupName' => 'gender');
     $names['individual_prefix'] = array('newName' => 'prefix_id', 'groupName' => 'individual_prefix');
     $names['individual_suffix'] = array('newName' => 'suffix_id', 'groupName' => 'individual_suffix');
+    $names['communication_style'] = array('newName' => 'communication_style_id', 'groupName' => 'communication_style');
     $names['addressee'] = array('newName' => 'addressee_id', 'groupName' => 'addressee');
     $names['email_greeting'] = array('newName' => 'email_greeting_id', 'groupName' => 'email_greeting');
     $names['postal_greeting'] = array('newName' => 'postal_greeting_id', 'groupName' => 'postal_greeting');
index bf38cb365cced4cf75e3efccac4f90562e8eddda..47cada59571d2f86296eb551c838804b7519da47 100644 (file)
@@ -1418,7 +1418,7 @@ WHERE civicrm_event.is_active = 1
             $values[$index] = '';
           }
         }
-        elseif (in_array(substr($name, 0, -3), array('gender', 'prefix', 'suffix'))) {
+        elseif (in_array(substr($name, 0, -3), array('gender', 'prefix', 'suffix', 'communication_style'))) {
           $values[$index] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $name, $params[$name]);
         }
         elseif (in_array($name, array(
index d82899b468e2b5a4dfd6dc4ad67e7123fd027e6c..62c9fafe8d6740dd60a7548f0c8e4cadc6335b2d 100644 (file)
@@ -799,7 +799,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
           elseif ($field == 'pledge_next_pay_amount') {
             $row[$field] = $dao->pledge_next_pay_amount + $dao->pledge_outstanding_amount;
           }
-          elseif (in_array(substr($field, 0, -3), array('gender', 'prefix', 'suffix'))) {
+          elseif (in_array(substr($field, 0, -3), array('gender', 'prefix', 'suffix', 'communication_style'))) {
             $row[$field] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $field, $dao->$field);
           }
           elseif (is_array($value) && $field == 'location') {
@@ -971,6 +971,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
                 case 'gender':
                 case 'preferred_communication_method':
                 case 'preferred_mail_format':
+                case 'communication_style':
                   $row[$field] = $i18n->crm_translate($fieldValue);
                   break;
 
index dc952096649e4e1a961613c5e1fd78d30490c2af..3a0a94bf45f894f704433e2469406c92fe8ec918 100644 (file)
@@ -2,3 +2,20 @@
 
 ALTER TABLE `civicrm_contact`
   ADD COLUMN `formal_title` varchar(64) COMMENT 'Formal (academic or similar) title in front of name. (Prof., Dr. etc.)' AFTER `suffix_id`;
+
+ALTER TABLE `civicrm_contact`
+  ADD COLUMN `communication_style_id` int(10) unsigned COMMENT 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.' AFTER `formal_title`,
+  ADD INDEX `index_communication_style_id` (`communication_style_id`);
+
+INSERT INTO
+  `civicrm_option_group` (`name`, {localize field='title'}`title`{/localize}, `is_reserved`, `is_active`)
+VALUES
+  ('communication_style', {localize}'{ts escape="sql"}Communication Style{/ts}'{/localize}, 1, 1);
+
+SELECT @option_group_id_communication_style := max(id) from civicrm_option_group where name = 'communication_style';
+
+INSERT INTO
+  `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
+VALUES
+  (@option_group_id_communication_style, {localize}'{ts escape="sql"}Formal{/ts}'{/localize}  , 1, 'formal'  , NULL, 0, 1, 1, NULL, 0, 0, 1, NULL, NULL),
+  (@option_group_id_communication_style, {localize}'{ts escape="sql"}Familiar{/ts}'{/localize}, 2, 'familiar', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL);
index 352927dabab9b18a647484b1e710e02fe0c34d88..e659b1949a38866f1129305cbee7ea013658aee3 100644 (file)
@@ -149,6 +149,7 @@ class CRM_Utils_Address {
         'contact.organization_name' => CRM_Utils_Array::value('display_name', $fields),
         'contact.legal_name' => CRM_Utils_Array::value('legal_name', $fields),
         'contact.preferred_communication_method' => CRM_Utils_Array::value('preferred_communication_method', $fields),
+        'contact.communication_style' => CRM_Utils_Array::value('communication_style', $fields),
         'contact.addressee' => CRM_Utils_Array::value('addressee_display', $fields),
         'contact.email_greeting' => CRM_Utils_Array::value('email_greeting_display', $fields),
         'contact.postal_greeting' => CRM_Utils_Array::value('postal_greeting_display', $fields),
index f9b9bddbef3442765d0896547d9e1bed653e0041..cf27002b65a68f26647526a4d44df7f5476124bd 100644 (file)
@@ -120,6 +120,7 @@ class CRM_Utils_Migrate_ExportJSON {
       'status_id' => 'activity_status_id',
       'priority_id' => 'activity_priority_id',
       'medium_id' => 'encounter_medium',
+      'communication_style_id' => 'communication_style',
       'email_greeting' => 'email_greeting',
       'postal_greeting' => 'postal_greeting',
       'addressee_id' => 'addressee',
index ed5e490bbe75eca079f815aed678f9542eb8c444..5b32c627bb62dde31484ed2f25a5d9ba687f7268 100644 (file)
@@ -1496,6 +1496,7 @@ class CRM_Utils_Token {
       'individual_prefix' => 'prefix_id',
       'individual_suffix' => 'suffix_id',
       'gender' => 'gender_id',
+      'communication_style' => 'communication_style_id',
     );
   }
 
index 924a32d0d1594f37ba99e12624f7636024ac68ad..2de028a8af32efe277d3db9984e05327f3dea721 100644 (file)
 <p>{ts}You can use an address belonging to an existing contact or create a new contact by selecting the desired contact type from the select field. If you link an individual's address to an organization, an employee-employer relationship will be automatically created. If you link an individual's address to a household, a household member relationship is created.{/ts}</p>
 {/htxt}
 
+{htxt id="id-communication_style-title"}
+  {ts}Communication Style{/ts}
+{/htxt}
+{htxt id="id-communication_style"}
+<p>{ts}Choose how you communicate with this contact, e.g. on formal or familiar terms.{/ts}</p>
+<p>{ts}Depending on the CiviCRM setup, email and postal greetings (see below) may be automatically adapted accordingly; or the information can be used in other ways.{/ts}</p>
+{/htxt}
+
 {htxt id="id-greeting-title"}
   {ts}Greeting{/ts}
 {/htxt}
index 5eaf323488664cbd7e36a0175ba05cab43467d9e..e6f9ba16894d0086ca4ec7309edc5459e709a0ad 100644 (file)
   </div><!-- /.crm-accordion-header -->
 <div id="commPrefs" class="crm-accordion-body">
     <table class="form-layout-compressed" >
+        {if !empty($form.communication_style_id)}
+            <tr><td colspan='4'>
+                <span class="label">{$form.communication_style_id.label} {help id="id-communication_style" file="CRM/Contact/Form/Contact.hlp"}</span>
+                <span class="value">{$form.communication_style_id.html}</span>
+            </td><tr>
+        {/if}
         <tr>
             {if !empty($form.email_greeting_id)}
                 <td>{$form.email_greeting_id.label}</td>
index 7e066f528856c037df2ca96cc4dbc0e533531524..70425e8a1e24f3a3086f6545534b3a5245fede8a 100644 (file)
       </div>
       {/if}
 
+      {if !empty($form.communication_style_id)}
+      <div class="crm-summary-row">
+        <div class="crm-label">
+          {$form.communication_style_id.label} {help id="id-communication_style" file="CRM/Contact/Form/Contact.hlp"}
+        </div>
+        <div class="crm-content">
+          {$form.communication_style_id.html}
+        </div>
+      </div>
+      {/if}
+
       {if !empty($form.email_greeting_id)}
       <div class="crm-summary-row">
         <div class="crm-label">{$form.email_greeting_id.label}</div>
index 0c4287c1441b38075d6cbef0513af7f260dfcaa7..6c6e9954347b2c0fd320f14e3a862bb65e2fb504 100644 (file)
         {$preferred_mail_format}
       </div>
     </div>
+    {if isset($communication_style_display)}
+    <div class="crm-summary-row">
+      <div class="crm-label">{ts}Communication Style{/ts}</div>
+      <div class="crm-content crm-contact-communication_style_display">
+        {$communication_style_display}
+      </div>
+    </div>
+    {/if}
     <div class="crm-summary-row">
       <div class="crm-label">{ts}Email Greeting{/ts}</div>
       <div class="crm-content crm-contact-email_greeting_display">
index 292a3691a7a4dd2e97d0eb88e88e67257218cfdd..2ab3428a77f4e4fb54ea46aaa2295cf986658505 100644 (file)
       <comment>Formal (academic or similar) title in front of name. (Prof., Dr. etc.)</comment>
       <add>4.5</add>
   </field>
+  <field>
+      <name>communication_style_id</name>
+      <title>Communication Style</title>
+      <type>int unsigned</type>
+      <pseudoconstant>
+        <optionGroupName>communication_style</optionGroupName>
+      </pseudoconstant>
+      <export>true</export>
+      <comment>Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.</comment>
+      <add>4.4</add>
+  </field>
+  <index>
+      <name>index_communication_style_id</name>
+      <fieldName>communication_style_id</fieldName>
+      <add>4.4</add>
+  </index>
   <field>
        <name>greeting_type</name>
        <type>varchar</type>
index 29b44de746dd4a4e098fc809e0c9d4a6dd561ddf..121f4ffbf3d3a4549d3caa94184874ebda274222 100644 (file)
@@ -205,7 +205,8 @@ VALUES
    ('financial_account_type'        , '{ts escape="sql"}Financial Account Type{/ts}'             , 1, 1),
    ('financial_item_status'         , '{ts escape="sql"}Financial Item Status{/ts}'              , 1, 1),
    ('label_type'                    , '{ts escape="sql"}Label Type{/ts}'                         , 1, 1),
-   ('name_badge'                    , '{ts escape="sql"}Name Badge Format{/ts}'                  , 1, 1);
+   ('name_badge'                    , '{ts escape="sql"}Name Badge Format{/ts}'                  , 1, 1),
+   ('communication_style'           , '{ts escape="sql"}Communication Style{/ts}'                , 1, 1);
 
 SELECT @option_group_id_pcm            := max(id) from civicrm_option_group where name = 'preferred_communication_method';
 SELECT @option_group_id_act            := max(id) from civicrm_option_group where name = 'activity_type';
@@ -280,6 +281,7 @@ SELECT @option_group_id_fat            := max(id) from civicrm_option_group wher
 SELECT @option_group_id_financial_item_status := max(id) from civicrm_option_group where name = 'financial_item_status';
 SELECT @option_group_id_label_type := max(id) from civicrm_option_group where name = 'label_type';
 SELECT @option_group_id_name_badge := max(id) from civicrm_option_group where name = 'name_badge';
+SELECT @option_group_id_communication_style := max(id) from civicrm_option_group where name = 'communication_style';
 
 
 SELECT @contributeCompId := max(id) FROM civicrm_component where name = 'CiviContribute';
@@ -891,7 +893,11 @@ VALUES
   (@option_group_id_label, '{ts escape="sql"}Avery L7160{/ts}', '{literal}{"paper-size":"a4","orientation":"portrait","font-name":"helvetica","font-size":9,"font-style":"","metric":"in","lMargin":0.28,"tMargin":0.6,"NX":3,"NY":7,"SpaceX":0.1,"SpaceY":0,"width":2.5,"height":1.5,"lPadding":0.20,"tPadding":0.20}{/literal}',          'L7160', 'Avery', NULL, 0, 8,  NULL, 0, 1, 1, NULL, NULL),
   (@option_group_id_label, '{ts escape="sql"}Avery L7161{/ts}', '{literal}{"paper-size":"a4","orientation":"portrait","font-name":"helvetica","font-size":9,"font-style":"","metric":"in","lMargin":0.28,"tMargin":0.35,"NX":3,"NY":6,"SpaceX":0.1,"SpaceY":0,"width":2.5,"height":1.83,"lPadding":0.20,"tPadding":0.20}{/literal}',        'L7161', 'Avery', NULL, 0, 9,  NULL, 0, 1, 1, NULL, NULL),
   (@option_group_id_label, '{ts escape="sql"}Avery L7162{/ts}', '{literal}{"paper-size":"a4","orientation":"portrait","font-name":"helvetica","font-size":9,"font-style":"","metric":"in","lMargin":0.18,"tMargin":0.51,"NX":2,"NY":8,"SpaceX":0.1,"SpaceY":0,"width":3.9,"height":1.33,"lPadding":0.20,"tPadding":0.20}{/literal}',        'L7162', 'Avery', NULL, 0, 10, NULL, 0, 1, 1, NULL, NULL),
-  (@option_group_id_label, '{ts escape="sql"}Avery L7163{/ts}', '{literal}{"paper-size":"a4","orientation":"portrait","font-name":"helvetica","font-size":9,"font-style":"","metric":"in","lMargin":0.18,"tMargin":0.6,"NX":2,"NY":7,"SpaceX":0.1,"SpaceY":0,"width":3.9,"height":1.5,"lPadding":0.20,"tPadding":0.20}{/literal}',          'L7163', 'Avery', NULL, 0, 11, NULL, 0, 1, 1, NULL, NULL);
+  (@option_group_id_label, '{ts escape="sql"}Avery L7163{/ts}', '{literal}{"paper-size":"a4","orientation":"portrait","font-name":"helvetica","font-size":9,"font-style":"","metric":"in","lMargin":0.18,"tMargin":0.6,"NX":2,"NY":7,"SpaceX":0.1,"SpaceY":0,"width":3.9,"height":1.5,"lPadding":0.20,"tPadding":0.20}{/literal}',          'L7163', 'Avery', NULL, 0, 11, NULL, 0, 1, 1, NULL, NULL),
+
+-- Communication Styles
+  (@option_group_id_communication_style, '{ts escape="sql"}Formal{/ts}'  , 1, 'formal'  , NULL, 0, 1, 1, NULL, 0, 0, 1, NULL, NULL),
+  (@option_group_id_communication_style, '{ts escape="sql"}Familiar{/ts}', 2, 'familiar', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL);
 
 -- financial accounts
 SELECT @opval := value FROM civicrm_option_value WHERE name = 'Revenue' and option_group_id = @option_group_id_fat;