From 8d2672f1f1246261bda8bce45616864a8d344cd3 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 화, 22 2월 2022 15:38:15 +0900
Subject: [PATCH] - 연관이슈 추가에서 프로젝트 변경시 이슈 유형이 선택되지 않고 빈값이 선택되는 문제 해결 (이슈 추가시에도 적용)

---
 src/main/webapp/scripts/app/issue/issueAddDown.controller.js |   76 ++++++++++++++++++++++++++------------
 1 files changed, 52 insertions(+), 24 deletions(-)

diff --git a/src/main/webapp/scripts/app/issue/issueAddDown.controller.js b/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
index 3e1c6d0..b51b126 100644
--- a/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
@@ -845,8 +845,6 @@
                         if (result.data.message.status === "success") {
                             $scope.fn.addDownIssue(result.data.data);
 
-                            $scope.fn.cancel();
-
                             //  �씠�뒋 �긽�꽭 �솕硫� �슂泥�
                             $rootScope.$broadcast("getIssueDetail", {
                                 id : parameter.id
@@ -862,29 +860,59 @@
                 }
 
                 // �븯�쐞 �씠�뒋 異붽�
-                function addDownIssue(downId) {
+                function addDownIssue(issueVo) {
+                    $rootScope.spinner = true;
+                    let inheritYn = issueVo.inheritPartners;
+                    let usePartner = issueVo.usePartner;
+
                     var ids = [];
-                    let inheritYn = false;
+                    if (issueVo.id != null) {
+                        ids.push(issueVo.id);
+                    }
 
-                    SweetAlert.swal({
-                        title : $filter("translate")("issue.addDownIssue"), // �븯�쐞 �씠�뒋 異붽�
-                        text : $filter("translate")("issue.wantToInheritPartnersOfParentIssue"), // �긽�쐞�씠�뒋�쓽 �뙆�듃�꼫 �젙蹂�(�뾽泥�/ISP/�샇�뒪�똿)瑜� �쟻�슜�떆�궎寃좎뒿�땲源�?
-                        type : "warning",
-                        showCancelButton : true,
-                        confirmButtonColor : "#DD6B55",
-                        confirmButtonText : $filter("translate")("common.ok"), // �꽕
-                        cancelButtonText : $filter("translate")("common.no"), // �븘�땲�삤
-                        closeOnConfirm : false,
-                        closeOnCancel : false
-                    },
-                    function (isConfirm) {
-                        if (isConfirm) {
-                            inheritYn = true;
-                        }
+                    if ($rootScope.isDefined(usePartner) && usePartner > 0
+                            && $rootScope.isDefined(inheritYn) && inheritYn) {
+                        SweetAlert.swal({
+                            title : $filter("translate")("issue.addDownIssue"), // �븯�쐞 �씠�뒋 異붽�
+                            text : $filter("translate")("issue.wantToInheritPartnersOfParentIssue"), // �긽�쐞�씠�뒋�쓽 �뙆�듃�꼫 �젙蹂�(�뾽泥�/ISP/�샇�뒪�똿)瑜� �쟻�슜�떆�궎寃좎뒿�땲源�?
+                            type : "warning",
+                            showCancelButton : true,
+                            confirmButtonColor : "#DD6B55",
+                            confirmButtonText : $filter("translate")("common.ok"), // �꽕
+                            cancelButtonText : $filter("translate")("common.no"), // �븘�땲�삤
+                            closeOnConfirm : false,
+                            closeOnCancel : false
+                        },
+                        function (isConfirm) {
+                            if (!isConfirm) {
+                                inheritYn = false;
+                            }
 
-                        if (downId != null) {
-                            ids.push(downId);
-                        }
+                            var contents = {
+                                issueId :  parameter.id,
+                                ids : ids,
+                                parentIssueId : parameter.id,
+                                inheritYn : inheritYn
+                            };
+
+                            Issue.modifyParentIssue($resourceProvider.getContent(
+                                contents,
+                                $resourceProvider.getPageContent(0, 10))).then(function (result) {
+
+                                if (result.data.message.status === "success") {
+                                    $scope.fn.cancel();
+                                    //  �씠�뒋 �긽�꽭 �솕硫� �슂泥�
+                                    $rootScope.$broadcast("getIssueDetail", {
+                                        id : parameter.id
+                                    });
+                                }
+                                else {
+                                    SweetAlert.error($filter("translate")("issue.failedToIssueAddIssueDown"), result.data.message.message); // "�븯�쐞�씠�뒋 �깮�꽦 �떎�뙣"
+                                }
+                                $rootScope.spinner = false;
+                            });
+                        });
+                    } else {
 
                         var contents = {
                             issueId :  parameter.id,
@@ -898,7 +926,7 @@
                             $resourceProvider.getPageContent(0, 10))).then(function (result) {
 
                             if (result.data.message.status === "success") {
-                                SweetAlert.close();
+                                $scope.fn.cancel();
                                 //  �씠�뒋 �긽�꽭 �솕硫� �슂泥�
                                 $rootScope.$broadcast("getIssueDetail", {
                                     id : parameter.id
@@ -908,7 +936,7 @@
                                 SweetAlert.error($filter("translate")("issue.failedToIssueAddIssueDown"), result.data.message.message); // "�븯�쐞�씠�뒋 �깮�꽦 �떎�뙣"
                             }
                         });
-                    });
+                    }
                 }
 
                 //  �뙘�뾽 李� �떕湲�

--
Gitblit v1.8.0