Beispiel #1
0
 public function cekalias($model)
 {
     # code...
     $data = $this->KD_CUSTOMERS;
     $datadis = $this->KD_DISTRIBUTOR;
     $kondisi = Customersalias::find()->where(['KD_CUSTOMERS' => $data, 'KD_DISTRIBUTOR' => $datadis])->one();
     if ($kondisi) {
         $this->addError($model, 'Duplicated code because the code already exists in this distributor !, attention  change name distributor or change code ');
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Customersalias::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ID' => $this->ID, 'KD_PARENT' => $this->custpnma, 'KD_CUSTOMERS' => $this->custnm, 'CREATED_AT' => $this->CREATED_AT, 'UPDATED_AT' => $this->UPDATED_AT, 'KD_DISTRIBUTOR' => $this->disnm]);
     $query->andFilterWhere(['like', 'KD_CUSTOMERS', $this->custnm])->andFilterWhere(['like', 'KD_ALIAS', $this->KD_ALIAS])->andFilterWhere(['like', 'KD_PARENT', $this->custpnma])->andFilterWhere(['like', 'KD_DISTRIBUTOR', $this->disnm])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]);
     return $dataProvider;
 }
 protected function findModelalias($id)
 {
     if (($model = Customersalias::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }