db_onedev = $this->load->database("onedev", true); } public function getdata() { try { //# cek token valid if (! $this->isLogin) { $this->sys_error("Invalid Token"); exit; } $sql = "select * from conf_on_hold where ConfOnHoldIsActive = 'Y' LIMIT 1"; $rows = $this->db_onedev->query($sql)->row_array(); //echo $this->db_onedev->last_query(); if (!$rows) { $this->sys_error_db("emailconfig select"); exit; } $result = array ("total" => count($rows),"records" => $rows); $this->sys_ok($result); } catch(Exception $exc) { $message = $exc->getMessage(); $this->sys_error($message); } } public function save() { try { //# cek token valid if (! $this->isLogin) { $this->sys_error("Invalid Token"); exit; } //# ambil parameter input $prm = $this->sys_input; //print_r($prm); $sql = "update conf_on_hold SET ConfOnHoldSenderEmail = ?, ConfOnHoldSenderPassword = ?, ConfOnHoldSenderName = ?, ConfOnHoldSenderTitle = ?, ConfOnHoldSenderTitleEng = ?, ConfOnHoldTemplateHtml = ?, ConfOnHoldTemplateHtml02 = ?, ConfOnHoldTemplateHtml03 = ?, ConfOnHoldServer = ?, ConfOnHoldCc = ?, ConfOnHoldFinanceMgrReport = ? where ConfOnHoldID = ? "; $query = $this->db_onedev->query($sql,array( $prm['ConfOnHoldSenderEmail'], $prm['ConfOnHoldSenderPassword'], $prm['ConfOnHoldSenderName'], $prm['ConfOnHoldSenderTitle'], $prm['ConfOnHoldSenderTitleEng'], $prm['ConfOnHoldTemplateHtml'], $prm['ConfOnHoldTemplateHtml02'], $prm['ConfOnHoldTemplateHtml03'], $prm['ConfOnHoldServer'], $prm['ConfOnHoldCc'], $prm['ConfOnHoldFinanceMgrReport'], $prm['ConfOnHoldID'])); if (!$query) { echo $this->db_onedev->last_query(); $this->sys_error_db("email config update"); exit; } $result = array ("total" => 1, "records" => array()); $this->sys_ok($result); } catch(Exception $exc) { $message = $exc->getMessage(); $this->sys_error($message); } } }