diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index 8eac6932..2ff16099 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -110,14 +110,17 @@ class ThzController extends BaseController ->where('thz_master.thz_id', $thz_id) ->findAll(); - $notes = $this->thzMasterNotesModel->ticketConversationList($thz_id); - $result['notes'] = !empty($notes) ? $notes : []; - + if(!empty($result['master'])){ + $notes = $this->thzMasterNotesModel->ticketConversationList($thz_id); + $result['notes'] = !empty($notes) ? $notes : []; + }else{ + return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(400); + } }else{ return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404); } - return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(400); + return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200); }