- Tarea #1098 -> En usuarios, el campo descripción no se almacena
- Tarea #1083 -> Cambiar el item del menú superior 'Perfil' por 'Perfil del Agente' - Revisión del código de los modelos de Usuario y Empresa git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@16 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d
This commit is contained in:
parent
4abda15438
commit
0acc42d745
@ -9,15 +9,15 @@ class m120905_184758_tbl_usuarios extends CDbMigration
|
||||
'id_empresa' => 'integer',
|
||||
'estado' => 'decimal(1,0)',
|
||||
'clave_seguridad' => 'string',
|
||||
'email' => 'string',
|
||||
'email' => 'string NOT NULL',
|
||||
'nombre' => 'string',
|
||||
'apellidos' => 'string',
|
||||
'password' => 'string NOT NULL',
|
||||
'tipo' => 'string NOT NULL',
|
||||
'titulo' => 'string',
|
||||
'descripcion' => 'text',
|
||||
'localidad' => 'string',
|
||||
'telefono' => 'string',
|
||||
'descripcion' => 'text',
|
||||
'last_login_time' => 'datetime',
|
||||
));
|
||||
|
||||
|
||||
@ -47,8 +47,7 @@ class Empresa extends CActiveRecord {
|
||||
array('pagina_web', 'url'),
|
||||
array('email', 'email'),
|
||||
array('descripcion', 'safe'),
|
||||
// The following rule is used by search().
|
||||
// Please remove those attributes that should not be searched.
|
||||
|
||||
array('id, cif, nombre, email, pagina_web, empleados, direccion, descripcion', 'safe', 'on' => 'search'),
|
||||
);
|
||||
}
|
||||
@ -70,13 +69,13 @@ class Empresa extends CActiveRecord {
|
||||
public function attributeLabels() {
|
||||
return array(
|
||||
'id' => 'ID',
|
||||
'cif' => 'Cif',
|
||||
'cif' => 'CIF',
|
||||
'nombre' => 'Nombre',
|
||||
'email2' => 'Email',
|
||||
'pagina_web' => 'Pagina Web',
|
||||
'empleados' => 'Empleados',
|
||||
'direccion' => 'Direccion',
|
||||
'descripcion' => 'Descripcion',
|
||||
'pagina_web' => 'Página web',
|
||||
'empleados' => 'Nº de empleados',
|
||||
'direccion' => 'Dirección',
|
||||
'descripcion' => 'Descripción',
|
||||
);
|
||||
}
|
||||
|
||||
@ -90,15 +89,15 @@ class Empresa extends CActiveRecord {
|
||||
|
||||
$criteria = new CDbCriteria;
|
||||
|
||||
$criteria->compare('t.id', $this->id);
|
||||
$criteria->compare('t.cif', $this->cif, true);
|
||||
$criteria->compare('t.nombre', $this->nombre, true);
|
||||
$criteria->compare('t.email', $this->email, true);
|
||||
$criteria->compare('t.pagina_web', $this->pagina_web, true);
|
||||
$criteria->compare('t.empleados', $this->empleados);
|
||||
$criteria->compare('t.direccion', $this->direccion, true);
|
||||
$criteria->compare('t.descripcion', $this->descripcion, true);
|
||||
|
||||
$criteria->compare('id',$this->id);
|
||||
$criteria->compare('cif',$this->cif,true);
|
||||
$criteria->compare('nombre',$this->nombre,true);
|
||||
$criteria->compare('email',$this->email,true);
|
||||
$criteria->compare('pagina_web',$this->pagina_web,true);
|
||||
$criteria->compare('empleados',$this->empleados);
|
||||
$criteria->compare('direccion',$this->direccion,true);
|
||||
$criteria->compare('descripcion',$this->descripcion,true);
|
||||
|
||||
return new CActiveDataProvider($this, array(
|
||||
'criteria' => $criteria,
|
||||
));
|
||||
|
||||
@ -13,11 +13,11 @@
|
||||
* @property string $password
|
||||
* @property string $tipo
|
||||
* @property string $titulo
|
||||
* @property text $descripcion
|
||||
* @property string $localidad
|
||||
* @property string $telefono
|
||||
* @property string $last_login_time
|
||||
* @property string $clave_seguridad
|
||||
* @property string $descripcion
|
||||
*
|
||||
* The followings are the available model relations:
|
||||
* @property Empresa $empresa
|
||||
@ -54,21 +54,22 @@ class Usuario extends CActiveRecord {
|
||||
/**
|
||||
* @return array validation rules for model attributes.
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
// NOTE: you should only define rules for those attributes that
|
||||
// will receive user inputs.
|
||||
return array(
|
||||
array('email, nombre, apellidos, titulo, localidad, telefono', 'length', 'max' => 255),
|
||||
array('email', 'required'),
|
||||
array('email, password, tipo', 'required'),
|
||||
array('estado', 'length', 'max'=>1),
|
||||
array('email', 'email'),
|
||||
array('email', 'unique'),
|
||||
array('descripcion', 'safe'),
|
||||
array('email, nombre, apellidos, password, tipo, titulo, localidad, telefono', 'length', 'max'=>255),
|
||||
|
||||
array('password', 'required', 'on' => 'insert'),
|
||||
|
||||
array('id, id_empresa, email, nombre, apellidos, titulo, localidad, telefono', 'safe', 'on' => 'search'),
|
||||
array('id, id_empresa, estado, email, nombre, apellidos, tipo, titulo, localidad, telefono, descripcion', 'safe', 'on'=>'search'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array relational rules.
|
||||
*/
|
||||
@ -86,61 +87,45 @@ class Usuario extends CActiveRecord {
|
||||
public function attributeLabels() {
|
||||
return array(
|
||||
'id' => 'ID',
|
||||
'email' => 'Email',
|
||||
'estado' => 'Estado',
|
||||
'password' => 'Contraseña',
|
||||
'password_repeat' => 'Confirmar contraseña',
|
||||
'last_login_time' => 'Último acceso',
|
||||
'email' => 'Email',
|
||||
'nombre' => 'Nombre',
|
||||
'apellidos' => 'Apellidos',
|
||||
'titulo' => 'Titulo',
|
||||
'password' => 'Password',
|
||||
'tipo' => 'Tipo',
|
||||
'titulo' => 'Título',
|
||||
'localidad' => 'Localidad',
|
||||
'telefono' => 'Teléfono',
|
||||
'descripcion' => 'Descripción',
|
||||
);
|
||||
}
|
||||
|
||||
public function scopes() {
|
||||
return array(
|
||||
'activo' => array(
|
||||
'condition' => 'estado=' . self::ESTADO_ACTIVO
|
||||
),
|
||||
'noactivo' => array(
|
||||
'condition' => 'estado=' . self::ESTADO_NOACTIVO
|
||||
),
|
||||
'denegado' => array(
|
||||
'condition' => 'estado=' . self::ESTADO_DENEGADO
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of models based on the current search/filter conditions.
|
||||
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
|
||||
*/
|
||||
public function search() {
|
||||
// Warning: Please modify the following code to remove attributes that
|
||||
// should not be searched.
|
||||
public function search()
|
||||
{
|
||||
$criteria=new CDbCriteria;
|
||||
|
||||
$criteria = new CDbCriteria;
|
||||
//$criteria->with = array('empresa');
|
||||
//$criteria->together = true;
|
||||
|
||||
$criteria->compare('t.email', $this->email, true);
|
||||
$criteria->compare('t.id_empresa', $this->id_empresa, true);
|
||||
$criteria->compare('t.nombre', $this->nombre, true);
|
||||
$criteria->compare('t.apellidos', $this->apellidos, true);
|
||||
$criteria->compare('t.last_login_time', $this->last_login_time, true);
|
||||
|
||||
$sort = new CSort;
|
||||
$sort->defaultOrder = 't.apellidos, t.nombre ASC';
|
||||
$criteria->compare('id',$this->id);
|
||||
$criteria->compare('id_empresa',$this->id_empresa);
|
||||
$criteria->compare('estado',$this->estado,true);
|
||||
$criteria->compare('email',$this->email,true);
|
||||
$criteria->compare('nombre',$this->nombre,true);
|
||||
$criteria->compare('apellidos',$this->apellidos,true);
|
||||
$criteria->compare('tipo',$this->tipo,true);
|
||||
$criteria->compare('titulo',$this->titulo,true);
|
||||
$criteria->compare('localidad',$this->localidad,true);
|
||||
$criteria->compare('telefono',$this->telefono,true);
|
||||
$criteria->compare('last_login_time',$this->last_login_time,true);
|
||||
$criteria->compare('descripcion',$this->descripcion,true);
|
||||
|
||||
return new CActiveDataProvider($this, array(
|
||||
'criteria' => $criteria,
|
||||
'sort' => $sort,
|
||||
));
|
||||
'criteria'=>$criteria,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function encrypt($value) {
|
||||
return md5($value);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<h3 class="heading"><?php echo Yii::t('profind', 'Perfil'); ?></h3>
|
||||
<h3 class="heading"><?php echo Yii::t('profind', 'Perfil del agente'); ?></h3>
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
<?php if($model->hasErrors()) { ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user