From 8e62d47c7210854b570db5e9164a6a9da6351c12 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 수, 09 2월 2022 17:59:06 +0900
Subject: [PATCH] - 이슈 추가,수정 시 파트너 정보 null 체크 추가

---
 src/main/java/kr/wisestone/owl/service/impl/IssueCompanyServiceImpl.java  |    2 
 src/main/webapp/scripts/app/issue/issueAddRelation.controller.js          |  126 ++++++------
 src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js |   16 
 src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js    |   14 
 src/main/webapp/scripts/app/issue/issueAddDown.controller.js              |  125 ++++++------
 src/main/webapp/scripts/app/issue/issueAdd.controller.js                  |  128 ++++++------
 src/main/webapp/scripts/app/issue/issueModify.controller.js               |  143 +++++++------
 7 files changed, 284 insertions(+), 270 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueCompanyServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueCompanyServiceImpl.java
index dbd380b..bb94742 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/IssueCompanyServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/IssueCompanyServiceImpl.java
@@ -92,7 +92,7 @@
      * @return issueCompany
      */
     private IssueCompany CreateIssueCompany(CompanyFieldForm companyFieldForm, Issue issue) {
-        IssueCompany issueCompany = ConvertUtil.copyProperties(companyFieldForm, IssueCompany.class);
+        IssueCompany issueCompany = ConvertUtil.copyProperties(companyFieldForm, IssueCompany.class, "id");
         issueCompany.setIssue(issue);
         if (companyFieldForm.getId() != null && companyFieldForm.getId() != -1) {
             CompanyField companyField = this.companyFieldService.getCompany(companyFieldForm.getId());
diff --git a/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js b/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js
index 6b9b468..46f940a 100644
--- a/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js
+++ b/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js
@@ -140,24 +140,24 @@
                 }
 
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.ispId = result[0].id;
                     }
                 });
 
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.hostingId = result[0].id;
                     }
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.companyTypeId = result[0].id;
                     }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.parentSectorId = result[0].id;
                     }
                     $scope.vm.form.childSectorId = "";
@@ -165,17 +165,17 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.childSectorId = result[0].id;
                     }
                 });
                 $scope.$on("regionEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.regionId = result[0].id;
                     }
                 });
                 $scope.$on("statusEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.statusId = result[0].id;
                     }
                 });
diff --git a/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js b/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
index 021f8d3..d866e76 100644
--- a/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
+++ b/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
@@ -144,24 +144,24 @@
                 }
 
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.ispId = result[0].id;
                     }
                 });
 
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.hostingId = result[0].id;
                     }
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.companyTypeId = result[0].id;
                     }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.parentSectorId = result[0].id;
                     }
                     $scope.vm.form.childSectorId = "";
@@ -169,17 +169,17 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.childSectorId = result[0].id;
                     }
                 });
                 $scope.$on("regionEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.regionId = result[0].id;
                     }
                 });
                 $scope.$on("statusEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.statusId = result[0].id;
                     }
                 });
