Initial new user open CiviCRM base page hangs fix CRM-15936
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 13 Feb 2015 12:31:27 +0000 (18:01 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 13 Feb 2015 12:31:27 +0000 (18:01 +0530)
CRM/Core/BAO/Dashboard.php

index 1e939fe64007ce46f52d368384aed79ae1d41736..2de9a9394e57887204e17a7ac330b720202fae4e 100644 (file)
@@ -141,7 +141,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
 
     // If empty, then initialize contact dashboard for this user.
     if (!$hasDashlets) {
-      return self::initializeDashlets();
+      return self::initializeDashlets($flatFormat);
     }
     return $dashlets;
   }
@@ -155,7 +155,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
    * @return array
    *   Array of dashboard_id's
    */
-  public static function initializeDashlets() {
+  public static function initializeDashlets($flatFormat = FALSE) {
     $dashlets = array();
     $getDashlets = civicrm_api3("Dashboard", "get", array(
         'domain_id' => CRM_Core_Config::domainID(),
@@ -183,7 +183,13 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
         }
         else {
           $assignDashlets = civicrm_api3("dashboard_contact", "create", $defaultDashlet);
-          $dashlets[$dashboard_id] = $defaultDashlet['dashboard_id'];
+          if (!$flatFormat) {
+            $values = $assignDashlets['values'][$assignDashlets['id']];
+            $dashlets[$values['column_no']][$values['weight']-$values['dashboard_id']] = $values['is_minimized'];
+          }
+          else {
+            $dashlets[$dashboard_id] = $defaultDashlet['dashboard_id'];
+          }
         }
       }
     }