public $created_dt; // datetime(19) binary
public $company_name;
public $person_type;
-
-// function verify($key)
-// {
-// // if key matches verify_key
-// // copy into person or other entity...
-// // and delete....
-// if ($this->get("verify_key", $key)) {
-// $p = DB_DataObject::factory('person');
-// $p->setFrom(array(
-// 'honor' => $this->honor,
-// 'name' => $this->name,
-// 'email' => $this->email,
-// 'firstname' => $this->firstname,
-// 'lastname' => $this->lastname,
-// 'firstname_alt' => $this->firstname_alt,
-// 'lastname_alt' => $this->lastname_alt));
-//
-// if ($p->insert()) {
-//
-// $temp_pwd = $p->generatePassword();
-//
-// $this->delete();
-//
-// //login
-// @session_start();
-//
-// $_SESSION['Hydra']['authUser'] = $p ? serialize($p) : false;
-//
-// //mail pwd
-// $c = DB_DataObject::factory('core_email');
-// if (!$c->get('name', 'CORE_PERSON_SIGNUP_CONGRATULATION')) {
-// $this->jerr("can not find template");
-// }
-// $ret = $c->send(array(
-// 'rcpts' => $this->email,
-// 'honor' => $this->honor . ". " . $this->lastname,
-// 'password' => $temp_pwd
-// ), true);
-//
-// if (is_object($ret)) {
-// return false;
-// }
-// return true;
-// } else {
-// return false;
-// }
-// }
-// return false;
-// }
-//
-// function convertTo($table)
-// {
-// $t = DB_DataObject::factory($table);
-// $ret = $t->get('email', $this->email);
-// if ($ret != 0) {
-// return false;
-// } else {
-// $t->setFrom(array(
-// 'honor' => $this->honor,
-// 'name' => $this->name,
-// 'email' => $this->email,
-// 'firstname' => $this->firstname,
-// 'lastname' => $this->lastname,
-// 'firstname_alt' => $this->firstname_alt,
-// 'lastname_alt' => $this->lastname_alt));
-//
-// $t->insert();
-// return true;
-// }
-// }
-
- function verified()
+
+ public $person_id;
+ public $person_table;
+
+ public $invite_id;
+ public $invite_table;
+
+ function convertTo($target = false)
{
- $hydra_person = DB_DataObject::factory('hydra_person');
+ if(!$target){
+ return false;
+ }
- if($hydra_person->get('email', $this->email)){
- return $hydra_person;
+ $roo = HTML_FlexyFramework::get()->page;
+ $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;
}
- $hydra_person->setFrom($this->toArray());
- $hydra_person->employer_name = $this->company_name;
+ $target->setFrom($this->toArray());
+
+ $target->insert();
- $hydra_person->insert();
+ $this->person_id = $target->id;
+ $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();
+ }
- return $hydra_person;
+ return $target;
}
function sendVerification($template, $roo)
return true;
}
- return false;
+ return $sent;
}
function getEmailFrom()