@@ -194,7 +194,7 @@
                         name : $rootScope.preventXss($scope.vm.form.name),
                         ispId : (function () {  // ISP �븘�씠�뵒
                             var ispId = null;
-                            if ($scope.vm.form.ispName !== "" && $scope.vm.form.ispId !== null && $scope.vm.form.ispId !== null) {
+                            if ($scope.vm.form.ispName !== "" && $scope.vm.form.ispId !== null && $scope.vm.form.ispId !== -1) {
                                 ispId = $scope.vm.form.ispId;
                             }else if ($scope.vm.form.issueIspFields != null && $scope.vm.form.issueIspFields.length > 0) {
                                 ispId = $scope.vm.form.issueIspFields[0].id;
diff --git a/src/main/webapp/scripts/app/issue/issueAdd.controller.js b/src/main/webapp/scripts/app/issue/issueAdd.controller.js
index b75de6a..0a6f32d 100644
--- a/src/main/webapp/scripts/app/issue/issueAdd.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueAdd.controller.js
@@ -194,8 +194,6 @@
 
                 //  �봽濡쒖젥�듃媛� 蹂�寃쎈릺硫� �떞�떦�옄 珥덇린�솕
                 $scope.$watch("vm.form.projects", function (newValue, oldValue) {
-
-
                     if (angular.isDefined(newValue)) {
                         if (newValue.length < 1) {
                             $scope.vm.form.users = [];
@@ -462,70 +460,72 @@
 
                 // �뾽泥댁젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("companyFieldEvent", function (event, result) {
-                    var ispFieldVo = result[0].ispFieldVo;
-                    var hostingFieldVo = result[0].hostingFieldVo;
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
+                        var ispFieldVo = result[0].ispFieldVo;
+                        var hostingFieldVo = result[0].hostingFieldVo;
 
-                    $scope.vm.companyId = result[0].id;
-                    $scope.vm.companyName = result[0].name;
-                    $scope.vm.companyManager = result[0].manager;
-                    $scope.vm.companyTel = result[0].tel;
-                    $scope.vm.companyEmail = result[0].email;
-                    $scope.vm.companyUrl = result[0].url;
-                    $scope.vm.companyMemo = result[0].memo;
-                    $scope.vm.form.companyTypeId = result[0].companyTypeId;
-                    $scope.vm.form.parentSectorId = result[0].parentSectorId;
-                    $scope.vm.form.childSectorId = result[0].childSectorId;
-                    $scope.vm.form.regionId = result[0].regionId;
-                    $scope.vm.form.statusId = result[0].statusId;
-                    $scope.vm.form.companyType = result[0].companyTypeName;
-                    $scope.vm.form.parentSector = result[0].parentSectorName;
-                    $scope.vm.form.childSector = result[0].childSectorName;
-                    $scope.vm.form.region = result[0].regionName;
-                    $scope.vm.form.status = result[0].statusName;
+                        $scope.vm.companyId = result[0].id;
+                        $scope.vm.companyName = result[0].name;
+                        $scope.vm.companyManager = result[0].manager;
+                        $scope.vm.companyTel = result[0].tel;
+                        $scope.vm.companyEmail = result[0].email;
+                        $scope.vm.companyUrl = result[0].url;
+                        $scope.vm.companyMemo = result[0].memo;
+                        $scope.vm.form.companyTypeId = result[0].companyTypeId;
+                        $scope.vm.form.parentSectorId = result[0].parentSectorId;
+                        $scope.vm.form.childSectorId = result[0].childSectorId;
+                        $scope.vm.form.regionId = result[0].regionId;
+                        $scope.vm.form.statusId = result[0].statusId;
+                        $scope.vm.form.companyType = result[0].companyTypeName;
+                        $scope.vm.form.parentSector = result[0].parentSectorName;
+                        $scope.vm.form.childSector = result[0].childSectorName;
+                        $scope.vm.form.region = result[0].regionName;
+                        $scope.vm.form.status = result[0].statusName;
 
-                    $scope.vm.ispId = "";
-                    $scope.vm.ispName = "";
-                    $scope.vm.ispCode = "";
-                    $scope.vm.ispManager = "";
-                    $scope.vm.ispTel = "";
-                    $scope.vm.ispEmail = "";
-                    $scope.vm.ispUrl = "";
-                    $scope.vm.ispMemo = "";
+                        $scope.vm.ispId = "";
+                        $scope.vm.ispName = "";
+                        $scope.vm.ispCode = "";
+                        $scope.vm.ispManager = "";
+                        $scope.vm.ispTel = "";
+                        $scope.vm.ispEmail = "";
+                        $scope.vm.ispUrl = "";
+                        $scope.vm.ispMemo = "";
 
-                    $scope.vm.hostingId = "";
-                    $scope.vm.hostingName = "";
-                    $scope.vm.hostingCode = "";
-                    $scope.vm.hostingManager = "";
-                    $scope.vm.hostingTel = "";
-                    $scope.vm.hostingEmail = "";
-                    $scope.vm.hostingUrl = "";
-                    $scope.vm.hostingMemo = "";
+                        $scope.vm.hostingId = "";
+                        $scope.vm.hostingName = "";
+                        $scope.vm.hostingCode = "";
+                        $scope.vm.hostingManager = "";
+                        $scope.vm.hostingTel = "";
+                        $scope.vm.hostingEmail = "";
+                        $scope.vm.hostingUrl = "";
+                        $scope.vm.hostingMemo = "";
 
-                    if (ispFieldVo != null){
-                        $scope.vm.ispId = ispFieldVo.id;
-                        $scope.vm.ispName = ispFieldVo.name;
-                        $scope.vm.ispCode = ispFieldVo.code;
-                        $scope.vm.ispManager = ispFieldVo.manager;
-                        $scope.vm.ispTel = ispFieldVo.tel;
-                        $scope.vm.ispEmail = ispFieldVo.email;
-                        $scope.vm.ispUrl = ispFieldVo.url;
-                        $scope.vm.ispMemo = ispFieldVo.memo;
-                    }
-                    if (hostingFieldVo != null){
-                        $scope.vm.hostingId = hostingFieldVo.id;
-                        $scope.vm.hostingName = hostingFieldVo.name;
-                        $scope.vm.hostingCode = hostingFieldVo.code;
-                        $scope.vm.hostingManager = hostingFieldVo.manager;
-                        $scope.vm.hostingTel = hostingFieldVo.tel;
-                        $scope.vm.hostingEmail = hostingFieldVo.email;
-                        $scope.vm.hostingUrl = hostingFieldVo.url;
-                        $scope.vm.hostingMemo = hostingFieldVo.memo;
+                        if (ispFieldVo != null) {
+                            $scope.vm.ispId = ispFieldVo.id;
+                            $scope.vm.ispName = ispFieldVo.name;
+                            $scope.vm.ispCode = ispFieldVo.code;
+                            $scope.vm.ispManager = ispFieldVo.manager;
+                            $scope.vm.ispTel = ispFieldVo.tel;
+                            $scope.vm.ispEmail = ispFieldVo.email;
+                            $scope.vm.ispUrl = ispFieldVo.url;
+                            $scope.vm.ispMemo = ispFieldVo.memo;
+                        }
+                        if (hostingFieldVo != null) {
+                            $scope.vm.hostingId = hostingFieldVo.id;
+                            $scope.vm.hostingName = hostingFieldVo.name;
+                            $scope.vm.hostingCode = hostingFieldVo.code;
+                            $scope.vm.hostingManager = hostingFieldVo.manager;
+                            $scope.vm.hostingTel = hostingFieldVo.tel;
+                            $scope.vm.hostingEmail = hostingFieldVo.email;
+                            $scope.vm.hostingUrl = hostingFieldVo.url;
+                            $scope.vm.hostingMemo = hostingFieldVo.memo;
+                        }
                     }
                 });
 
                 //ISP�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.ispId = result[0].id;
                         $scope.vm.ispName = result[0].name;
                         $scope.vm.ispCode = result[0].code;
@@ -539,7 +539,7 @@
 
                 // �샇�뒪�똿�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.hostingId = result[0].id;
                         $scope.vm.hostingName = result[0].name;
                         $scope.vm.hostingCode = result[0].code;
@@ -552,12 +552,12 @@
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.companyTypeId = result[0].id;
                     }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.parentSectorId = result[0].id;
                     }
                     $scope.vm.form.childSectorId = "";
@@ -565,17 +565,17 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.childSectorId = result[0].id;
                     }
                 });
                 $scope.$on("regionEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.regionId = result[0].id;
                     }
                 });
                 $scope.$on("statusEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.statusId = result[0].id;
                     }
                 });
