public static function SaveFileDocument($mFile, $title, $key, $id_transaction)
 {
     $mFile->transactions_id = $id_transaction;
     $mFile->title = InputHelper::removeScriptTag($title);
     $mFile->order_no = $key;
     $mFile->file_name = CUploadedFile::getInstance($mFile, 'file_name[' . $key . ']');
     if (!is_null($mFile->file_name)) {
         $mFile->file_name = ProTransactionsPropertyDocument::saveFile($mFile, 'file_name', ProTransactionsPropertyDocument::$folderUpload, $key);
     }
     if (!empty($mFile->title)) {
         $mFile->save();
         $response['code'] = true;
         $response['message'] = 'successfully';
     }
 }
 protected function beforeValidate()
 {
     $this->house_blk_no = InputHelper::removeScriptTag($this->house_blk_no);
     $this->street_name = InputHelper::removeScriptTag($this->street_name);
     $this->postal_code = InputHelper::removeScriptTag($this->postal_code);
     $this->no_of_bedroom = InputHelper::removeScriptTag($this->no_of_bedroom);
     $this->tenure = InputHelper::removeScriptTag($this->tenure);
     $this->unit_no = InputHelper::removeScriptTag($this->unit_no);
     $this->building_name = InputHelper::removeScriptTag($this->building_name);
     $this->built_in_area = InputHelper::removeScriptTag($this->built_in_area);
     $this->land_area = InputHelper::removeScriptTag($this->land_area);
     return parent::beforeValidate();
 }
Пример #3
0
             $link = Yii::app()->createAbsoluteUrl('member/agent/view', array('tenancy' => $mTransactions->id));
             $this->redirect($link);
             // may be redirect to view
         }
     }
 }
 // Dec 01, 2014 xử lý bắt biến post và gọi validate cho các model, tách ra cho dễ nhìn
 public function GetPostAndValidateTenancy($mTransactions)
 {
     $this->GetPostOnly($mTransactions);
     $mTransactions->validate();
     $mTransactions->mPropertyDetail->validate();
     if ($mTransactions->type == ProTransactions::FOR_RENT) {
         // it alway for rent
         if (!empty($mTransactions->mTenatDefault->user_id)) {
             $mTransactions->mTenatDefault->scenario = 'AgentAddTenantExitUid';
         }
         $mTransactions->mTenatDefault->validate();
         Users::validateDefaultTenant($mTransactions->mTenatDefault);
     }
     // chưa xử lý gì phần validate này ProTransactionsPropertyDocument
     ProTransactionsPropertyDocument::validateFile($mTransactions);
     if ($mTransactions->type == ProTransactions::FOR_RENT) {
         ProTransactions::validateLandlordTenant($mTransactions);
     } else {
         // for sale - validate for vendor and purcharser
         ProTransactions::validateVendorPurchaser($mTransactions);
     }
 }
 /**
  * @Author: ANH DUNG Jan 13, 2015
  * @Todo: get attribute from post
  */
 public function GetPostOnly(&$mTransactions)
 {
     $mTransactions->attributes = $_POST['ProTransactions'];
     $mTransactions->mPropertyDetail->attributes = $_POST['ProTransactionsPropertyDetail'];
     $mTransactions->mPropertyDocument = new ProTransactionsPropertyDocument();
     $mTransactions->mPropertyDocument->attributes = $_POST['ProTransactionsPropertyDocument'];
     $mTransactions->mTenatDefault->attributes = isset($_POST['ProTransactionsVendorPurchaserDetail']) ? $_POST['ProTransactionsVendorPurchaserDetail'] : array();
     $mTransactions->mTenatDefault->scanned_employment_pass = CUploadedFile::getInstance($mTransactions->mTenatDefault, 'scanned_employment_pass');
     $mTransactions->mTenatDefault->scanned_passport = CUploadedFile::getInstance($mTransactions->mTenatDefault, 'scanned_passport');
 }
 /**
  * @Author: ANH DUNG Jan 13, 2015
  * @Todo: Handle SaveAsDraft
  */
 public function HandleSaveAsDraft($mTransactions)
 {
     if (isset($_POST['SaveAsDraft']) && $_POST['SaveAsDraft'] == 1) {
         $this->GetPostOnly($mTransactions);
         $this->HandleSaveAsDraftOnlySave($mTransactions);
         $link = Yii::app()->createAbsoluteUrl('member/agent/tenancy', array('status' => STATUS_TENANCY_DRAFT));
         $this->redirect($link);
         // may be redirect to view
     }
 }
 /**
  * @Author: ANH DUNG Jan 13, 2015
  * @Todo: Save Draft Only
  * @Param: $mTransactions
  */
 public function HandleSaveAsDraftOnlySave(&$mTransactions)
 {
     ProTransactions::convertToDbDate($mTransactions);
     $prefix_code = "T" . date('Y') . date('m');
     if (!isset($_GET['update_transactions'])) {
         $mTransactions->transactions_no = MyFormat::getNextId('ProTransactions', $prefix_code, 'transactions_no', ProTransactions::LENGTH_TRANS_NO);
     }
     $mTransactions->status = STATUS_TENANCY_DRAFT;
     $mTransactions->update();
     // update transaction
     // save  mPropertyDetail
     $mTransactions->mPropertyDetail->transactions_id = $mTransactions->id;
     $mTransactions->mPropertyDetail->listing_id = $mTransactions->listing_id;
     $mTransactions->mPropertyDetail->scenario = null;
     $mTransactions->mPropertyDetail->save();
     // save tenant
     if ($mTransactions->type == ProTransactions::FOR_RENT) {
Пример #4
0
 protected function beforeValidate()
 {
     $this->company_name = InputHelper::removeScriptTag($this->company_name);
     $this->attn_to = InputHelper::removeScriptTag($this->attn_to);
     $this->contact_no = InputHelper::removeScriptTag($this->contact_no);
     $this->billing_address = InputHelper::removeScriptTag($this->billing_address);
     $this->postal_code = InputHelper::removeScriptTag($this->postal_code);
     $this->commission_amount = (double) str_replace(",", "", $this->commission_amount);
     $this->commission_amount_gst = (double) str_replace(",", "", $this->commission_amount_gst);
     return parent::beforeValidate();
 }