DataObjects/Core_notify.php
[Pman.Core] / DataObjects / Events.php
index 0129120..b10e1c5 100644 (file)
@@ -302,11 +302,16 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
         } 
           
         $this->person_name = $au && !empty($au->name) ? $au->name : '';
-        if (isset($au->id) && empty($au->id)) {
+        if (empty($au) || (isset($au->id) && empty($au->id))) {
             // not authenticated - and a standard id based object
             $this->person_id = 0;
         } else {
-            $this->person_id = $au ? (!empty($au->id) ? $au->id : $au->pid()) : -1;
+            $col = $au->tableName() == "Person" ? 'person_id' : $au->tableName() . '_id';
+            // does $col exist?
+            $cols = $this->table();
+            $col = isset($cols[$col]) ? $col : 'person_id'; // for BC.... - revert to using person_id
+            $this->{$col} = $au->pid();
+            //$this->person_id = $au ? (!empty($au->id) ? $au->id : $au->pid()) : -1;
         }
         $this->person_table = $au ? $au->tableName() : '';
         $this->ipaddr = isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : 'cli';
@@ -475,7 +480,6 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
             }
         }
         
-        $deleted = $this->deletedRecord(false, false);
         
         $i=0;
         $files = array();
@@ -502,8 +506,11 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
             'GET' => empty($_GET) ? array() : $_GET,
             'POST' =>$p,
             'FILES' => $files,
-            'RELATED_DATAOBJECT' => $deleted
+            
         );
+        if (!empty(self::$deleted)) {
+            $out['DELETED_DATAOBJECTS'] = self::$deleted;
+        }
         if (!empty($extra_data)) {
             $out['EXTRA'] = $extra_data;
         }