@@ -882,7 +882,7 @@
                 function getIssueTypes() {
                     var deferred = $q.defer();
 
-                    if (!$rootScope.isDefined($scope.vm.form.projects[0])) {
+                    if (!$rootScope.isDefined($scope.vm.form.projects) || !$rootScope.isDefined($scope.vm.form.projects[0])) {
                         return;
                     }
 
diff --git a/src/main/webapp/scripts/app/issue/issueAddDown.controller.js b/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
index e68f2ac..3b9a41f 100644
--- a/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
@@ -185,7 +185,6 @@
                 //  �봽濡쒖젥�듃媛� 蹂�寃쎈릺硫� �떞�떦�옄 珥덇린�솕
                 $scope.$watch("vm.form.projects", function (newValue, oldValue) {
 
-
                     if (angular.isDefined(newValue)) {
                         if (newValue.length < 1) {
                             $scope.vm.form.users = [];
@@ -450,70 +449,72 @@
 
                 // �뾽泥댁젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("companyFieldEvent", function (event, result) {
-                    var ispFieldVo = result[0].ispFieldVo;
-                    var hostingFieldVo = result[0].hostingFieldVo;
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
+                        var ispFieldVo = result[0].ispFieldVo;
+                        var hostingFieldVo = result[0].hostingFieldVo;
 
-                    $scope.vm.companyId = result[0].id;
-                    $scope.vm.companyName = result[0].name;
-                    $scope.vm.companyManager = result[0].manager;
-                    $scope.vm.companyTel = result[0].tel;
-                    $scope.vm.companyEmail = result[0].email;
-                    $scope.vm.companyUrl = result[0].url;
-                    $scope.vm.companyMemo = result[0].memo;
-                    $scope.vm.form.companyTypeId = result[0].companyTypeId;
-                    $scope.vm.form.parentSectorId = result[0].parentSectorId;
-                    $scope.vm.form.childSectorId = result[0].childSectorId;
-                    $scope.vm.form.regionId = result[0].regionId;
-                    $scope.vm.form.statusId = result[0].statusId;
-                    $scope.vm.form.companyType = result[0].companyTypeName;
-                    $scope.vm.form.parentSector = result[0].parentSectorName;
-                    $scope.vm.form.childSector = result[0].childSectorName;
-                    $scope.vm.form.region = result[0].regionName;
-                    $scope.vm.form.status = result[0].statusName;
+                        $scope.vm.companyId = result[0].id;
+                        $scope.vm.companyName = result[0].name;
+                        $scope.vm.companyManager = result[0].manager;
+                        $scope.vm.companyTel = result[0].tel;
+                        $scope.vm.companyEmail = result[0].email;
+                        $scope.vm.companyUrl = result[0].url;
+                        $scope.vm.companyMemo = result[0].memo;
+                        $scope.vm.form.companyTypeId = result[0].companyTypeId;
+                        $scope.vm.form.parentSectorId = result[0].parentSectorId;
+                        $scope.vm.form.childSectorId = result[0].childSectorId;
+                        $scope.vm.form.regionId = result[0].regionId;
+                        $scope.vm.form.statusId = result[0].statusId;
+                        $scope.vm.form.companyType = result[0].companyTypeName;
+                        $scope.vm.form.parentSector = result[0].parentSectorName;
+                        $scope.vm.form.childSector = result[0].childSectorName;
+                        $scope.vm.form.region = result[0].regionName;
+                        $scope.vm.form.status = result[0].statusName;
 
-                    $scope.vm.ispId = "";
-                    $scope.vm.ispName = "";
-                    $scope.vm.ispCode = "";
-                    $scope.vm.ispManager = "";
-                    $scope.vm.ispTel = "";
-                    $scope.vm.ispEmail = "";
-                    $scope.vm.ispUrl = "";
-                    $scope.vm.ispMemo = "";
+                        $scope.vm.ispId = "";
+                        $scope.vm.ispName = "";
+                        $scope.vm.ispCode = "";
+                        $scope.vm.ispManager = "";
+                        $scope.vm.ispTel = "";
+                        $scope.vm.ispEmail = "";
+                        $scope.vm.ispUrl = "";
+                        $scope.vm.ispMemo = "";
 
-                    $scope.vm.hostingId = "";
-                    $scope.vm.hostingName = "";
-                    $scope.vm.hostingCode = "";
-                    $scope.vm.hostingManager = "";
-                    $scope.vm.hostingTel = "";
-                    $scope.vm.hostingEmail = "";
-                    $scope.vm.hostingUrl = "";
-                    $scope.vm.hostingMemo = "";
+                        $scope.vm.hostingId = "";
+                        $scope.vm.hostingName = "";
+                        $scope.vm.hostingCode = "";
+                        $scope.vm.hostingManager = "";
+                        $scope.vm.hostingTel = "";
+                        $scope.vm.hostingEmail = "";
+                        $scope.vm.hostingUrl = "";
+                        $scope.vm.hostingMemo = "";
 
-                    if (ispFieldVo != null){
-                        $scope.vm.ispId = ispFieldVo.id;
-                        $scope.vm.ispName = ispFieldVo.name;
-                        $scope.vm.ispCode = ispFieldVo.code;
-                        $scope.vm.ispManager = ispFieldVo.manager;
-                        $scope.vm.ispTel = ispFieldVo.tel;
-                        $scope.vm.ispEmail = ispFieldVo.email;
-                        $scope.vm.ispUrl = ispFieldVo.url;
-                        $scope.vm.ispMemo = ispFieldVo.memo;
-                    }
-                    if (hostingFieldVo != null){
-                        $scope.vm.hostingId = hostingFieldVo.id;
-                        $scope.vm.hostingName = hostingFieldVo.name;
-                        $scope.vm.hostingCode = hostingFieldVo.code;
-                        $scope.vm.hostingManager = hostingFieldVo.manager;
-                        $scope.vm.hostingTel = hostingFieldVo.tel;
-                        $scope.vm.hostingEmail = hostingFieldVo.email;
-                        $scope.vm.hostingUrl = hostingFieldVo.url;
-                        $scope.vm.hostingMemo = hostingFieldVo.memo;
+                        if (ispFieldVo != null) {
+                            $scope.vm.ispId = ispFieldVo.id;
+                            $scope.vm.ispName = ispFieldVo.name;
+                            $scope.vm.ispCode = ispFieldVo.code;
+                            $scope.vm.ispManager = ispFieldVo.manager;
+                            $scope.vm.ispTel = ispFieldVo.tel;
+                            $scope.vm.ispEmail = ispFieldVo.email;
+                            $scope.vm.ispUrl = ispFieldVo.url;
+                            $scope.vm.ispMemo = ispFieldVo.memo;
+                        }
+                        if (hostingFieldVo != null) {
+                            $scope.vm.hostingId = hostingFieldVo.id;
+                            $scope.vm.hostingName = hostingFieldVo.name;
+                            $scope.vm.hostingCode = hostingFieldVo.code;
+                            $scope.vm.hostingManager = hostingFieldVo.manager;
+                            $scope.vm.hostingTel = hostingFieldVo.tel;
+                            $scope.vm.hostingEmail = hostingFieldVo.email;
+                            $scope.vm.hostingUrl = hostingFieldVo.url;
+                            $scope.vm.hostingMemo = hostingFieldVo.memo;
+                        }
                     }
                 });
 
                 // ISP�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.ispId = result[0].id;
                         $scope.vm.ispName = result[0].name;
                         $scope.vm.ispCode = result[0].code;
@@ -527,7 +528,7 @@
 
                 // �샇�뒪�똿�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.hostingId = result[0].id;
                         $scope.vm.hostingName = result[0].name;
                         $scope.vm.hostingCode = result[0].code;
@@ -540,12 +541,12 @@
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.companyTypeId = result[0].id;
                     }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.parentSectorId = result[0].id;
                     }
                     $scope.vm.form.childSectorId = "";
@@ -553,17 +554,17 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.childSectorId = result[0].id;
                     }
                 });
                 $scope.$on("regionEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.regionId = result[0].id;
                     }
                 });
                 $scope.$on("statusEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.statusId = result[0].id;
                     }
                 });
