protected function useridOnValidate($field_name) { $u = QdUser::GET($this->{$field_name}); $c = new QdUserPersonalization(); $c->SETRANGE('userid', $this->{$field_name}); $c = $c->GETLIST(); $c = empty($c) ? null : $c[0]; if ($u == null) { $this->pushValidateError($field_name, $field_name . ' không tồn tại trong QdUser', 'error'); } else { if ($this->is_new_record() && $c != null || $c != null && $c->id != $this->id) { $this->pushValidateError('userid', 'UserID đã tồn tại trong bảng', 'error'); return false; } $this->username = $u->username; $this->pushValidateError('username', 'UserName tự động gán từ QdUser', 'info'); } }
public static function getLanguage() { if (static::$language == null) { //check user personalization first $username = Qdmvc_Helper::getCurrentUserName(); if ($username != null) { $tmp = new QdUserPersonalization(); $tmp->SETRANGE('username', $username); $tmp->SETRANGE('active', true); $tmp = $tmp->GETLIST(); if (!Qdmvc_Helper::isNullOrEmpty($tmp)) { if ($tmp[0]->language != '') { static::$language = $tmp[0]->language; return static::$language; } } } //check in general setup $tmp = QdSetup::GET(); static::$language = $tmp->df_language; } return static::$language; }