From 359b5ac33c239648045d55e5e4fce58b4cecd2fc Mon Sep 17 00:00:00 2001 From: david Date: Thu, 12 Jul 2012 15:31:23 +0000 Subject: [PATCH] =?UTF-8?q?-=20Resuelto=20problema=20de=20formato=20de=20f?= =?UTF-8?q?echa=20con=20el=20campo=20'fecha=20de=20nacimiento'=20de=20un?= =?UTF-8?q?=20candidato.=20-=20Arreglado=20problema=20de=20configuraci?= =?UTF-8?q?=C3=B3n=20al=20subir=20a=20producci=C3=B3n.=20-=20A=C3=B1adir?= =?UTF-8?q?=20auditor=C3=ADa=20para=20documentos=20y=20capacidades=20de=20?= =?UTF-8?q?un=20candidato.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_IntranetNueva/trunk@66 77cfc57b-8ef4-1849-9df6-4a38aa5da120 --- www/protected/config/mode_production.php | 1 + www/protected/config/mode_stage.php | 7 ++++++- www/protected/models/Candidato.php | 11 ++++++----- www/protected/models/CandidatoCapacidad.php | 6 ++++++ www/protected/models/CandidatoDocumento.php | 5 +++++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/www/protected/config/mode_production.php b/www/protected/config/mode_production.php index 6a27d56..427fd14 100644 --- a/www/protected/config/mode_production.php +++ b/www/protected/config/mode_production.php @@ -28,6 +28,7 @@ $configSpecific = array( 'connectionString' => 'mysql:host=PRODUCTION_HOST;dbname=PRODUCTION_DBNAME', 'username' => 'USERNAME', 'password' => 'PASSWORD', + 'charset'=>'utf8', ), // Application Log diff --git a/www/protected/config/mode_stage.php b/www/protected/config/mode_stage.php index ac5a571..00030ce 100644 --- a/www/protected/config/mode_stage.php +++ b/www/protected/config/mode_stage.php @@ -28,6 +28,7 @@ $configSpecific = array( 'connectionString' => 'mysql:host=maquetaweb.ws;dbname=maqueta_intranet_stage', 'username' => 'maqueta_intranet', 'password' => 'intranet', + 'charset'=>'utf8', ), // Application Log @@ -43,7 +44,11 @@ $configSpecific = array( ), ), - + + 'params'=>array( + // Ruta de los currículums de los candidatos + 'curriculumPath' => dirname(__FILE__) . '/../../public_html/intranet/documentos/', + ), ); ?> \ No newline at end of file diff --git a/www/protected/models/Candidato.php b/www/protected/models/Candidato.php index fc16abf..b0d8aac 100644 --- a/www/protected/models/Candidato.php +++ b/www/protected/models/Candidato.php @@ -13,7 +13,7 @@ * @property string $telefono_fijo * @property string $telefono_movil * @property string $sexo - * @property string $fecha_nacimiento + * @property date $fecha_nacimiento * @property string $lugar_nacimiento * @property datetime $fecha_alta * @property datetime $fecha_modificacion @@ -306,8 +306,8 @@ class Candidato extends CActiveRecord //PHP dates are displayed as dd/mm/yyyy //MYSQL dates are stored as yyyy-mm-dd if ($this->fecha_nacimiento != '') { - $unafecha = DateTime::createFromFormat('d/m/Y', $this->fecha_nacimiento); - $this->fecha_nacimiento = $unafecha->format('Y-m-d'); + $dateToMySQL=date('Y-m-d', CDateTimeParser::parse($this->fecha_nacimiento, Yii::app()->locale->dateFormat)); + $this->fecha_nacimiento = $dateToMySQL; } parent::beforeSave(); @@ -317,8 +317,9 @@ class Candidato extends CActiveRecord protected function afterFind() { //PHP dates are displayed as dd/mm/yyyy //MYSQL dates are stored as yyyy-mm-dd - $unafecha = DateTime::createFromFormat('Y-m-d', $this->fecha_nacimiento); - $this->fecha_nacimiento = $unafecha->format('d/m/Y'); + + $dateToLocale=Yii::app()->dateFormatter->formatDateTime(CDateTimeParser::parse($this->fecha_nacimiento, 'yyyy-MM-dd'),'medium',null); + $this->fecha_nacimiento = $dateToLocale; parent::afterFind(); return true; diff --git a/www/protected/models/CandidatoCapacidad.php b/www/protected/models/CandidatoCapacidad.php index 2fbc9e7..50ca72e 100644 --- a/www/protected/models/CandidatoCapacidad.php +++ b/www/protected/models/CandidatoCapacidad.php @@ -103,4 +103,10 @@ class CandidatoCapacidad extends CActiveRecord 'criteria'=>$criteria, )); } + + public function behaviors() { + return array( + 'LoggableBehavior'=> 'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } } \ No newline at end of file diff --git a/www/protected/models/CandidatoDocumento.php b/www/protected/models/CandidatoDocumento.php index 0b03217..6f63931 100644 --- a/www/protected/models/CandidatoDocumento.php +++ b/www/protected/models/CandidatoDocumento.php @@ -142,4 +142,9 @@ class CandidatoDocumento extends CActiveRecord )); } + public function behaviors() { + return array( + 'LoggableBehavior'=> 'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } } \ No newline at end of file