diff --git a/src/main/webapp/scripts/app/issue/issueAddRelation.controller.js b/src/main/webapp/scripts/app/issue/issueAddRelation.controller.js
index 5fc35f8..4739c3a 100644
--- a/src/main/webapp/scripts/app/issue/issueAddRelation.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueAddRelation.controller.js
@@ -197,8 +197,6 @@
 
                 //  �봽濡쒖젥�듃媛� 蹂�寃쎈릺硫� �떞�떦�옄 珥덇린�솕
                 $scope.$watch("vm.form.projects", function (newValue, oldValue) {
-
-
                     if (angular.isDefined(newValue)) {
                         if (newValue.length < 1) {
                             $scope.vm.form.users = [];
@@ -465,70 +463,72 @@
 
                 // �뾽泥댁젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("companyFieldEvent", function (event, result) {
-                    var ispFieldVo = result[0].ispFieldVo;
-                    var hostingFieldVo = result[0].hostingFieldVo;
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
+                        var ispFieldVo = result[0].ispFieldVo;
+                        var hostingFieldVo = result[0].hostingFieldVo;
 
-                    $scope.vm.companyId = result[0].id;
-                    $scope.vm.companyName = result[0].name;
-                    $scope.vm.companyManager = result[0].manager;
-                    $scope.vm.companyTel = result[0].tel;
-                    $scope.vm.companyEmail = result[0].email;
-                    $scope.vm.companyUrl = result[0].url;
-                    $scope.vm.companyMemo = result[0].memo;
-                    $scope.vm.form.companyTypeId = result[0].companyTypeId;
-                    $scope.vm.form.parentSectorId = result[0].parentSectorId;
-                    $scope.vm.form.childSectorId = result[0].childSectorId;
-                    $scope.vm.form.regionId = result[0].regionId;
-                    $scope.vm.form.statusId = result[0].statusId;
-                    $scope.vm.form.companyType = result[0].companyTypeName;
-                    $scope.vm.form.parentSector = result[0].parentSectorName;
-                    $scope.vm.form.childSector = result[0].childSectorName;
-                    $scope.vm.form.region = result[0].regionName;
-                    $scope.vm.form.status = result[0].statusName;
+                        $scope.vm.companyId = result[0].id;
+                        $scope.vm.companyName = result[0].name;
+                        $scope.vm.companyManager = result[0].manager;
+                        $scope.vm.companyTel = result[0].tel;
+                        $scope.vm.companyEmail = result[0].email;
+                        $scope.vm.companyUrl = result[0].url;
+                        $scope.vm.companyMemo = result[0].memo;
+                        $scope.vm.form.companyTypeId = result[0].companyTypeId;
+                        $scope.vm.form.parentSectorId = result[0].parentSectorId;
+                        $scope.vm.form.childSectorId = result[0].childSectorId;
+                        $scope.vm.form.regionId = result[0].regionId;
+                        $scope.vm.form.statusId = result[0].statusId;
+                        $scope.vm.form.companyType = result[0].companyTypeName;
+                        $scope.vm.form.parentSector = result[0].parentSectorName;
+                        $scope.vm.form.childSector = result[0].childSectorName;
+                        $scope.vm.form.region = result[0].regionName;
+                        $scope.vm.form.status = result[0].statusName;
 
-                    $scope.vm.ispId = "";
-                    $scope.vm.ispName = "";
-                    $scope.vm.ispCode = "";
-                    $scope.vm.ispManager = "";
-                    $scope.vm.ispTel = "";
-                    $scope.vm.ispEmail = "";
-                    $scope.vm.ispUrl = "";
-                    $scope.vm.ispMemo = "";
+                        $scope.vm.ispId = "";
+                        $scope.vm.ispName = "";
+                        $scope.vm.ispCode = "";
+                        $scope.vm.ispManager = "";
+                        $scope.vm.ispTel = "";
+                        $scope.vm.ispEmail = "";
+                        $scope.vm.ispUrl = "";
+                        $scope.vm.ispMemo = "";
 
-                    $scope.vm.hostingId = "";
-                    $scope.vm.hostingName = "";
-                    $scope.vm.hostingCode = "";
-                    $scope.vm.hostingManager = "";
-                    $scope.vm.hostingTel = "";
-                    $scope.vm.hostingEmail = "";
-                    $scope.vm.hostingUrl = "";
-                    $scope.vm.hostingMemo = "";
+                        $scope.vm.hostingId = "";
+                        $scope.vm.hostingName = "";
+                        $scope.vm.hostingCode = "";
+                        $scope.vm.hostingManager = "";
+                        $scope.vm.hostingTel = "";
+                        $scope.vm.hostingEmail = "";
+                        $scope.vm.hostingUrl = "";
+                        $scope.vm.hostingMemo = "";
 
-                    if (ispFieldVo != null){
-                        $scope.vm.ispId = ispFieldVo.id;
-                        $scope.vm.ispName = ispFieldVo.name;
-                        $scope.vm.ispCode = ispFieldVo.code;
-                        $scope.vm.ispManager = ispFieldVo.manager;
-                        $scope.vm.ispTel = ispFieldVo.tel;
-                        $scope.vm.ispEmail = ispFieldVo.email;
-                        $scope.vm.ispUrl = ispFieldVo.url;
-                        $scope.vm.ispMemo = ispFieldVo.memo;
-                    }
-                    if (hostingFieldVo != null){
-                        $scope.vm.hostingId = hostingFieldVo.id;
-                        $scope.vm.hostingName = hostingFieldVo.name;
-                        $scope.vm.hostingCode = hostingFieldVo.code;
-                        $scope.vm.hostingManager = hostingFieldVo.manager;
-                        $scope.vm.hostingTel = hostingFieldVo.tel;
-                        $scope.vm.hostingEmail = hostingFieldVo.email;
-                        $scope.vm.hostingUrl = hostingFieldVo.url;
-                        $scope.vm.hostingMemo = hostingFieldVo.memo;
+                        if (ispFieldVo != null) {
+                            $scope.vm.ispId = ispFieldVo.id;
+                            $scope.vm.ispName = ispFieldVo.name;
+                            $scope.vm.ispCode = ispFieldVo.code;
+                            $scope.vm.ispManager = ispFieldVo.manager;
+                            $scope.vm.ispTel = ispFieldVo.tel;
+                            $scope.vm.ispEmail = ispFieldVo.email;
+                            $scope.vm.ispUrl = ispFieldVo.url;
+                            $scope.vm.ispMemo = ispFieldVo.memo;
+                        }
+                        if (hostingFieldVo != null) {
+                            $scope.vm.hostingId = hostingFieldVo.id;
+                            $scope.vm.hostingName = hostingFieldVo.name;
+                            $scope.vm.hostingCode = hostingFieldVo.code;
+                            $scope.vm.hostingManager = hostingFieldVo.manager;
+                            $scope.vm.hostingTel = hostingFieldVo.tel;
+                            $scope.vm.hostingEmail = hostingFieldVo.email;
+                            $scope.vm.hostingUrl = hostingFieldVo.url;
+                            $scope.vm.hostingMemo = hostingFieldVo.memo;
+                        }
                     }
                 });
 
                 // ISP�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.ispId = result[0].id;
                         $scope.vm.ispName = result[0].name;
                         $scope.vm.ispCode = result[0].code;
@@ -542,7 +542,7 @@
 
                 // �샇�뒪�똿�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.hostingId = result[0].id;
                         $scope.vm.hostingName = result[0].name;
                         $scope.vm.hostingCode = result[0].code;
@@ -555,12 +555,12 @@
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.companyTypeId = result[0].id;
                     }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.parentSectorId = result[0].id;
                     }
                     $scope.vm.form.childSectorId = "";
