public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = ''; $actionflag = 3; $countryOrgId = ''; if ($id) { $countriesmodel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $countrydata = $countriesmodel->getCountriesDataByID($id); if (!empty($countrydata)) { $countryOrgId = $countrydata[0]['country_id_org']; } $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $countriesmodel->SaveorUpdateCountryData($data, $where); if ($countryOrgId != '') { $statesandcitydata = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $statesandcitywhere = array('countryid=?' => $countryOrgId); $StateId = $statesmodel->deleteStateData($statesandcitydata, $statesandcitywhere); $CityId = $citiesmodel->deleteCityData($statesandcitydata, $statesandcitywhere); } if ($Id == 'update') { $menuID = COUNTRIES; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $configmail = sapp_Global::send_configuration_mail('Country', $countrydata[0]['country']); $messages['message'] = 'Country deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Country cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Country cannot be deleted.'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }