CRM-14966 - ensure we have a contactid before inserting dashboard item.
authorJamie McClelland <jm@mayfirst.org>
Wed, 9 Jul 2014 20:00:51 +0000 (16:00 -0400)
committerJamie McClelland <jm@mayfirst.org>
Wed, 9 Jul 2014 20:00:51 +0000 (16:00 -0400)
----------------------------------------
* CRM-14966: inserting dashboard item using api from cli results in sql exception
  https://issues.civicrm.org/jira/browse/CRM-14966

CRM/Core/BAO/Dashboard.php

index 21abcc28d9fb4ddd0c2ffab41ee2ed3035bb947f..3e7befb412af77e8183f67d5548c30e8f9da3dc4 100644 (file)
@@ -472,7 +472,10 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
     else {
       //Get the id of Logged in User
       $session = CRM_Core_Session::singleton();
-      $contactIDs[] = $session->get('userID');
+      $contactID = $session->get('userID');
+      if(!empty($contactID)) {
+        $contactIDs[] = $session->get('userID');
+      }
     }
 
     if (!empty($contactIDs)) {