@@ -568,17 +568,17 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.childSectorId = result[0].id;
                     }
                 });
                 $scope.$on("regionEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.regionId = result[0].id;
                     }
                 });
                 $scope.$on("statusEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.statusId = result[0].id;
                     }
                 });
diff --git a/src/main/webapp/scripts/app/issue/issueModify.controller.js b/src/main/webapp/scripts/app/issue/issueModify.controller.js
index fbbc251..6d89d2b 100644
--- a/src/main/webapp/scripts/app/issue/issueModify.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueModify.controller.js
@@ -436,10 +436,12 @@
                 }
 
                 $scope.$on("companyTypeEvent", function (event, result) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.companyTypeId = result[0].id;
+                    }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.form.parentSectorId = result[0].id;
                     }
                     $scope.vm.form.childSectorId = "";
@@ -447,83 +449,91 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    $scope.vm.form.childSectorId = result[0].id;
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
+                        $scope.vm.form.childSectorId = result[0].id;
+                    }
                 });
                 $scope.$on("regionEvent", function (event, result) {
-                    $scope.vm.form.regionId = result[0].id;
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
+                        $scope.vm.form.regionId = result[0].id;
+                    }
                 });
                 $scope.$on("statusEvent", function (event, result) {
-                    $scope.vm.form.statusId = result[0].id;
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
+                        $scope.vm.form.statusId = result[0].id;
+                    }
                 });
 
                 // �뾽泥댁젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("companyFieldEvent", function (event, result) {
