/** * This action is used to delete the client details based on the client id. * */ public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = ''; $messages['flagtype'] = ''; $actionflag = 3; if ($id) { $clientsModel = new Timemanagement_Model_Clients(); $checkProjects = $clientsModel->checkProjectClients($id); if ($checkProjects == 0) { $data = array('is_active' => 0, 'modified' => gmdate("Y-m-d H:i:s")); $data['modified_by'] = $loginUserId; $where = array('id=?' => $id); $id = $clientsModel->saveOrUpdateClientsData($data, $where); if ($id == 'update') { $messages['message'] = 'Client deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Client cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Client is in use. You cannot delete the client'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Client cannot be deleted.'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }