public function actionWrite() { parent::actionWrite(); if (isset($_POST['Purchasingorg'])) { $messages = $this->ValidateData(array(array($_POST['Purchasingorg']['purchasingorgcode'], 'emptypurchasingorgcode', 'emptystring'), array($_POST['Purchasingorg']['description'], 'emptydescription', 'emptystring'))); if ($messages == '') { //$dataku->attributes=$_POST['Purchasingorg']; if ((int) $_POST['Purchasingorg']['purchasingorgid'] > 0) { $model = $this->loadModel($_POST['Purchasingorg']['purchasingorgid']); $model->purchasingorgcode = $_POST['Purchasingorg']['purchasingorgcode']; $model->description = $_POST['Purchasingorg']['description']; $model->recordstatus = $_POST['Purchasingorg']['recordstatus']; } else { $model = new Purchasingorg(); $model->attributes = $_POST['Purchasingorg']; } try { if ($model->save()) { $this->DeleteLock($this->menuname, $_POST['Purchasingorg']['purchasingorgid']); $this->GetSMessage('ppoinsertsuccess'); } else { $this->GetMessage($model->getErrors()); } } catch (Exception $e) { $this->GetMessage($e->getMessage()); } } } }