CRM-19179: Only allow one 'set primary' to be checked per entity
[civicrm-core.git] / CRM / Grant / Form / Grant.php
index 5b05b5d053495326a41cb7c5fc5df9d085bf8234..927543463fe38fde377ef8200b8fbae91d6a45ac 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
  * $Id$
  *
  */
@@ -103,10 +103,11 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form {
 
     // when custom data is included in this page
     if (!empty($_POST['hidden_custom'])) {
+      $grantTypeId = empty($_POST['grant_type_id']) ? NULL : $_POST['grant_type_id'];
       $this->set('type', 'Grant');
-      $this->set('subType', CRM_Utils_Array::value('grant_type_id', $_POST));
+      $this->set('subType', $grantTypeId);
       $this->set('entityId', $this->_id);
-      CRM_Custom_Form_CustomData::preProcess($this);
+      CRM_Custom_Form_CustomData::preProcess($this, NULL, $grantTypeId, 1, 'Grant', $this->_id);
       CRM_Custom_Form_CustomData::buildQuickForm($this);
       CRM_Custom_Form_CustomData::setDefaultValues($this);
     }