-                    var ispFieldVo = result[0].ispFieldVo;
-                    var hostingFieldVo = result[0].hostingFieldVo;
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
+                        var ispFieldVo = result[0].ispFieldVo;
+                        var hostingFieldVo = result[0].hostingFieldVo;
 
-                    $scope.vm.companyId = result[0].id;
-                    $scope.vm.companyName = result[0].name;
-                    $scope.vm.companyManager = result[0].manager;
-                    $scope.vm.companyTel = result[0].tel;
-                    $scope.vm.companyEmail = result[0].email;
-                    $scope.vm.companyUrl = result[0].url;
-                    $scope.vm.companyMemo = result[0].memo;
-                    $scope.vm.form.companyTypeId = result[0].companyTypeId;
-                    $scope.vm.form.parentSectorId = result[0].parentSectorId;
-                    $scope.vm.form.childSectorId = result[0].childSectorId;
-                    $scope.vm.form.regionId = result[0].regionId;
-                    $scope.vm.form.statusId = result[0].statusId;
-                    $scope.vm.form.companyType = result[0].companyTypeName;
-                    $scope.vm.form.parentSector = result[0].parentSectorName;
-                    $scope.vm.form.childSector = result[0].childSectorName;
-                    $scope.vm.form.region = result[0].regionName;
-                    $scope.vm.form.status = result[0].statusName;
+                        $scope.vm.companyId = result[0].id;
+                        $scope.vm.companyName = result[0].name;
+                        $scope.vm.companyManager = result[0].manager;
+                        $scope.vm.companyTel = result[0].tel;
+                        $scope.vm.companyEmail = result[0].email;
+                        $scope.vm.companyUrl = result[0].url;
+                        $scope.vm.companyMemo = result[0].memo;
+                        $scope.vm.form.companyTypeId = result[0].companyTypeId;
+                        $scope.vm.form.parentSectorId = result[0].parentSectorId;
+                        $scope.vm.form.childSectorId = result[0].childSectorId;
+                        $scope.vm.form.regionId = result[0].regionId;
+                        $scope.vm.form.statusId = result[0].statusId;
+                        $scope.vm.form.companyType = result[0].companyTypeName;
+                        $scope.vm.form.parentSector = result[0].parentSectorName;
+                        $scope.vm.form.childSector = result[0].childSectorName;
+                        $scope.vm.form.region = result[0].regionName;
+                        $scope.vm.form.status = result[0].statusName;
 
