Skip to content

Commit

Permalink
Merge pull request #10878 from seamuslee001/contact_edit_notices
Browse files Browse the repository at this point in the history
CRM-21075 Replace call to CRM_Core_OptionGroup::getValue with CRM_Cor…
  • Loading branch information
eileenmcnaughton authored Aug 22, 2017
2 parents bcb0eba + f4a9693 commit 1f8eeb3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
14 changes: 13 additions & 1 deletion CRM/Contact/DAO/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* Generated from xml/schema/CRM/Contact/Contact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:6b04aae8fb2f9ebedb5aa9c792b81e30)
* (GenCodeChecksum:1e87927c8c8bdec9acfe3c306bb711d4)
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
Expand Down Expand Up @@ -968,6 +968,10 @@ static function &fields() {
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
'localizable' => 0,
'pseudoconstant' => array(
'optionGroupName' => 'email_greeting',
'optionEditPath' => 'civicrm/admin/options/email_greeting',
)
) ,
'email_greeting_custom' => array(
'name' => 'email_greeting_custom',
Expand Down Expand Up @@ -1016,6 +1020,10 @@ static function &fields() {
'html' => array(
'type' => 'Text',
) ,
'pseudoconstant' => array(
'optionGroupName' => 'postal_greeting',
'optionEditPath' => 'civicrm/admin/options/postal_greeting',
)
) ,
'postal_greeting_custom' => array(
'name' => 'postal_greeting_custom',
Expand Down Expand Up @@ -1081,6 +1089,10 @@ static function &fields() {
'html' => array(
'type' => 'Text',
) ,
'pseudoconstant' => array(
'optionGroupName' => 'addressee',
'optionEditPath' => 'civicrm/admin/options/addressee',
)
) ,
'addressee_display' => array(
'name' => 'addressee_display',
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Edit/CommunicationPreferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static function formRule($fields, $files, $self) {

$greetings = self::getGreetingFields($self->_contactType);
foreach ($greetings as $greeting => $details) {
$customizedValue = CRM_Core_OptionGroup::getValue($greeting, 'Customized', 'name');
$customizedValue = CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $details['field'], 'Customized');
if (CRM_Utils_Array::value($details['field'], $fields) == $customizedValue && empty($fields[$details['customField']])) {
$errors[$details['customField']] = ts('Custom %1 is a required field if %1 is of type Customized.',
array(1 => $details['label'])
Expand Down
9 changes: 9 additions & 0 deletions xml/schema/Contact/Contact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,9 @@
<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>
<pseudoconstant>
<optionGroupName>email_greeting</optionGroupName>
</pseudoconstant>
</field>
<field>
<name>email_greeting_custom</name>
Expand Down Expand Up @@ -567,6 +570,9 @@
<html>
<type>Text</type>
</html>
<pseudoconstant>
<optionGroupName>postal_greeting</optionGroupName>
</pseudoconstant>
</field>
<field>
<name>postal_greeting_custom</name>
Expand Down Expand Up @@ -609,6 +615,9 @@
<html>
<type>Text</type>
</html>
<pseudoconstant>
<optionGroupName>addressee</optionGroupName>
</pseudoconstant>
</field>
<field>
<name>addressee_display</name>
Expand Down

0 comments on commit 1f8eeb3

Please sign in to comment.