DataObjects/Core_company.php
[Pman.Core] / DataObjects / Core_project.php
index 671c76e..818a3ee 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Table Definition for Projects
  */
-require_once 'DB/DataObject.php';
+class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php';
 
 class Pman_Core_DataObjects_Core_project extends DB_DataObject 
 {
@@ -69,7 +69,7 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject
 
     function toEventString() {
         $c = $this->client();
-        return ($c->id ? $c->toEventString() : '??'). ':' . $this->name;
+        return ($c && $c->id ? $c->toEventString() : '??'). ':' . $this->name;
     }
     
     /**
@@ -276,6 +276,9 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject
     
     function client()
     {
+        if (!$this->client_id) {
+            return false;
+        }
         $c = DB_DataObject::factory('core_company');
         $c->get($this->client_id);
         return $c;