diff --git a/www/protected/controllers/EquipoController.php b/www/protected/controllers/EquipoController.php index a72d887..65f1e44 100644 --- a/www/protected/controllers/EquipoController.php +++ b/www/protected/controllers/EquipoController.php @@ -69,8 +69,9 @@ class EquipoController extends Controller { } public function actionDelete($id) { - $agente = Usuario::model()->equipo()->findByPk($id); - + $agente = $this->loadModel($id); + if ($agente) $agente->delete(); + // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if(!isset($_GET['ajax'])) $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index')); @@ -107,7 +108,7 @@ class EquipoController extends Controller { * @param integer the ID of the model to be loaded */ public function loadModel($id) { - $model = Usuario::model()->findByPk($id); + $model = Usuario::model()->equipo()->findByPk($id); if ($model === null) throw new CHttpException(404, Yii::t('profind', 'La página solicitada no existe.')); return $model; diff --git a/www/protected/models/Usuario.php b/www/protected/models/Usuario.php index 366f6c7..c6e3d52 100644 --- a/www/protected/models/Usuario.php +++ b/www/protected/models/Usuario.php @@ -65,12 +65,17 @@ class Usuario extends CActiveRecord { // will receive user inputs. return array( array('email, password', 'required'), + array('email, nombre, apellidos, password, tipo, titulo, localidad, telefono', 'length', 'max' => 255), + array('estado', 'length', 'max' => 1), + array('email', 'email'), array('email', 'unique'), + array('descripcion', 'safe'), + array('tipo', 'default', 'value' => self::TIPO_USUARIO_COORDINADOR), - array('email, nombre, apellidos, password, tipo, titulo, localidad, telefono', 'length', 'max' => 255), + array('ficheroFotografia', 'file', 'types' => 'jpg', 'maxSize' => 1024 * 1024 * 1, // 1MB como máximo @@ -78,6 +83,7 @@ class Usuario extends CActiveRecord { 'wrongType' => Yii::t('profind', 'Sólo se permiten imágenes en formato JPG.'), 'allowEmpty' => 'true', ), + array('id, id_empresa, estado, email, nombre, apellidos, tipo, titulo, localidad, telefono, descripcion', 'safe', 'on' => 'search'), ); } diff --git a/www/themes/profind/views/equipo/_invitacion_form.php b/www/themes/profind/views/equipo/_invitacion_form.php index 5831780..f6f67be 100644 --- a/www/themes/profind/views/equipo/_invitacion_form.php +++ b/www/themes/profind/views/equipo/_invitacion_form.php @@ -13,7 +13,6 @@