From 155a0ed00e8004f377b9f837fdb2b7c15d2e0de8 Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Wed, 9 Jul 2014 16:00:51 -0400 Subject: [PATCH] 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 --- CRM/Core/BAO/Dashboard.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)) { -- 2.25.1