DataObjects/Core_person_signup.php
[Pman.Core] / DataObjects / Core_person_signup.php
index 79abe45..8280401 100644 (file)
@@ -28,8 +28,7 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
     public $person_id;
     public $person_table;
     
-    public $invite_id;
-    public $friend_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());
@@ -56,9 +50,10 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
         $this->person_id = $target->id;
         $this->person_table = $target->tableName();
         $this->update($old);
-        // ok - deleting might not be a great idea.... - as we can not track already confirmed codes..
         
-        //$this->delete();
+        if(!empty($this->inviter_id) && method_exists($target, 'createFriend')){
+            $target->createFriend($this->inviter_id);
+        }
         
         return $target;
     }