DataObjects/Core_person_signup.php
[Pman.Core] / DataObjects / Core_person_signup.php
index fb58c66..51afc1e 100644 (file)
@@ -22,6 +22,8 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
     public $verify_key;                      // int(11)
     public $verified;
     public $created_dt;                      // datetime(19)  binary
+    public $company_name;
+    public $person_type;
 
 //    function verify($key) 
 //    {
@@ -93,11 +95,32 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
 //        }
 //    }
 
-    function sendVerification($roo)
+    function convertTo($target = false)
+    {
+        if(!$target){
+            return false;
+        }
+        
+        $roo = HTML_FlexyFramework::get()->page;
+        
+        if($target->get('email', $this->email)){
+            return $target;
+        }
+        
+        $target->setFrom($this->toArray());
+        
+        $target->insert();
+        
+        $this->delete();
+        
+        return $target;
+    }
+    
+    function sendVerification($template, $roo)
     {
         
         $content = array(
-            'template'      => 'CORE_PERSON_SIGNUP_VERIFICATION',
+            'template'      => $template,
             'person'        => $this,
             'serverName'    => $_SERVER['SERVER_NAME'],
             'baseURL'       => $roo->baseURL
@@ -111,5 +134,13 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
         
         return false;
     }
+    
+    function getEmailFrom()
+    {
+        if (empty($this->name)) {
+            return $this->email;
+        }
+        return '"' . addslashes($this->name) . '" <' . $this->email . '>';
+    }
 }