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));
 }
예제 #2
0
 public function savecategoryAction()
 {
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('savecategory', 'json')->initContext();
     $this->_helper->layout->disableLayout();
     $auth = Zend_Auth::getInstance();
     $date = new Zend_Date();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $result['result'] = '';
     $result['id'] = '';
     $result['service_desk_name'] = '';
     $result['description'] = '';
     $servicedeskdepartmentmodel = new Default_Model_Servicedeskdepartment();
     try {
         $service_desk_name = trim($this->_request->getParam('category'));
         $description = $this->_request->getParam('description');
         $isCategoryExist = $servicedeskdepartmentmodel->checkDuplicateCategoryName($service_desk_name);
         if (!empty($isCategoryExist)) {
             if ($isCategoryExist[0]['count'] > 0) {
                 $result['msg'] = 'Category name already exists.';
                 $result['id'] = '';
                 $result['unitname'] = '';
                 $result['address'] = '';
             } else {
                 $menumodel = new Default_Model_Menu();
                 $actionflag = '';
                 $tableid = '';
                 $data = array('service_desk_name' => $service_desk_name, 'description' => $description != '' ? trim($description) : NULL, 'createdby' => $loginUserId, 'createddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where = '';
                 $actionflag = 1;
                 $Id = $servicedeskdepartmentmodel->SaveorUpdateServiceDeskDepartmentData($data, $where);
                 if ($Id) {
                     $menuID = SERVICEDESKDEPARTMENT;
                     $logresult = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $Id);
                     $result['msg'] = 'success';
                     $result['id'] = $Id;
                     $result['service_desk_name'] = $service_desk_name;
                     $result['description'] = $description;
                 } else {
                     $result['msg'] = 'error';
                     $result['id'] = '';
                     $result['service_desk_name'] = '';
                     $result['description'] = '';
                 }
             }
         }
     } catch (Exception $e) {
         $result['msg'] = $e->getMessage();
         $result['id'] = '';
         $result['service_desk_name'] = '';
         $result['description'] = '';
     }
     $this->_helper->json($result);
 }
 public function editAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $servicedeskrequestsform = new Default_Form_servicedeskrequest();
     $servicedeskdepartmentmodel = new Default_Model_Servicedeskdepartment();
     $servicedeskrequestmodel = new Default_Model_Servicedeskrequest();
     $msgarray = array();
     $popConfigPermission = array();
     if (sapp_Global::_checkprivileges(SERVICEDESKDEPARTMENT, $loginuserGroup, $loginuserRole, 'add') == 'Yes') {
         array_push($popConfigPermission, 'servicedeskdepartment');
     }
     $this->view->popConfigPermission = $popConfigPermission;
     try {
         if ($id) {
             if (is_numeric($id) && $id > 0) {
                 $data = $servicedeskrequestmodel->getServiceDeskRequestbyID($id);
                 if (!empty($data)) {
                     $data = $data[0];
                     $servicedeskdepartmentData = $servicedeskdepartmentmodel->getSDDepartmentData();
                     if (sizeof($servicedeskdepartmentData) > 0) {
                         foreach ($servicedeskdepartmentData as $servicedeskdepartmentres) {
                             $servicedeskrequestsform->service_desk_id->addMultiOption($servicedeskdepartmentres['id'], utf8_encode($servicedeskdepartmentres['service_desk_name']));
                         }
                     }
                     $servicedeskrequestsform->populate($data);
                     $servicedeskrequestsform->setDefault('service_desk_id', $data['service_desk_id']);
                     $servicedeskrequestsform->setAttrib('action', DOMAIN . 'servicedeskrequest/edit/id/' . $id);
                     $this->view->data = $data;
                 } else {
                     $this->view->ermsg = 'norecord';
                 }
             } else {
                 $this->view->ermsg = 'norecord';
             }
         } else {
             $this->view->ermsg = 'nodata';
         }
     } catch (Exception $e) {
         $this->view->ermsg = 'nodata';
     }
     $this->view->form = $servicedeskrequestsform;
     if ($this->getRequest()->getPost()) {
         $result = $this->save($servicedeskrequestsform);
         $this->view->msgarray = $result;
     }
     $this->render('form');
 }
예제 #4
0
 public function servicedeskreportAction()
 {
     $norec_arr = array();
     $form = new Default_Form_Servicedeskreport();
     $servicedeskdepartmentmodel = new Default_Model_Servicedeskdepartment();
     $sdDepts = $servicedeskdepartmentmodel->getSDDepartmentData();
     if (count($sdDepts) == 0) {
         $norec_arr['service_desk_id'] = "Categories are not configured yet.";
     } else {
         foreach ($sdDepts as $option) {
             $form->service_desk_id->addMultiOption($option['id'], $option['service_desk_name']);
         }
     }
     $this->view->form = $form;
     $this->view->messages = $norec_arr;
 }
 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;
     $count = 0;
     if ($id) {
         $servicedeskconfmodel = new Default_Model_Servicedeskconf();
         $servicedeskdepartmentmodel = new Default_Model_Servicedeskdepartment();
         $menumodel = new Default_Model_Menu();
         $servicedeskconfdata = $servicedeskconfmodel->getServiceDeskConfbyID($id);
         if (!empty($servicedeskconfdata)) {
             $pendingRequestdata = $servicedeskconfmodel->getPendingServiceReqData($servicedeskconfdata[0]['businessunit_id']);
         }
         if (!empty($pendingRequestdata)) {
             $count = $pendingRequestdata[0]['count'];
         }
         if ($count < 1) {
             $serviceDeptData = $servicedeskdepartmentmodel->getServiceDeskDepartmentDatabyID($servicedeskconfdata[0]['service_desk_id']);
             $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $where = array('id=?' => $id);
             $Id = $servicedeskconfmodel->SaveorUpdateServiceConfData($data, $where);
             if ($Id == 'update') {
                 $menuidArr = $menumodel->getMenuObjID('/servicedeskconf');
                 $menuID = $menuidArr[0]['id'];
                 $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                 if (!empty($serviceDeptData)) {
                     $configmail = sapp_Global::send_configuration_mail('Setting', $serviceDeptData[0]['service_desk_name']);
                 }
                 $messages['message'] = 'Setting deleted successfully.';
                 $messages['msgtype'] = 'success';
             } else {
                 $messages['message'] = 'Setting cannot be deleted.';
                 $messages['msgtype'] = 'error';
             }
         } else {
             $messages['message'] = 'Setting cannot be deleted as requests are in pending state.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Setting cannot be deleted.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }