--HR-303 modification to fix notices while disabling casetype extension
authorDivya Jose <divya@divya.(none)>
Wed, 4 Jun 2014 15:05:35 +0000 (20:35 +0530)
committerDivya Jose <divya@divya.(none)>
Fri, 6 Jun 2014 10:18:31 +0000 (15:48 +0530)
CRM/Case/XMLProcessor/Process.php
CRM/Core/BAO/UFField.php

index 1f57224fc4bc71d079cef871e26828e65719678e..744e746c74d4e0639b799845ed7fa1914fe0164a 100644 (file)
@@ -314,23 +314,23 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor {
    */
   function getDeclaredActivityTypes($caseTypeXML) {
     $result = array();
-
-    if ($caseTypeXML->ActivityTypes && $caseTypeXML->ActivityTypes->ActivityType) {
-      foreach ($caseTypeXML->ActivityTypes->ActivityType as $activityTypeXML) {
-        $result[] = (string) $activityTypeXML->name;
+    if (!empty($caseTypeXML)) {
+      if ($caseTypeXML->ActivityTypes && $caseTypeXML->ActivityTypes->ActivityType) {
+        foreach ($caseTypeXML->ActivityTypes->ActivityType as $activityTypeXML) {
+          $result[] = (string) $activityTypeXML->name;
+        }
       }
-    }
 
-    if ($caseTypeXML->ActivitySets && $caseTypeXML->ActivitySets->ActivitySet) {
-      foreach ($caseTypeXML->ActivitySets->ActivitySet as $activitySetXML) {
-        if ($activitySetXML->ActivityTypes && $activitySetXML->ActivityTypes->ActivityType) {
-          foreach ($activitySetXML->ActivityTypes->ActivityType as $activityTypeXML) {
-            $result[] = (string) $activityTypeXML->name;
+      if ($caseTypeXML->ActivitySets && $caseTypeXML->ActivitySets->ActivitySet) {
+        foreach ($caseTypeXML->ActivitySets->ActivitySet as $activitySetXML) {
+          if ($activitySetXML->ActivityTypes && $activitySetXML->ActivityTypes->ActivityType) {
+            foreach ($activitySetXML->ActivityTypes->ActivityType as $activityTypeXML) {
+              $result[] = (string) $activityTypeXML->name;
+            }
           }
         }
       }
     }
-
     $result = array_unique($result);
     sort($result);
     return $result;
@@ -342,13 +342,13 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor {
    */
   function getDeclaredRelationshipTypes($caseTypeXML) {
     $result = array();
-
-    if ($caseTypeXML->CaseRoles && $caseTypeXML->CaseRoles->RelationshipType) {
-      foreach ($caseTypeXML->CaseRoles->RelationshipType as $relTypeXML) {
-        $result[] = (string) $relTypeXML->name;
+    if (!empty($caseTypeXML)) {
+      if ($caseTypeXML->CaseRoles && $caseTypeXML->CaseRoles->RelationshipType) {
+        foreach ($caseTypeXML->CaseRoles->RelationshipType as $relTypeXML) {
+          $result[] = (string) $relTypeXML->name;
+        }
       }
     }
-
     $result = array_unique($result);
     sort($result);
     return $result;
index 32045ba5f35794a6b39301eb657fe98524e2db93..22bcf67496e8eb391b6e511bbab9877a32afa023 100644 (file)
@@ -348,7 +348,7 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1";
    * @static
    * @access public
    */
-  function setUFFieldStatus($customGroupId, $is_active) {
+  static function setUFFieldStatus($customGroupId, $is_active) {
     //find the profile id given custom group id
     $queryString = "SELECT civicrm_custom_field.id as custom_field_id
                         FROM   civicrm_custom_field, civicrm_custom_group