From 6e9f504acc73687b623a1f7598eb3833cbc088aa Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 수, 08 12월 2021 18:04:50 +0900
Subject: [PATCH] ** DB 초기화 필요 업체 - url 인덱스 추가 및 url 중복으로 추가 못하도록 수정

---
 src/main/webapp/scripts/components/utils/autoComplete.controller.js |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/scripts/components/utils/autoComplete.controller.js b/src/main/webapp/scripts/components/utils/autoComplete.controller.js
index d40a45f..cc4d354 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 = {
@@ -312,7 +314,16 @@
 
                 function getIssueDepartmentList(query, excludeList, page, callBack) {
                     var conditions = {
-                        issueTypeId : $scope.vm.form.issueTypeId,
+                        //issueTypeId : $scope.vm.form.issueTypeId,
+                        issueTypeId : (function () {
+                            var issueTypeId = "";
+                            if ($rootScope.currentDetailIssueId != null) {
+                                issueTypeId = $rootScope.currentDetailIssueId;
+                            } else {
+                                issueTypeId = $scope.vm.form.issueTypeId;
+                            }
+                            return issueTypeId;
+                        })(),
                         departmentName : query,
                         userId : $rootScope.user.id,
                         projectId : (function () {
@@ -345,7 +356,7 @@
                         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;
-                            if(departments != null && departments.length() > 0){
+                            if(departments != null){
                                 var filterDepartments = departments.filter(function(item, idx){
                                     return departments.findIndex(function(item2, idx2){
                                         return item.departmentName === item2.departmentName
@@ -534,6 +545,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