-                    $scope.vm.ispId = "";
-                    $scope.vm.ispName = "";
-                    $scope.vm.ispCode = "";
-                    $scope.vm.ispManager = "";
-                    $scope.vm.ispTel = "";
-                    $scope.vm.ispEmail = "";
-                    $scope.vm.ispUrl = "";
-                    $scope.vm.ispMemo = "";
+                        $scope.vm.ispId = "";
+                        $scope.vm.ispName = "";
+                        $scope.vm.ispCode = "";
+                        $scope.vm.ispManager = "";
+                        $scope.vm.ispTel = "";
+                        $scope.vm.ispEmail = "";
+                        $scope.vm.ispUrl = "";
+                        $scope.vm.ispMemo = "";
 
-                    $scope.vm.hostingId = "";
-                    $scope.vm.hostingName = "";
-                    $scope.vm.hostingCode = "";
-                    $scope.vm.hostingManager = "";
-                    $scope.vm.hostingTel = "";
-                    $scope.vm.hostingEmail = "";
-                    $scope.vm.hostingUrl = "";
-                    $scope.vm.hostingMemo = "";
+                        $scope.vm.hostingId = "";
+                        $scope.vm.hostingName = "";
+                        $scope.vm.hostingCode = "";
+                        $scope.vm.hostingManager = "";
+                        $scope.vm.hostingTel = "";
+                        $scope.vm.hostingEmail = "";
+                        $scope.vm.hostingUrl = "";
+                        $scope.vm.hostingMemo = "";
 
