From dc9b09a4ee390db471ba8b7dedc375a9c7e72ad3 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 월, 13 12월 2021 15:56:49 +0900
Subject: [PATCH] - 연관이슈 검색 시 다른 이슈 유형(다른 프로젝트)의 이슈도 검색 가능 하도록 수정 - 부서 삭제 코드 약간 수정

---
 src/main/webapp/scripts/components/utils/autoComplete.controller.js |   82 +++++++++++++++++++++++++++++++++--------
 1 files changed, 66 insertions(+), 16 deletions(-)

diff --git a/src/main/webapp/scripts/components/utils/autoComplete.controller.js b/src/main/webapp/scripts/components/utils/autoComplete.controller.js
index 6402006..638c1dd 100644
--- a/src/main/webapp/scripts/components/utils/autoComplete.controller.js
+++ b/src/main/webapp/scripts/components/utils/autoComplete.controller.js
@@ -23,6 +23,7 @@
                 var IspField = $injector.get("IspField");
                 var HostingField = $injector.get("HostingField");
                 var IssueType = $injector.get("IssueType");
+                var IssueTypeCustomField = $injector.get("IssueTypeCustomField");
                 var CustomField = $injector.get("CustomField");
                 var $log = $injector.get("$log");
                 var SweetAlert = $injector.get("SweetAlert");
@@ -42,6 +43,7 @@
                 $scope.fn.getIssueTypeList = getIssueTypeList;          // �씠�뒋 �쑀�삎 紐⑸줉 議고쉶
                 $scope.fn.getCustomFieldList = getCustomFieldList;          // �궗�슜�옄 �젙�쓽 �븘�뱶 紐⑸줉 議고쉶
                 $scope.fn.getMailTargetAll = getMailTargetAll;          // �궗�슜�옄 �젙�쓽 �븘�뱶 紐⑸줉 議고쉶
+                $scope.fn.getIssueTypeCustomFieldList = getIssueTypeCustomFieldList;      // �씠�뒋 �쑀�삎�뿉�꽌 �궗�슜以묒씤 �궗�슜�옄�젙�쓽 �븘�뱶媛��졇�삤湲�
 
                 function getUserList(query, excludeList, page, callBack) {
                     var conditions = {
@@ -131,13 +133,13 @@
                 function getIssueList(query, issueTypeId, excludeList, page, callBack) {
                     var conditions = {
                         name : query,
-                        issueTypeIds : (function () {
+                        /*issueTypeIds : (function () {
                             var ids = [];
 
                             ids.push(issueTypeId);
 
                             return ids;
-                        })(),
+                        })(),*/
                         excludeIds : (function () {
                             var excludeIds = [];
 
@@ -173,13 +175,13 @@
                 function getDownIssueList(query, issueTypeId, excludeList, page, callBack) {
                     var conditions = {
                         name : query,
-                        // issueTypeIds : (function () {
-                        //     var ids = [];
-                        //
-                        //     ids.push(issueTypeId);
-                        //
-                        //     return ids;
-                        // })(),
+                        issueTypeIds : (function () {
+                            var ids = [];
+
+                            ids.push(issueTypeId);
+
+                            return ids;
+                        })(),
                         excludeIds : (function () {
                             var excludeIds = [];
 
@@ -310,9 +312,10 @@
                     return deferred.promise;
                 }
 
-                function getIssueDepartmentList(query, excludeList, page, callBack) {
+                function getIssueDepartmentList(issueTypeId, query, excludeList, page, callBack) {
                     var conditions = {
-                        issueTypeId : $scope.vm.form.issueTypeId,
+                        //issueTypeId : $scope.vm.form.issueTypeId,
+                        issueTypeId : issueTypeId,
                         departmentName : query,
                         userId : $rootScope.user.id,
                         projectId : (function () {
@@ -345,11 +348,13 @@
                         conditions, $resourceProvider.getPageContent($rootScope.isDefined(page) ? page : 0, $rootScope.isDefined(page) ? 10 : 25))).then(function (result) {
                         if (result.data.message.status === "success") {
                             const departments = result.data.data;
-                            var filterDepartments = departments.filter(function(item, idx){
-                                return departments.findIndex(function(item2, idx2){
-                                    return item.departmentName === item2.departmentName
-                                }) == idx;
-                            });
+                            if(departments != null){
+                                var filterDepartments = departments.filter(function(item, idx){
+                                    return departments.findIndex(function(item2, idx2){
+                                        return item.departmentName === item2.departmentName
+                                    }) == idx;
+                                });
+                            }
 
                             if ($rootScope.isDefined(callBack)) {
                                 callBack(result);
@@ -532,6 +537,51 @@
                     return deferred.promise;
                 }
 
+                //  �씠�뒋 �쑀�삎�뿉 �뿰寃곕맂 �궗�슜�옄 �젙�쓽 �븘�뱶
+                function getIssueTypeCustomFieldList(query, excludeList, projectId, issueTypeId, page, callBack) {
+
+                    if (projectId == null) return;
+                    if (issueTypeId == null) return;
+
+                    var deferred = $q.defer();
+
+                    IssueTypeCustomField.find($resourceProvider.getContent({
+                            name : query,
+                            projectId : projectId,
+                            issueTypeId : issueTypeId,
+                            excludeIds : (function () {
+                                var excludeIds = [];
+
+                                angular.forEach(excludeList, function (exclude) {
+                                    excludeIds.push(exclude.id);
+                                });
+
+                                return excludeIds;
+                            })()
+                        },
+                        $resourceProvider.getPageContent(0, 1000))).then(function (result) {
+                        if (result.data.message.status === "success") {
+                            if ($rootScope.isDefined(callBack)) {
+                                callBack(result);
+                            }
+
+                            var customFields = result.data.data;
+                            var customFieldVos = [];
+                            customFields.forEach(function (customField) {
+                                customFieldVos.push(customField.customFieldVo);
+                            })
+
+                            deferred.resolve(customFieldVos);
+                        }
+                        else {
+                            SweetAlert.swal($filter("translate")("issue.failedToUserDefinedFieldListAssociatedLookup"), result.data.message.message, "error"); // �씠�뒋 �쑀�삎�뿉 �뿰寃곕맂 �궗�슜�옄 �젙�쓽 �븘�뱶 紐⑸줉 議고쉶 �떎�뙣
+                        }
+
+                    });
+
+                    return deferred.promise;
+                }
+
                 function getMailTargetAll(excludeList) {
                     var deferred = $q.defer();
 

--
Gitblit v1.8.0