Beispiel #1
0
 public function validalias($model)
 {
     # code...
     $kondisiTrue = Barangalias::find()->where("KD_ALIAS='" . $this->KD_ALIAS . "' AND KD_DISTRIBUTOR='" . $this->KD_DISTRIBUTOR . "'")->one();
     if ($kondisiTrue) {
         $this->addError($model, 'Duplicated code because the code already exists in this distributor !, attention Better change name distributor or change code ');
     }
 }
Beispiel #2
0
 public function alias_barang_save()
 {
     //if ($this->validate()) {
     $rcBarangalias = new Barangalias();
     //print_r($this->distributor());
     //die();
     //print_r($rcBarangalias->getErrors());
     //die();
     //if ($this->validate()) {
     $rcBarangalias->KD_BARANG = $this->kD_BARANG;
     $rcBarangalias->KD_ALIAS = $this->kD_BARANG_ALIAS;
     //$rcBarangalias->KD_PARENT = '1';
     $rcBarangalias->KD_DISTRIBUTOR = $this->kD_REF;
     $rcBarangalias->CREATED_AT = date('Y-m-d');
     $rcBarangalias->CREATED_BY = $username = Yii::$app->user->identity->username;
     $rcBarangalias->save();
     // print_r($rcBarangalias->save());
     // die();
     return $rcBarangalias;
     //}
     //return null;
     //}
 }