X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm%2FOptions.php;h=07ea080b35d71a5a4dd8914919f9d3fe016b3bcb;hb=18a3fc9e5548ef6333a8bb28551dd1debe274c8a;hp=e247f55194536b01b1912db4980fcad652e6fdb4;hpb=5105de09b866a840dc698ab62269ead67a70fadf;p=civicrm-core.git diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index e247f55194..07ea080b35 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2017 | + | Copyright CiviCRM LLC (c) 2004-2018 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2017 + * @copyright CiviCRM LLC (c) 2004-2018 */ /** @@ -50,6 +50,12 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { */ protected $_gLabel; + /** + * Is this Option Group Domain Specific + * @var bool + */ + protected $_domainSpecific = FALSE; + /** * Pre-process */ @@ -74,6 +80,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { 'name' ); $this->_gLabel = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gid, 'title'); + $this->_domainSpecific = in_array($this->_gName, CRM_Core_OptionGroup::$_domainIDGroups); $url = "civicrm/admin/options/{$this->_gName}"; $params = "reset=1"; @@ -172,6 +179,11 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'), TRUE ); + $this->addRule('value', + ts('This Value already exists in the database for this option group. Please select a different Value.'), + 'optionExists', + array('CRM_Core_DAO_OptionValue', $this->_id, $this->_gid, 'value', $this->_domainSpecific) + ); } else { $this->add('text', 'icon', ts('Icon'), array('class' => 'crm-icon-picker', 'title' => ts('Choose Icon'), 'allowClear' => TRUE)); @@ -187,12 +199,10 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { 'addressee', )) && !$isReserved ) { - $domainSpecificOptionGroups = array('from_email_address'); - $domainSpecific = in_array($this->_gName, $domainSpecificOptionGroups) ? TRUE : FALSE; $this->addRule('label', - ts('This Label already exists in the database for this option group. Please select a different Value.'), + ts('This Label already exists in the database for this option group. Please select a different Label.'), 'optionExists', - array('CRM_Core_DAO_OptionValue', $this->_id, $this->_gid, 'label', $domainSpecific) + array('CRM_Core_DAO_OptionValue', $this->_id, $this->_gid, 'label', $this->_domainSpecific) ); }