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)
commitaa62b35561fed2b37560625faf7115bb30606416
tree487437c9b49fde59e46b2433dd5465dfc26ed187
parent5b5217d75b850748f19707387b65806831acf670
Introduce new `communication_style` field for Contacts

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