/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Cc the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Cc::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function checkceco($attribute, $params) { //Verfiicando que exista primero $registro = Cc::model()->find("codc=:nimi", array("nimi" => trim($this->ceco))); if (is_null($registro)) { $this->adderror('ceco', 'Este colector no existe ' . $this->ceco . '-' . count($registro)); } else { if (!$registro->verificafecha($this->fechacont)) { $this->adderror('ceco', 'Este colector no es valido para la fecha indicada'); } if (!$registro->verificaesposible()) { $this->adderror('ceco', 'Este colector ya no permite imputacion, consulte con el Admimistador'); } if (!$registro->verificacentro($this->codcentro)) { $this->adderror('ceco', 'Este colector no es de este centro'); } } }
public function checkvalores1($attribute, $params) { /******************************************* + Debe de exigir el tipo de solpe + la combinacion de valores del tipo de timputacion-imputacion ***********************************************/ if ($this->tipoimputacion == 'K') { //ESTA IMPOUTADA A UN CECO $modeloceco = Cc::model()->find("codc=:codigo", array(":codigo" => trim($this->tipoimputacion))); if (is_null($modeloceco)) { $this->adderror('tipoimputacion', 'Este ceco no existe'); } } else { // SI ES LIBRE //Luego si son de otro tipo , no debe de haber material en el campo if (!is_null($this->tipoimputacion)) { $this->adderror('tipoimputacion', 'No se permite especificar el ceco en este tipo de solicitud'); } } }