public function auth3_saved() { $conn = Yii::$app->db_esm; if ($this->validate()) { $transaction = $conn->beginTransaction(); try { $rtHeader_3 = Requesttermheader::find()->where(['KD_RIB' => $this->kdrib])->one(); $rtSignStt_3 = Requesttermstatus::find()->where(['KD_RIB' => $this->kdrib, 'ID_USER' => $this->getProfile()->EMP_ID])->one(); $profile = Yii::$app->getUserOpt->Profile_user(); $rtHeader_3->STATUS = $this->status; if ($rtHeader_3->STATUS == 4) { $rtHeader_3->SIG3_SVGBASE64 = ""; $rtHeader_3->SIG3_SVGBASE30 = ""; } else { $rtHeader_3->SIG3_SVGBASE64 = $profile->emp->SIGSVGBASE64; $rtHeader_3->SIG3_SVGBASE30 = $profile->emp->SIGSVGBASE30; } $rtHeader_3->SIG3_NM = $profile->emp->EMP_NM . ' ' . $profile->emp->EMP_NM_BLK; $rtHeader_3->SIG3_TGL = date('Y-m-d'); $rtHeader_3->save(); if (!$rtSignStt_3) { $rtHeaderStt_3 = new Requesttermstatus(); $rtHeaderStt_3->KD_RIB = $this->kdrib; $rtHeaderStt_3->ID_USER = $this->getProfile()->EMP_ID; if ($rtHeader_3->STATUS == 4) { $rtHeaderStt_3->STATUS = 4; } else { $rtHeaderStt_3->STATUS = 102; } $rtHeaderStt_3->UPDATED_AT = date('Y-m-d H:m:s'); } if ($this->status == 102) { $conn->createCommand()->update('t0001detail', ['STATUS' => 102], ['TERM_ID' => $this->trm_id])->execute(); $conn->createCommand()->update('t0000detail', ['STATUS' => 0], ['TERM_ID' => $this->trm_id])->execute(); } else { $conn->createCommand()->update('t0001detail', ['STATUS' => 4], ['TERM_ID' => $this->trm_id])->execute(); $conn->createCommand()->delete('t0000detail', ['STATUS' => 2, 'TERM_ID' => $this->trm_id])->execute(); } $transaction->commit(); } catch (\Exception $e) { $transaction->rollBack(); throw $e; } return $rtHeader_3; } }
public function auth2_saved() { if ($this->validate()) { $rtHeader_2 = Requesttermheader::find()->where(['KD_RIB' => $this->kdrib])->one(); #header $rtdetail = Rtdetail::find()->where(['KD_RIB' => $this->kdrib])->one(); #detail $poSignStt = Requesttermstatus::find()->where(['KD_RIB' => $this->kdrib, 'ID_USER' => $this->getProfile()->EMP_ID])->one(); $profile = Yii::$app->getUserOpt->Profile_user(); $rtHeader_2->STATUS = $this->status; $rtHeader_2->SIG2_SVGBASE64 = $profile->emp->SIGSVGBASE64; $rtHeader_2->SIG2_SVGBASE30 = $profile->emp->SIGSVGBASE30; $rtHeader_2->SIG2_NM = $profile->emp->EMP_NM . ' ' . $profile->emp->EMP_NM_BLK; $rtHeader_2->SIG2_TGL = date('Y-m-d'); if ($rtHeader_2->save()) { $rtdetail->STATUS = 101; $rtdetail->save(); if (!$poSignStt) { $rtHeader_2Stt = new Requesttermstatus(); $rtHeader_2Stt->KD_RIB = $this->kdrib; $rtHeader_2Stt->ID_USER = $this->getProfile()->EMP_ID; //$rtHeader_2Stt->TYPE $rtHeader_2Stt->STATUS = 101; $rtHeader_2Stt->UPDATED_AT = date('Y-m-d H:m:s'); if ($rtHeader_2Stt->save()) { // Notification::notify(Notification::KEY_NEW_MESSAGE, 23,Yii::$app->user->identity->id,$this->kdrib); // // $msgNotify = new MessageNotify; // $msgNotify->USER_CREATE=Yii::$app->user->identity->id; //integer // $msgNotify->USER_FROM_ID= $this->getProfile()->EMP_ID; // $msgNotify->USER_FROM= $this->getProfile()->EMP_NM; //varchar 50 // $msgNotify->USER_TO='Stephen'; //varchar 50 // $msgNotify->SUBJECT='PO'; //varchar 10 // $msgNotify->CREATE_AT=date('Y-m-d H:m:s'); //varchar 10 // $msgNotify->IMG=''; //TEXT // $msgNotify->REF = $this->kdrib; //TEXT // $msgNotify->save(); } } return $rtHeader_2; } return $rtHeader_2; } return null; }
public function auth1_saved() { if ($this->validate()) { $rtheader = Requesttermheader::find()->where(['KD_RIB' => $this->kdrib])->one(); #header $rtdetail = Rtdetail::find()->where(['KD_RIB' => $this->kdrib])->one(); #detail $rtSignStt = Requesttermstatus::find()->where(['KD_RIB' => $this->kdrib, 'ID_USER' => $this->getProfile()->EMP_ID])->one(); $rtheader->STATUS = $this->status; $rtheader->SIG1_SVGBASE64 = $this->getProfile()->SIGSVGBASE64; $rtheader->SIG1_SVGBASE30 = $this->getProfile()->SIGSVGBASE30; $rtheader->SIG1_NM = $this->getProfile()->EMP_NM . ' ' . $this->getProfile()->EMP_NM_BLK; $rtheader->SIG1_TGL = date('Y-m-d'); if ($rtheader->save()) { $rtdetail->STATUS = 100; $rtdetail->save(); if (!$rtSignStt) { $rtheaderStt = new Requesttermstatus(); $rtheaderStt->KD_RIB = $this->kdrib; $rtheaderStt->ID_USER = $this->getProfile()->EMP_ID; //$rtheaderStt->TYPE $rtheaderStt->STATUS = 100; $rtheaderStt->UPDATED_AT = date('Y-m-d H:m:s'); if ($rtheaderStt->save()) { //Notification::notify(Notification::KEY_NEW_MESSAGE, $id_Pengirim, $id_penerima(user_login),$ref_kode); // Notification::notify(Notification::KEY_NEW_MESSAGE, 25,Yii::$app->user->identity->id,$this->kdrib); // $msgNotify = new MessageNotify; // $msgNotify->USER_CREATE=Yii::$app->user->identity->id; //integer // $msgNotify->USER_FROM_ID= $this->getProfile()->EMP_ID; // $msgNotify->USER_FROM= $this->getProfile()->EMP_NM; //varchar 50 // $msgNotify->USER_TO='Melissa'; //varchar 50 // $msgNotify->SUBJECT='PO'; //varchar 10 // $msgNotify->CREATE_AT=date('Y-m-d H:m:s'); //varchar 10 // $msgNotify->IMG=''; //TEXT // $msgNotify->REF = $this->kdrib; //TEXT // $msgNotify->save(); } } return $rtheader; } return $rtheader; } return null; }