Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Simpan Data Info Tanah
- public function savedatainfotanah_post()
- {
- $username = trim($this->post('username'));
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username Kosong.',
- ];
- } elseif ($this->post('id') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'ID Permohonan Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('luas') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Luas Tanah Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('id_statustanah') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Status Tanah Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('no_sertifikat') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'No. Sertifikat Tanah Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('pemilik') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Nama Pemilik Tanah Tidak Boleh Kosong.',
- ];
- } elseif ($this->post('nop') == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'N.O.P Tidak Boleh Kosong.',
- ];
- } else {
- $id = $this->post('id');
- $checkdata = $this->db->get_where('c39_imb_bangunan', array('id_pemohon' => $id))->row();
- if (count($checkdata) > 0) {
- $data = array(
- 'luas_tanah' => $this->post('luas', 'true'),
- 'id_statustanah' => $this->post('id_statustanah', 'true'),
- 'nomor_statustanah' => trim($this->post('no_sertifikat', 'true')),
- 'pemilik_tanah' => strtoupper(trim($this->post('pemilik', 'true'))),
- 'nop' => trim($this->post('nop', 'true')),
- );
- $this->db->where('id_pemohon', $id);
- $this->db->update('c39_imb_bangunan', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Data Info Tanah Ter-Update.',
- ];
- } else {
- $data = array(
- 'id_pemohon' => $this->post('id', 'true'),
- 'luas_tanah' => $this->post('luas', 'true'),
- 'id_statustanah' => $this->post('id_statustanah', 'true'),
- 'nomor_statustanah' => trim($this->post('no_sertifikat', 'true')),
- 'pemilik_tanah' => strtoupper(trim($this->post('pemilik', 'true'))),
- 'nop' => trim($this->post('nop', 'true')),
- );
- $this->db->insert('c39_imb_bangunan', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Data Info Tanah Tersimpan.',
- ];
- }
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement