From: Jamie McClelland Date: Wed, 9 Jul 2014 20:00:51 +0000 (-0400) Subject: CRM-14966 - ensure we have a contactid before inserting dashboard item. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=155a0ed00e8004f377b9f837fdb2b7c15d2e0de8;p=civicrm-core.git CRM-14966 - ensure we have a contactid before inserting dashboard item. ---------------------------------------- * CRM-14966: inserting dashboard item using api from cli results in sql exception https://issues.civicrm.org/jira/browse/CRM-14966 --- diff --git a/CRM/Core/BAO/Dashboard.php b/CRM/Core/BAO/Dashboard.php index 21abcc28d9..3e7befb412 100644 --- a/CRM/Core/BAO/Dashboard.php +++ b/CRM/Core/BAO/Dashboard.php @@ -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)) {