- 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',
|
'id_empresa' => 'integer',
|
||||||
'estado' => 'decimal(1,0)',
|
'estado' => 'decimal(1,0)',
|
||||||
'clave_seguridad' => 'string',
|
'clave_seguridad' => 'string',
|
||||||
'email' => 'string',
|
'email' => 'string NOT NULL',
|
||||||
'nombre' => 'string',
|
'nombre' => 'string',
|
||||||
'apellidos' => 'string',
|
'apellidos' => 'string',
|
||||||
'password' => 'string NOT NULL',
|
'password' => 'string NOT NULL',
|
||||||
'tipo' => 'string NOT NULL',
|
'tipo' => 'string NOT NULL',
|
||||||
'titulo' => 'string',
|
'titulo' => 'string',
|
||||||
'descripcion' => 'text',
|
|
||||||
'localidad' => 'string',
|
'localidad' => 'string',
|
||||||
'telefono' => 'string',
|
'telefono' => 'string',
|
||||||
|
'descripcion' => 'text',
|
||||||
'last_login_time' => 'datetime',
|
'last_login_time' => 'datetime',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@ -47,8 +47,7 @@ class Empresa extends CActiveRecord {
|
|||||||
array('pagina_web', 'url'),
|
array('pagina_web', 'url'),
|
||||||
array('email', 'email'),
|
array('email', 'email'),
|
||||||
array('descripcion', 'safe'),
|
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'),
|
array('id, cif, nombre, email, pagina_web, empleados, direccion, descripcion', 'safe', 'on' => 'search'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -70,13 +69,13 @@ class Empresa extends CActiveRecord {
|
|||||||
public function attributeLabels() {
|
public function attributeLabels() {
|
||||||
return array(
|
return array(
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
'cif' => 'Cif',
|
'cif' => 'CIF',
|
||||||
'nombre' => 'Nombre',
|
'nombre' => 'Nombre',
|
||||||
'email2' => 'Email',
|
'email2' => 'Email',
|
||||||
'pagina_web' => 'Pagina Web',
|
'pagina_web' => 'Página web',
|
||||||
'empleados' => 'Empleados',
|
'empleados' => 'Nº de empleados',
|
||||||
'direccion' => 'Direccion',
|
'direccion' => 'Dirección',
|
||||||
'descripcion' => 'Descripcion',
|
'descripcion' => 'Descripción',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,14 +89,14 @@ class Empresa extends CActiveRecord {
|
|||||||
|
|
||||||
$criteria = new CDbCriteria;
|
$criteria = new CDbCriteria;
|
||||||
|
|
||||||
$criteria->compare('t.id', $this->id);
|
$criteria->compare('id',$this->id);
|
||||||
$criteria->compare('t.cif', $this->cif, true);
|
$criteria->compare('cif',$this->cif,true);
|
||||||
$criteria->compare('t.nombre', $this->nombre, true);
|
$criteria->compare('nombre',$this->nombre,true);
|
||||||
$criteria->compare('t.email', $this->email, true);
|
$criteria->compare('email',$this->email,true);
|
||||||
$criteria->compare('t.pagina_web', $this->pagina_web, true);
|
$criteria->compare('pagina_web',$this->pagina_web,true);
|
||||||
$criteria->compare('t.empleados', $this->empleados);
|
$criteria->compare('empleados',$this->empleados);
|
||||||
$criteria->compare('t.direccion', $this->direccion, true);
|
$criteria->compare('direccion',$this->direccion,true);
|
||||||
$criteria->compare('t.descripcion', $this->descripcion, true);
|
$criteria->compare('descripcion',$this->descripcion,true);
|
||||||
|
|
||||||
return new CActiveDataProvider($this, array(
|
return new CActiveDataProvider($this, array(
|
||||||
'criteria' => $criteria,
|
'criteria' => $criteria,
|
||||||
|
|||||||
@ -13,11 +13,11 @@
|
|||||||
* @property string $password
|
* @property string $password
|
||||||
* @property string $tipo
|
* @property string $tipo
|
||||||
* @property string $titulo
|
* @property string $titulo
|
||||||
* @property text $descripcion
|
|
||||||
* @property string $localidad
|
* @property string $localidad
|
||||||
* @property string $telefono
|
* @property string $telefono
|
||||||
* @property string $last_login_time
|
* @property string $last_login_time
|
||||||
* @property string $clave_seguridad
|
* @property string $clave_seguridad
|
||||||
|
* @property string $descripcion
|
||||||
*
|
*
|
||||||
* The followings are the available model relations:
|
* The followings are the available model relations:
|
||||||
* @property Empresa $empresa
|
* @property Empresa $empresa
|
||||||
@ -54,18 +54,19 @@ class Usuario extends CActiveRecord {
|
|||||||
/**
|
/**
|
||||||
* @return array validation rules for model attributes.
|
* @return array validation rules for model attributes.
|
||||||
*/
|
*/
|
||||||
public function rules() {
|
public function rules()
|
||||||
|
{
|
||||||
// NOTE: you should only define rules for those attributes that
|
// NOTE: you should only define rules for those attributes that
|
||||||
// will receive user inputs.
|
// will receive user inputs.
|
||||||
return array(
|
return array(
|
||||||
array('email, nombre, apellidos, titulo, localidad, telefono', 'length', 'max' => 255),
|
array('email, password, tipo', 'required'),
|
||||||
array('email', 'required'),
|
array('estado', 'length', 'max'=>1),
|
||||||
array('email', 'email'),
|
array('email', 'email'),
|
||||||
array('email', 'unique'),
|
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, estado, email, nombre, apellidos, tipo, titulo, localidad, telefono, descripcion', 'safe', 'on'=>'search'),
|
||||||
|
|
||||||
array('id, id_empresa, email, nombre, apellidos, titulo, localidad, telefono', 'safe', 'on' => 'search'),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,59 +87,43 @@ class Usuario extends CActiveRecord {
|
|||||||
public function attributeLabels() {
|
public function attributeLabels() {
|
||||||
return array(
|
return array(
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
'email' => 'Email',
|
|
||||||
'estado' => 'Estado',
|
'estado' => 'Estado',
|
||||||
'password' => 'Contraseña',
|
'email' => 'Email',
|
||||||
'password_repeat' => 'Confirmar contraseña',
|
|
||||||
'last_login_time' => 'Último acceso',
|
|
||||||
'nombre' => 'Nombre',
|
'nombre' => 'Nombre',
|
||||||
'apellidos' => 'Apellidos',
|
'apellidos' => 'Apellidos',
|
||||||
'titulo' => 'Titulo',
|
'password' => 'Password',
|
||||||
|
'tipo' => 'Tipo',
|
||||||
|
'titulo' => 'Título',
|
||||||
'localidad' => 'Localidad',
|
'localidad' => 'Localidad',
|
||||||
'telefono' => 'Teléfono',
|
'telefono' => 'Teléfono',
|
||||||
'descripcion' => 'Descripción',
|
'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.
|
* 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.
|
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
|
||||||
*/
|
*/
|
||||||
public function search() {
|
public function search()
|
||||||
// Warning: Please modify the following code to remove attributes that
|
{
|
||||||
// should not be searched.
|
$criteria=new CDbCriteria;
|
||||||
|
|
||||||
$criteria = new CDbCriteria;
|
$criteria->compare('id',$this->id);
|
||||||
//$criteria->with = array('empresa');
|
$criteria->compare('id_empresa',$this->id_empresa);
|
||||||
//$criteria->together = true;
|
$criteria->compare('estado',$this->estado,true);
|
||||||
|
$criteria->compare('email',$this->email,true);
|
||||||
$criteria->compare('t.email', $this->email, true);
|
$criteria->compare('nombre',$this->nombre,true);
|
||||||
$criteria->compare('t.id_empresa', $this->id_empresa, true);
|
$criteria->compare('apellidos',$this->apellidos,true);
|
||||||
$criteria->compare('t.nombre', $this->nombre, true);
|
$criteria->compare('tipo',$this->tipo,true);
|
||||||
$criteria->compare('t.apellidos', $this->apellidos, true);
|
$criteria->compare('titulo',$this->titulo,true);
|
||||||
$criteria->compare('t.last_login_time', $this->last_login_time, true);
|
$criteria->compare('localidad',$this->localidad,true);
|
||||||
|
$criteria->compare('telefono',$this->telefono,true);
|
||||||
$sort = new CSort;
|
$criteria->compare('last_login_time',$this->last_login_time,true);
|
||||||
$sort->defaultOrder = 't.apellidos, t.nombre ASC';
|
$criteria->compare('descripcion',$this->descripcion,true);
|
||||||
|
|
||||||
return new CActiveDataProvider($this, array(
|
return new CActiveDataProvider($this, array(
|
||||||
'criteria' => $criteria,
|
'criteria'=>$criteria,
|
||||||
'sort' => $sort,
|
));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encrypt($value) {
|
public function encrypt($value) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<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="row-fluid">
|
||||||
<div class="span8">
|
<div class="span8">
|
||||||
<?php if($model->hasErrors()) { ?>
|
<?php if($model->hasErrors()) { ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user