public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = 'error'; $actionflag = 3; $stateOrgId = ''; if ($id) { $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $menumodel = new Default_Model_Menu(); $statedata = $statesmodel->getStatesDataByID($id); if (!empty($statedata)) { $stateOrgId = $statedata[0]['state_id_org']; } $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $statesmodel->deleteStateData($data, $where); if ($stateOrgId != '') { $citydata = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $citywhere = array('state=?' => $stateOrgId); $CityId = $citiesmodel->deleteCityData($citydata, $citywhere); } if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/states'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $configmail = sapp_Global::send_configuration_mail('State', $statedata[0]['state']); $messages['message'] = 'State deleted successfully'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'State cannot be deleted'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'State cannot be deleted'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }