/** * @Author: ANH DUNG Dec 10, 2014 * @Todo: get list transaction for seach */ public static function GetListTransactionIdSearch($property_name_or_address) { $criteria = new CDbCriteria(); $criteria->compare(" t.property_name_or_address", $property_name_or_address, true); $criteria->with = array('rTransaction'); $criteria->compare(" rTransaction.user_id", Yii::app()->user->id); $criteria->together = true; $models = ProTransactionsPropertyDetail::model()->findAll($criteria); return CHtml::listData($models, "transactions_id", "transactions_id"); }
* @Author: ANH DUNG Apr 24, 2014 * @Todo: search autocomplete landlord and tenant at FE create new transaction */ public function actionSearchLandlordTenant() { if (!isset($_GET['term']) || !Yii::app()->request->isAjaxRequest) { throw new CHttpException(404, "Invalid request"); } $role = ROLE_LANDLORD; $aCheck = array(ROLE_LANDLORD, ROLE_TENANT); if (isset($_GET['role']) && in_array($_GET['role'], $aCheck)) { $role = $_GET['role']; } $criteria = new CDbCriteria(); $criteria->compare(" t.role_id", $role); $criteria->addSearchCondition('CONCAT(t.first_name, " " ,t.last_name, " " ,t.nric_passportno_roc)', $_GET['term'], true); // true ==> LIKE '%...%' $criteria->limit = 30; $models = Users::model()->findAll($criteria); $returnVal = array(); $cmsFormat = new CmsFormatter(); foreach ($models as $model) { $label = $cmsFormat->formatFullNameRegisteredUsers($model); $returnVal[] = array('label' => $label, 'value' => $label, 'id' => $model->id, 'row_class_id' => "row_class_id{$model->id}", 'full_name' => $label, 'email' => $model->email_not_login, 'nric_passportno_roc' => $model->nric_passportno_roc, 'contact_no' => $model->contact_no, 'address' => $model->address, 'postal_code' => $model->postal_code, 'id_type' => $model->id_type, 'pass_expiry_date' => $cmsFormat->formatDatePickerInput($model->pass_expiry_date), 'upload_employment_pass_passport' => $model->upload_employment_pass_passport, 'scanned_passport' => $model->scanned_passport, 'postal_code' => $model->postal_code); } echo CJSON::encode($returnVal); Yii::app()->end(); } /** * @Author: ANH DUNG Apr 24, 2014 * @Todo: search autocomplete landlord and tenant at FE create new transaction
public function beforeDelete() { $mDel = ProTransactionsBillTo::model()->findAll('transactions_id =' . $this->id); self::deleteArrModel($mDel); $mDel = ProTransactionsInternalCoBroke::model()->findAll('transactions_id =' . $this->id); self::deleteArrModel($mDel); $mDel = ProTransactionsPropertyDetail::model()->findAll('transactions_id =' . $this->id); self::deleteArrModel($mDel); $mDel = ProTransactionsPropertyDocument::model()->findAll('transactions_id =' . $this->id); self::deleteArrModel($mDel); $mDel = ProTransactionsVendorPurchaserDetail::model()->findAll('transactions_id =' . $this->id); self::deleteArrModel($mDel); $mDel = ProTransactionsSaveCommission::model()->findAll('transactions_id =' . $this->id); self::deleteArrModel($mDel); $mDel = ProTransactionsInvoice::model()->findAll('transactions_id =' . $this->id); self::deleteArrModel($mDel); return parent::beforeDelete(); }