CRM-14990: Don't force a value for is_reserved if it isn't passed into CRM_Core_BAO_C...
authorFrank J. Gómez <frank@ginkgostreet.com>
Wed, 16 Jul 2014 14:28:29 +0000 (10:28 -0400)
committerFrank J. Gómez <frank@ginkgostreet.com>
Wed, 16 Jul 2014 14:28:29 +0000 (10:28 -0400)
CRM/Core/BAO/CustomGroup.php

index 7d10aba1471234e205b5c171dbd46bde0ddad141..1bf03e1988655ef95dea696dcb6924382f4ac8fd 100644 (file)
@@ -160,14 +160,14 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup {
       }
     }
 
-    $is_reserved = CRM_Utils_Array::value('is_reserved', $params, 0);
-    if (in_array($is_reserved, array(TRUE, 1, '1'), TRUE)) {
-      $is_reserved = 1;
-    } else {
-      $is_reserved = 0;
+    if (array_key_exists('is_reserved', $params)) {
+      if (in_array($params['is_reserved'], array(TRUE, 1, '1'), TRUE)) {
+        $is_reserved = 1;
+      } else {
+        $is_reserved = 0;
+      }
+      $group->is_reserved = $is_reserved;
     }
-    $group->is_reserved = $is_reserved;
-
     $op = isset($params['id']) ? 'edit' : 'create';
     CRM_Utils_Hook::pre($op, 'CustomGroup', CRM_Utils_Array::value('id', $params), $params);