-                    if (ispFieldVo != null){
-                        $scope.vm.form.issueIspFields[0] = angular.copy(ispFieldVo);
-                        $scope.vm.ispId = ispFieldVo.id;
-                        $scope.vm.ispName = ispFieldVo.name;
-                        $scope.vm.ispCode = ispFieldVo.code;
-                        $scope.vm.ispManager = ispFieldVo.manager;
-                        $scope.vm.ispTel = ispFieldVo.tel;
-                        $scope.vm.ispEmail = ispFieldVo.email;
-                        $scope.vm.ispUrl = ispFieldVo.url;
-                        $scope.vm.ispMemo = ispFieldVo.memo;
-                    }
-                    if (hostingFieldVo != null){
-                        $scope.vm.form.issueHostingFields[0] = angular.copy(hostingFieldVo);
-                        $scope.vm.hostingId = hostingFieldVo.id;
-                        $scope.vm.hostingName = hostingFieldVo.name;
-                        $scope.vm.hostingCode = hostingFieldVo.code;
-                        $scope.vm.hostingManager = hostingFieldVo.manager;
-                        $scope.vm.hostingTel = hostingFieldVo.tel;
-                        $scope.vm.hostingEmail = hostingFieldVo.email;
-                        $scope.vm.hostingUrl = hostingFieldVo.url;
-                        $scope.vm.hostingMemo = hostingFieldVo.memo;
+                        if (ispFieldVo != null) {
+                            $scope.vm.form.issueIspFields[0] = angular.copy(ispFieldVo);
+                            $scope.vm.ispId = ispFieldVo.id;
+                            $scope.vm.ispName = ispFieldVo.name;
+                            $scope.vm.ispCode = ispFieldVo.code;
+                            $scope.vm.ispManager = ispFieldVo.manager;
+                            $scope.vm.ispTel = ispFieldVo.tel;
+                            $scope.vm.ispEmail = ispFieldVo.email;
+                            $scope.vm.ispUrl = ispFieldVo.url;
+                            $scope.vm.ispMemo = ispFieldVo.memo;
+                        }
+                        if (hostingFieldVo != null) {
+                            $scope.vm.form.issueHostingFields[0] = angular.copy(hostingFieldVo);
+                            $scope.vm.hostingId = hostingFieldVo.id;
+                            $scope.vm.hostingName = hostingFieldVo.name;
+                            $scope.vm.hostingCode = hostingFieldVo.code;
+                            $scope.vm.hostingManager = hostingFieldVo.manager;
+                            $scope.vm.hostingTel = hostingFieldVo.tel;
+                            $scope.vm.hostingEmail = hostingFieldVo.email;
+                            $scope.vm.hostingUrl = hostingFieldVo.url;
+                            $scope.vm.hostingMemo = hostingFieldVo.memo;
+                        }
                     }
                 });
 
                 // ISP�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.ispId = result[0].id;
                         $scope.vm.ispName = result[0].name;
                         $scope.vm.ispCode = result[0].code;
@@ -537,7 +547,7 @@
 
                 // �샇�뒪�똿�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    if ($rootScope.isDefined(result[0])) {
+                    if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) {
                         $scope.vm.hostingId = result[0].id;
                         $scope.vm.hostingName = result[0].name;
                         $scope.vm.hostingCode = result[0].code;
@@ -706,7 +716,8 @@
                             if ($scope.vm.form.issueCompanyFields != null && $scope.vm.form.issueCompanyFields.length > 0 ){
 
                                 var companyField = $scope.vm.form.issueCompanyFields[0];
-                                if (companyField.name !== $scope.vm.companyName) { //�궗�슜�옄媛� 吏곸젒 �뾽泥� 異붽� �븷 寃쎌슦
+                                //�궗�슜�옄媛� 吏곸젒 �뾽泥� 異붽� �븷 寃쎌슦
+                                if ($rootScope.isDefined(companyField) && companyField.name !== $scope.vm.companyName) {
                                     return issueCompanyFields;
                                 }
 
@@ -737,7 +748,8 @@
                                 || $scope.vm.form.issueIspFields != null && $scope.vm.form.issueIspFields.length > 0 ){
 
                                 var ispField = $scope.vm.form.issueIspFields[0];
-                                if (ispField.name !== $scope.vm.ispName) { //�궗�슜�옄媛� 吏곸젒 ISP 異붽� �븷 寃쎌슦
+                                //�궗�슜�옄媛� 吏곸젒 ISP 異붽� �븷 寃쎌슦
+                                if ($rootScope.isDefined(ispField) && ispField.name !== $scope.vm.ispName) {
                                     return issueIspFields;
                                 }
 
@@ -764,7 +776,8 @@
                                 || $scope.vm.form.issueHostingFields != null && $scope.vm.form.issueHostingFields.length > 0 ){
 
                                 var hostingField = $scope.vm.form.issueHostingFields[0];
-                                if (hostingField.name !== $scope.vm.hostingName) { //�궗�슜�옄媛� 吏곸젒 �샇�뒪�똿 異붽� �븷 寃쎌슦
+                                //�궗�슜�옄媛� 吏곸젒 �샇�뒪�똿 異붽� �븷 寃쎌슦
+                                if ($rootScope.isDefined(hostingField) && hostingField.name !== $scope.vm.hostingName) {
                                     return issueHostingFields;
                                 }
 

--
Gitblit v1.8.0