public function selesai_kegiatan($id_peminjaman) { //update status peminjaman menjadi selesai, dan kendaraan kembali available $status_id = $this->input->post("btn_submit", TRUE); // value dari button submit $keterangan_wf = $this->input->post("keterangan_workflow", TRUE); // value dari textarea keterangan approval $data_update = array("status_id" => 7); $this->kendaraan_model->update($id_peminjaman, $data_update); write_history(TABEL_KENDARAAN, $id_peminjaman, $status_id, $keterangan_wf); redirect('kendaraan/rekap_pinjam/'); }
public function save() { $id = $this->input->post("permintaan_konsumsi_id", TRUE); $nip = $this->input->post("permintaan_konsumsi_nip", TRUE); $ext = $this->input->post("permintaan_konsumsi_ext", TRUE); $nama = $this->input->post("permintaan_konsumsi_nama", TRUE); $tanggal = $this->input->post("permintaan_konsumsi_tanggal", TRUE); $jam = $this->input->post("permintaan_konsumsi_jam", TRUE); $lokasi = $this->input->post("permintaan_konsumsi_lokasi", TRUE); $jumlah_peserta = $this->input->post("permintaan_konsumsi_jumlah_peserta", TRUE); $jenis_snack = $this->input->post("permintaan_konsumsi_snack_jenis", TRUE); $jenis_makansiang = $this->input->post("permintaan_konsumsi_makansiang_jenis", TRUE); $jenis_makanmalam = $this->input->post("permintaan_konsumsi_makanmalam_jenis", TRUE); $namaacara = $this->input->post("permintaan_konsumsi_namaacara", TRUE); $is_snack = $this->input->post("is_snack", TRUE); $is_makansiang = $this->input->post("is_makansiang", TRUE); $is_makanmalam = $this->input->post("is_makanmalam", TRUE); $email_pemohon = $this->input->post("permintaan_konsumsi_email_pemohon", TRUE); $snack = $is_snack == "" ? 0 : $jumlah_peserta; $makansiang = $is_makansiang == "" ? 0 : $jumlah_peserta; $makanmalam = $is_makanmalam == "" ? 0 : $jumlah_peserta; //vip $is_vip = $this->input->post("is_vip", TRUE); $jml_vip = $is_vip == "" ? 0 : $this->input->post("permintaan_konsumsi_jumlah_vip", TRUE); $ket_vip = $is_vip == "" ? "" : $this->input->post("permintaan_konsumsi_ket_vip", TRUE); $snack_jns_vip = $this->input->post("permintaan_konsumsi_snack_jenis_vip", TRUE); $is_snack_vip = $is_vip == "" ? "" : $this->input->post("is_snack_vip", TRUE); $is_makansiang_vip = $is_vip == "" ? "" : $this->input->post("is_makansiang_vip", TRUE); $is_makanmalam_vip = $is_vip == "" ? "" : $this->input->post("is_makanmalam_vip", TRUE); $snack_vip = $is_snack_vip == "" ? 0 : $jml_vip; $makansiang_vip = $is_makansiang_vip == "" ? 0 : $jml_vip; $makanmalam_vip = $is_makanmalam_vip == "" ? 0 : $jml_vip; if ($snack_vip + $makansiang_vip + $makanmalam_vip == 0) { $jml_vip = 0; } $data = array("permintaan_konsumsi_nip" => $nip, "permintaan_konsumsi_ext" => $ext, "permintaan_konsumsi_nama" => $nama, "permintaan_konsumsi_tanggal" => $tanggal, "permintaan_konsumsi_jam" => $jam, "permintaan_konsumsi_lokasi" => $lokasi, "permintaan_konsumsi_snack" => $snack, "permintaan_konsumsi_snack_jenis" => $jenis_snack, "permintaan_konsumsi_makansiang" => $makansiang, "permintaan_konsumsi_makansiang_jenis" => $jenis_makansiang, "permintaan_konsumsi_makanmalam" => $makanmalam, "permintaan_konsumsi_makanmalam_jenis" => $jenis_makanmalam, "permintaan_konsumsi_namaacara" => $namaacara, "permintaan_konsumsi_jumlah_peserta" => $jumlah_peserta, "permintaan_konsumsi_email_pemohon" => $email_pemohon, "permintaan_konsumsi_snack_jenis_vip" => $snack_jns_vip, "permintaan_konsumsi_snack_vip" => $snack_vip, "permintaan_konsumsi_makansiang_vip" => $makansiang_vip, "permintaan_konsumsi_makanmalam_vip" => $makanmalam_vip, "permintaan_konsumsi_jumlah_vip" => $jml_vip, "permintaan_konsumsi_ket_vip" => $ket_vip); // print_r($data); if ($this->session->userdata('sesi')->privilage_id == 4) { //pic isi vendor if ($is_snack != "") { $data["id_vendor_snack"] = $this->input->post("id_vendor_snack", TRUE); } if ($is_makansiang != "") { $data["id_vendor_makansiang"] = $this->input->post("id_vendor_makansiang", TRUE); } if ($is_makanmalam != "") { $data["id_vendor_makanmalam"] = $this->input->post("id_vendor_makanmalam", TRUE); } if ($is_snack_vip != "") { $data["id_vendor_snack_vip"] = $this->input->post("id_vendor_snack_vip", TRUE); } if ($is_makansiang_vip != "") { $data["id_vendor_makansiang_vip"] = $this->input->post("id_vendor_makansiang_vip", TRUE); } if ($is_makanmalam_vip != "") { $data["id_vendor_makanmalam_vip"] = $this->input->post("id_vendor_makanmalam_vip", TRUE); } } $status_id = $this->input->post("btn_submit", TRUE); // value dari button submit $keterangan_wf = $this->input->post("keterangan_workflow", TRUE); // value dari textarea keterangan approval $isdraft = $this->input->post("is_draft", TRUE); if ($id == "" || $id == 0 || $isdraft == 1) { $data["permintaan_konsumsi_snack_req"] = $snack; $data["permintaan_konsumsi_snack_jenis_req"] = $jenis_snack; $data["permintaan_konsumsi_makansiang_req"] = $makansiang; $data["permintaan_konsumsi_makansiang_jenis_req"] = $jenis_makansiang; $data["permintaan_konsumsi_makanmalam_req"] = $makanmalam; $data["permintaan_konsumsi_makanmalam_jenis_req"] = $jenis_makanmalam; } if ($id == "" || $id == 0) { //insert $data['pengguna_id'] = $this->session->userdata('sesi')->pengguna_id != null ? $this->session->userdata('sesi')->pengguna_id : null; $insert_id = $this->permintaan_konsumsi_model->insert($data); if ($insert_id != null) { $this->session->set_flashdata('tipe_konsumsi', "success"); // $save = $this->saveFile($insert_id); // if ($save) { // $this->session->set_flashdata('status_upload', "success"); // } else if ($save == FALSE) { // $this->session->set_flashdata('status_upload', "success"); // } else { // $this->session->set_flashdata('status_upload', $save); // } write_history(TABEL_KONSUMSI, $insert_id, $status_id, $keterangan_wf); } else { $this->session->set_flashdata('tipe_konsumsi', "error"); } } else { //update $row = $this->permintaan_konsumsi_model->getById($id); if ($row != null) { $filename = $row->permintaan_konsumsi_bukti; $this->permintaan_konsumsi_model->update($id, $data); //insert history workflow write_history(TABEL_KONSUMSI, $id, $status_id, $keterangan_wf); $this->session->set_flashdata('tipe_konsumsi', "success"); // $save = $this->saveFile($id); // if ($save && $filename != null) { // //jika update file maka file lama dihapus // if (file_exists('./' . $this->upload_path . "/" . $filename)) { // unlink('./' . $this->upload_path . "/" . $filename); // $this->session->set_flashdata('status_upload', "success"); // } // } else if ($save != FALSE) { // //gagal upload // $this->session->set_flashdata('status_upload', $save); // $this->session->set_flashdata('tipe_upload', "error"); // } else { // $this->session->set_flashdata('status_upload', "success"); // } } else { $this->session->set_flashdata('tipe_konsumsi', "error"); } } redirect("konsumsi/"); }
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 "; } } } }
public function aksi_permintaan() { $this->load->model("status_model"); $button = $this->input->post('btn_permintaan'); $permintaan_atk_id = $this->input->post('permintaan_atk_id'); $pengguna = $this->session->userdata('sesi'); $status_id = $this->input->post("btn_submit", TRUE); // value dari button submit $status = $this->status_model->getById($status_id); if ($status->status_tipe != DONE) { $all_barang = $this->Detail_permintaan_atk_model->getByIdPermintaan($permintaan_atk_id); foreach ($all_barang as $row) { $data_update = array('detail_permintaan_atk_diterima' => $this->input->post('diterima' . $row->detail_permintaan_atk_id)); $this->Detail_permintaan_atk_model->update($row->detail_permintaan_atk_id, $data_update); } } $keterangan_wf = $this->input->post("keterangan_workflow", TRUE); // value dari textarea keterangan approval write_history(TABEL_ATK, $permintaan_atk_id, $status_id, $keterangan_wf); redirect("atk/daftar_permintaan"); }
function direct_approval($mail, $status_id, $pengguna_id, $autoupdate = TRUE) { $execute = FALSE; $CI =& get_instance(); $CI->load->model("email_model"); if ($mail != null && $mail->email_is_executed == 0) { if ($mail->email_receiver == md5($pengguna_id)) { if ($autoupdate == TRUE) { //tambahkan wokflow history $history = write_history($mail->email_ref_table, $mail->email_ref_id, $status_id, ""); //flag bahwa email sudah di eksekusi $history = TRUE; } $data = array("email_status_id" => $status_id, "email_pengguna_id" => $pengguna_id, "email_is_executed" => 1); $CI->email_model->execute($mail->email_encrypt_key, $data); $execute = TRUE; } else { redirect("direct_login/" . $mail->email_encrypt_key . "/" . $status_id); } } return $execute; }
} elseif ($is_authenticated !== TRUE) { echo "FATAL: Autentication required prior to action calls\n"; exit(1); } elseif (is_supplement_action($action)) { $action_response = do_supplement_action(); } elseif (is_valid_action($action)) { try { $action_response = do_other_action(); } catch (Exception $e) { write_history(); raise_exception($e); } } else { echo "ERROR: Invalid action\n"; exit(3); } if ($action == "begin" or $action == "open") { if (is_array($action_response)) { $active_project = $action_response["id"]; } else { $active_project = $action_response; } $history["session"]["video_id"] = $active_project; } write_history(); if ($action_response === NULL) { echo "\nNo Response or Invalid Response. Please check your arguments."; } else { echo json_encode($action_response, JSON_PRETTY_PRINT); } echo "\n";