protected function gridDebterColumn($data, $row) { $debter_client = DebterClientRef::model()->find('client_id=:clientID', array(':clientID' => $data->client_id)); if ($debter_client) { $debter = DebtCollector::model()->find('id=:debterID', array(':debterID' => $debter_client->debter_id)); print_r($debter->fullname); } else { print_r('N/A'); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionAddCustomer() { $model = new Client(); if (Yii::app()->user->checkAccess('client.create')) { if (isset($_POST['Client'])) { $model->attributes = $_POST['Client']; if ($model->validate()) { if ($model->save()) { if (!empty($_POST['Client']['debter_id'])) { $debter_id = $_POST['Client']['debter_id']; $mod_debter_ref = new DebterClientRef(); $mod_debter_ref->client_id = $model->id; $mod_debter_ref->debter_id = (int) $debter_id; $mod_debter_ref->save(); } Yii::app()->clientScript->scriptMap['jquery.js'] = false; Yii::app()->shoppingCart->setCustomer($model->id); $this->redirect(array('saleItem/index')); } } } } else { throw new CHttpException(403, 'You are not authorized to perform this action'); } if (Yii::app()->request->isAjaxRequest) { Yii::app()->clientScript->scriptMap['*.js'] = false; //Yii::app()->clientScript->scriptMap['*.cs'] = false; if (Yii::app()->settings->get('system', 'touchScreen') == '1') { echo CJSON::encode(array('status' => 'render', 'div' => $this->renderPartial('_form_touchscreen', array('model' => $model), true, false))); } else { echo CJSON::encode(array('status' => 'render', 'div' => $this->renderPartial('_form', array('model' => $model), true, false))); } Yii::app()->end(); } else { $this->render('_form', array('model' => $model)); } }