public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = ''; $count = 0; $actionflag = 3; if ($id) { $servicedeskrequestmodel = new Default_Model_Servicedeskrequest(); $servicedeskconfmodel = new Default_Model_Servicedeskconf(); $menumodel = new Default_Model_Menu(); $pendingRequestdata = $servicedeskconfmodel->getServiceReqDeptCount($id, 2); if (!empty($pendingRequestdata)) { $count = $pendingRequestdata[0]['count']; } if ($count < 1) { $servicedeskrequestdata = $servicedeskrequestmodel->getServiceDeskRequestbyID($id); $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $servicedeskrequestmodel->SaveorUpdateServiceDeskRequestData($data, $where); if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/servicedeskrequest'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $configmail = sapp_Global::send_configuration_mail('Request type', $servicedeskrequestdata[0]['service_request_name']); $messages['message'] = 'Request type deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Request type cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Request type cannot be deleted as requests are in pending state.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Request type cannot be deleted.'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }
public function getrequestsAction() { $service_desk_id = $this->_getParam('service_desk_id', null); $service_desk_conf_id = $this->_getParam('service_desk_conf_id', null); $data = array(); $options = sapp_Global::selectOptionBuilder('', 'Select request', ''); if ($service_desk_id != '') { $sd_dept_model = new Default_Model_Servicedeskdepartment(); $data = $sd_dept_model->getRequestsById($service_desk_id); if (count($data) > 0) { foreach ($data as $opt) { $options .= sapp_Global::selectOptionBuilder($opt['id'], utf8_encode($opt['service_request_name']), ''); } } } $attachment = false; if ($service_desk_conf_id != '') { $sd_conf_model = new Default_Model_Servicedeskconf(); $sd_conf_data = $sd_conf_model->getServiceDeskConfbyID($service_desk_conf_id); if (count($sd_conf_data) > 0) { if ($sd_conf_data[0]['attachment'] == 1) { $attachment = true; } } } $this->_helper->json(array('options' => $options, 'datacount' => count($data), 'attachment' => $attachment)); }
public function getbunitimplementationAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('getbunitimplementation', 'json')->initContext(); $businessunitsmodel = new Default_Model_Businessunits(); $servicedeskconfmodel = new Default_Model_Servicedeskconf(); $bunitid = $this->_request->getParam('bunitid'); $result = array(); if ($bunitid != '') { $pendingRequestdata = $servicedeskconfmodel->getPendingServiceReqData($bunitid); if (!empty($pendingRequestdata)) { $result['count'] = $pendingRequestdata[0]['count']; } $implementationdata = $businessunitsmodel->getSingleUnitData($bunitid); if (!empty($implementationdata)) { $result['result'] = $implementationdata['service_desk_flag']; } } $this->_helper->_json($result); }