fix #8131 - chinese translations
[Pman.Core] / DataObjects / Core_person_signup.php
index 9b3ab6f..a59f67d 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * Table Definition for Person
  */
-require_once 'DB/DataObject.php';
+class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php';
 
 class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject 
 {
@@ -28,8 +28,7 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
     public $person_id;
     public $person_table;
     
-    public $invite_id;
-    public $invite_table;
+    public $inviter_id;
  
     function convertTo($target = false)
     {
@@ -41,12 +40,7 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
         $old = clone($this);
         // this shold not really happen...
         if($target->get('email', $this->email)){
-            
-            $this->person_id = $target->id;
-            $this->person_table = $target->tableName();
-            $this->update($old);
-            
-            return $target;
+            return false;
         }
         
         $target->setFrom($this->toArray());
@@ -57,14 +51,8 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
         $this->person_table = $target->tableName();
         $this->update($old);
         
-        if(!empty($this->invite_id) && !empty($this->invite_table)){
-            $friend = DB_DataObject::factory($this->invite_table);
-            $friend->setFrom(array(
-                'person_id' => $this->invite_id,
-                'friend_id' => $target->id
-            ));
-            
-            $friend->insert();
+        if(!empty($this->inviter_id) && method_exists($target, 'createFriend')){
+            $target->createFriend($this->inviter_id);
         }
         
         return $target;
@@ -72,14 +60,13 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
     
     function sendVerification($template, $roo)
     {
-        
         $content = array(
             'template'      => $template,
             'person'        => $this,
             'serverName'    => $_SERVER['SERVER_NAME'],
             'baseURL'       => $roo->baseURL
         );
-
+        
         $sent = DB_DataObject::factory('core_email')->send($content);
         
         if(!is_object($sent)){