CRM-19352-notice fix
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 7 Oct 2016 05:51:11 +0000 (11:21 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 7 Oct 2016 06:14:53 +0000 (11:44 +0530)
CRM/Custom/Form/CustomData.php

index 51547d825ef4f01c1b6e772c3bdaf72e86e2e5ab..9692791efc1aaa2480ef58b95aba097cf6e4f3cf 100644 (file)
@@ -152,11 +152,13 @@ class CRM_Custom_Form_CustomData {
    */
   public static function setGroupTree(&$form, $subType, $gid, $onlySubType = NULL, $getCachedTree = FALSE) {
     $singleRecord = NULL;
-    if (!empty($form->_groupCount) && $form->_multiRecordDisplay == 'single') {
+    if (!empty($form->_groupCount) && !empty($form->_multiRecordDisplay) && $form->_multiRecordDisplay == 'single') {
       $singleRecord = $form->_groupCount;
     }
     $mode = CRM_Utils_Request::retrieve('mode', 'String', $form);
-    if ($form->_groupCount == 0 && $mode == 'add' && $form->_multiRecordDisplay == 'single') {
+    // when a new record is being added for multivalued custom fields.
+    if (isset($form->_groupCount) && $form->_groupCount == 0 && $mode == 'add' &&
+      !empty($form->_multiRecordDisplay) && $form->_multiRecordDisplay == 'single') {
       $singleRecord = 'new';
     }