public function getGeneraSubscription() { $lastGenera = $this->getFullRecords(); if (count($lastGenera) <= 0) { $genera = new LbGenera(); $genera->lb_genera_currency_symbol = ""; $genera->save(); $lastGenera = $this->getFullRecords(); } $generaID = $lastGenera[0]->lb_record_primary_key; $dataProvider = LbGenera::model()->findByPk($generaID); return $dataProvider; }
public function actionajaxQuickCreateCurrency() { $invoice_id = isset($_REQUEST['invoice_id']) ? $_REQUEST['invoice_id'] : ''; // $model = LbInvoice::model()->findByPk($invoice_id); $model = $this->loadModel($invoice_id); $GeneraModel = new LbGenera(); if (isset($_POST['LbGenera'])) { $GeneraModel->attributes = $_POST['LbGenera']; if ($GeneraModel->save()) { $model->lb_invoice_currency = $GeneraModel->lb_record_primary_key; $model->save(); } LBApplication::renderPlain($this, array('content' => CJSON::encode($GeneraModel))); return true; } LBApplication::renderPartial($this, '_form_currency', array('model' => $model, 'GeneraModel' => $GeneraModel)); }