public function getObservation() { $observationOrder = ObservationOrder::model()->find('order_id=' . $this->order_id); return $observationOrder->observation; }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = new OutOrder(); $modelOb = new ObservationOrder(); //$modelOb = ObservationOrder::model()->findByPK($id); $model = $this->loadModel($id); $modelOb = ObservationOrder::model()->find('order_id=' . $model->order_id); //$model->separate($model->date_hour); //echo var_dump($imprimir); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['OutOrder'])) { $model->attributes = $_POST['OutOrder']; $modelOb->attributes = $_POST['ObservationOrder']; //$model->date_hour = $model->_date." ".$model->_hour; //$model->date_hour_print = date('Y-m-d H:i:s'); if ($model->save() && $modelOb->save()) { $log = new BlogOrder(); $log->order_id = $model->order->id; $log->activity = "Se modificó la órden en la salida con ID: " . $model->order->id; $log->detailed_activity = $this->renderPartial('view', array('model' => $model), true); $log->user_technical_id = Yii::app()->user->id; $log->date_hour = date('Y-m-d H:i:s'); $log->save(); $this->redirect(array('view', 'id' => $model->id)); } } $this->render('update', array('model' => $model, 'modelOb' => $modelOb)); }