Change assignation in log of changes made via API (CRM-13549)
authorCapo <mail@carloscapote.com>
Mon, 7 Oct 2013 16:57:03 +0000 (18:57 +0200)
committerCapo <mail@carloscapote.com>
Mon, 7 Oct 2013 16:57:03 +0000 (18:57 +0200)
CRM/Core/BAO/Log.php

index 081826474a47588056625683f9a7538886e1e826..4c949445ede153bd86dc8cbb6400622d22af77fc 100644 (file)
@@ -88,6 +88,14 @@ class CRM_Core_BAO_Log extends CRM_Core_DAO_Log {
       $userID = $session->get('userID');
     }
 
+    if (!$userID) {
+      $api_key = CRM_Utils_Request::retrieve('api_key', 'String', $store, FALSE, NULL, 'REQUEST');
+
+      if ($api_key && strtolower($api_key) != 'null') {
+        $userID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $api_key, 'id', 'api_key');
+      }
+    }
+
     if (!$userID) {
       $userID = $contactID;
     }