コード例 #1
0
ファイル: Auth4Model.php プロジェクト: adem-team/advanced
 public function auth4_saved()
 {
     if ($this->validate()) {
         $roHeader = Purchaseorder::find()->where(['KD_PO' => $this->kdpo])->one();
         $poSignStt = Statuspo::find()->where(['KD_PO' => $this->kdpo, 'ID_USER' => $this->getProfile()->EMP_ID])->one();
         $profile = Yii::$app->getUserOpt->Profile_user();
         $roHeader->STATUS = $this->status;
         $roHeader->SIG4_SVGBASE64 = $profile->emp->SIGSVGBASE64;
         $roHeader->SIG4_SVGBASE30 = $profile->emp->SIGSVGBASE30;
         $roHeader->SIG4_NM = $profile->emp->EMP_NM . ' ' . $profile->emp->EMP_NM_BLK;
         $roHeader->SIG4_TGL = date('Y-m-d');
         if ($roHeader->save()) {
             if (!$poSignStt) {
                 $poHeaderStt = new Statuspo();
                 $poHeaderStt->KD_PO = $this->kdpo;
                 $poHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                 //$poHeaderStt->TYPE
                 $poHeaderStt->STATUS = 101;
                 $poHeaderStt->UPDATE_AT = date('Y-m-d H:m:s');
                 if ($poHeaderStt->save()) {
                     Notification::notify(Notification::KEY_NEW_MESSAGE, 23, Yii::$app->user->identity->id, $this->kdpo);
                     $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 -> catatan multi name user permission purchasing sign3 harus di revisi
                     $msgNotify->USER_TO_ID = 'LG.2016.000001';
                     //catatan multi name EMP_ID permission purchasing sign3 harus di revisi
                     $msgNotify->SUBJECT = 'PO';
                     //varchar 10
                     $msgNotify->CREATE_AT = date('Y-m-d H:m:s');
                     //varchar 10
                     $msgNotify->IMG = '';
                     //TEXT
                     $msgNotify->REF = $this->kdpo;
                     //TEXT
                     $msgNotify->save();
                 }
             }
             return $roHeader;
         }
         return $roHeader;
     }
     return null;
 }
コード例 #2
0
ファイル: Auth1Model.php プロジェクト: adem-team/advanced
 public function auth1_saved()
 {
     if ($this->validate()) {
         $poHeader = Purchaseorder::find()->where(['KD_PO' => $this->kdpo])->one();
         $poSignStt = Statuspo::find()->where(['KD_PO' => $this->kdpo, 'ID_USER' => $this->getProfile()->EMP_ID])->one();
         $poHeader->STATUS = $this->status;
         $poHeader->SIG1_SVGBASE64 = $this->getProfile()->SIGSVGBASE64;
         $poHeader->SIG1_SVGBASE30 = $this->getProfile()->SIGSVGBASE30;
         $poHeader->SIG1_NM = $this->getProfile()->EMP_NM . ' ' . $this->getProfile()->EMP_NM_BLK;
         $poHeader->SIG1_TGL = date('Y-m-d');
         if ($poHeader->save()) {
             if (!$poSignStt) {
                 $poHeaderStt = new Statuspo();
                 $poHeaderStt->KD_PO = $this->kdpo;
                 $poHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                 //$poHeaderStt->TYPE
                 $poHeaderStt->STATUS = 100;
                 $poHeaderStt->UPDATE_AT = date('Y-m-d H:m:s');
                 if ($poHeaderStt->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->kdpo);
                     $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 catatan multi name user permission purchasing sign3 harus di revisi
                     $msgNotify->USER_TO_ID = 'LG.2016.000010';
                     // catatan multi name EMP_ID permission purchasing sign3 harus di revisi
                     $msgNotify->SUBJECT = 'PO';
                     //varchar 10
                     $msgNotify->CREATE_AT = date('Y-m-d H:m:s');
                     //varchar 10
                     $msgNotify->IMG = '';
                     //TEXT
                     $msgNotify->REF = $this->kdpo;
                     //TEXT
                     $msgNotify->save();
                 }
             }
             return $poHeader;
         }
         return $poHeader;
     }
     return null;
 }