/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new ProveedoresEntesOrganos(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ProveedoresEntesOrganos'])) { $model->attributes = $_POST['ProveedoresEntesOrganos']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Facturas(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Facturas'])) { $model->attributes = $_POST['Facturas']; $model->proveedor_id = $_POST['proveedor_id']; $model->cierre_carga = false; $usuario = Usuarios::model()->findByPk(Yii::app()->user->getId()); $model->ente_organo_id = $usuario->ente_organo_id; $model->anho = Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho']; //date("Y"); if ($model->save()) { $proveedores_eo = new ProveedoresEntesOrganos(); $proveedores_eo->proveedor_id = $model->proveedor_id; $proveedores_eo->ente_organo_id = $model->ente_organo_id; $proveedores_eo->save(); $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }