Example #1
0
 /**
  * Validate data
  *
  * @return     boolean False if invalid data, true on success
  */
 public function check()
 {
     if (!$this->user_id) {
         $this->user_id = \User::get('id');
     }
     if (!$this->id) {
         $test = new self($this->_db);
         $test->loadByUser($this->user_id);
         if ($test->id) {
             $this->setError(\Lang::txt('User with ID of %s already has a record.', $this->user_id));
         }
     }
     if ($this->getError()) {
         return false;
     }
     return true;
 }