Exemplo n.º 1
0
 public function direct_approval($encrypt_key_mail, $status_id)
 {
     $this->load->model('email_model');
     $email = $this->email_model->getByEncryptKey($encrypt_key_mail);
     $pengguna = $this->session->userdata('sesi');
     if ($pengguna == null || $email->email_receiver != md5($pengguna->pengguna_id)) {
         redirect("direct_login/" . $email->email_encrypt_key . "/" . $status_id);
     } else {
         if ($pengguna->privilage_id == 4) {
             $email->email_is_executed = 0;
         }
     }
     if ($email->email_is_executed == 1) {
         echo "Permintaan telah anda proses sebelumnya";
     } else {
         $pengguna = $this->session->userdata('sesi');
         if ($pengguna == null) {
             redirect("direct_login/" . $email->email_encrypt_key . "/" . $status_id);
         } else {
             if ($pengguna->privilage_id == 4) {
                 $approval = direct_approval($email, $status_id, $pengguna->pengguna_id, FALSE);
             } else {
                 $approval = direct_approval($email, $status_id, $pengguna->pengguna_id);
             }
             if ($approval) {
                 $this->load->model('status_model');
                 $status = $this->status_model->getById($status_id);
                 if ($pengguna->privilage_id == 4) {
                     redirect("konsumsi/permintaan/" . $email->email_ref_id);
                 } else {
                     if ($status != null) {
                         view_direct_approval_mail(KONSUMSI, $status_id, $email);
                     }
                 }
             } else {
                 echo "Permintaan gagal diproses ";
             }
         }
     }
 }
Exemplo n.º 2
0
 public function direct_approval($encrypt_key_mail, $status_id)
 {
     $this->load->model('email_model');
     $this->load->model('status_model');
     $email = $this->email_model->getByEncryptKey($encrypt_key_mail);
     if ($email->email_is_executed == 1) {
         echo "Permintaan telah anda proses sebelumnya";
     } else {
         $pengguna = $this->session->userdata('sesi');
         if ($pengguna == null) {
             redirect("direct_login/" . $email->email_encrypt_key . "/" . $status_id);
         } else {
             $status = $this->status_model->getById($status_id);
             if ($status->status_tipe == DONE) {
                 redirect("kendaraan/pengajuan_approve/" . $email->email_ref_id);
             } else {
                 $approval = direct_approval($email, $status_id, $pengguna->pengguna_id);
                 if ($approval) {
                     $this->load->model('status_model');
                     $status = $this->status_model->getById($status_id);
                     if ($status != null) {
                         view_direct_approval_mail(KENDARAAN, $status_id, $email);
                         if ($status->status_tipe == DONE) {
                             $this->email_requestor($email->email_ref_id);
                         }
                     }
                 } else {
                     echo "Permintaan gagal diproses ";
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 public function direct_approval($encrypt_key_mail, $status_id)
 {
     $this->load->model('email_model');
     $email = $this->email_model->getByEncryptKey($encrypt_key_mail);
     if ($email->email_is_executed == 1) {
         echo "Permintaan telah anda proses sebelumnya";
     } else {
         $pengguna = $this->session->userdata('sesi');
         if ($pengguna == null) {
             redirect("direct_login/" . $email->email_encrypt_key . "/" . $status_id);
         } else {
             $approval = direct_approval($email, $status_id, $pengguna->pengguna_id);
             if ($approval) {
                 //jika bukan pic maka auto update status konsumsinya juga
                 if ($pengguna->privilage_id != 4) {
                     $konsumsi = $this->peminjaman_ruangan_model->getKonsumsi($email->email_ref_id);
                     if ($konsumsi != null) {
                         write_history(TABEL_KONSUMSI, $konsumsi->permintaan_konsumsi_id, $status_id, "");
                     }
                 }
                 $this->load->model('status_model');
                 $status = $this->status_model->getById($status_id);
                 if ($status != null) {
                     view_direct_approval_mail(RUANGAN, $status_id, $email);
                 }
             } else {
                 echo "Permintaan gagal diproses ";
             }
         }
     }
 }