From 092cba95b42d200799c2d88140fb0f9026176f6d Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 수, 26 1월 2022 16:58:16 +0900
Subject: [PATCH] - 이슈 수정 시 대분류만 선택하고 수정 시 오류 해결 - 전체댓글+메일보기/하위이슈 댓글+메일보기 - 이슈 엑셀 임포트시 오류 해결

---
 src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java              |    8 
 src/main/webapp/scripts/app/issue/issueAddRelation.controller.js               |   54 ++++++----
 src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js      |   28 ++++-
 src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js         |   24 +++-
 src/main/webapp/scripts/app/issue/issueAddDown.controller.js                   |   54 ++++++----
 src/main/webapp/scripts/app/companyField/companyFieldImportExcel.controller.js |    4 
 src/main/webapp/scripts/app/issue/issueImportExcel.controller.js               |    8 -
 src/main/webapp/scripts/app/issue/issueAdd.controller.js                       |   52 ++++++----
 src/main/webapp/scripts/app/issue/issueModify.controller.js                    |   40 ++++---
 9 files changed, 167 insertions(+), 105 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
index da657dc..1168f58 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
@@ -359,14 +359,14 @@
                             if(useValue.equals(companyFieldVo.getUrl())) {
                                 companyField.put("companyId", companyField.get("id"));
                                 issueCompanyFields.add(companyField);
-                                if(companyFieldVo.getIspId() != null) {
+                                if(companyFieldVo.getIspId() != null && companyFieldVo.getIspId() != -1) {
                                     Map<String, Object> ispField = this.ispFieldService.find(companyFieldVo.getIspId());
                                     if (ispField != null) {
                                         ispField.put("ispId", ispField.get("id"));
                                         issueIspFields.add(ispField);
                                     }
                                 }
-                                if(companyFieldVo.getHostingId() != null) {
+                                if(companyFieldVo.getHostingId() != null && companyFieldVo.getHostingId() != -1) {
                                     Map<String, Object> hostingField = this.hostingFieldService.find(companyFieldVo.getHostingId());
                                     if (hostingField != null) {
                                         hostingField.put("hostingId", hostingField.get("id"));
@@ -3214,7 +3214,7 @@
                 this.issueCompanyRepository.saveAndFlush(issueCompany);
 
                 //  �뾽泥댁쓽 ISP媛� �엳�뒗 寃쎌슦 issueISP �벑濡�
-                if (companyField.getIspId() != null) {
+                if (companyField.getIspId() != null && companyField.getIspId() != -1) {
                     IspField ispField = this.ispFieldService.getIsp(companyField.getIspId());
                     IssueIsp issueIsp = ConvertUtil.copyProperties(ispField, IssueIsp.class);
                     issueIsp.setIspField(ispField);
@@ -3222,7 +3222,7 @@
                     this.issueIspRepository.saveAndFlush(issueIsp);
                 }
                 //  �뾽泥댁쓽 �샇�뒪�똿�씠 �엳�뒗 寃쎌슦 issueHosting �벑濡�
-                if (companyField.getHostingId() != null) {
+                if (companyField.getHostingId() != null && companyField.getHostingId() != -1) {
                     HostingField hostingField = this.hostingFieldService.getHosting(companyField.getHostingId());
                     IssueHosting issueHosting = ConvertUtil.copyProperties(hostingField, IssueHosting.class);
                     issueHosting.setHostingField(hostingField);
diff --git a/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js b/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js
index aaae690..238c910 100644
--- a/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js
+++ b/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js
@@ -140,15 +140,21 @@
                 }
 
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    $scope.vm.form.ispId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.ispId = result[0].id;
+                    }
                 });
 
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    $scope.vm.form.hostingId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.hostingId = result[0].id;
+                    }
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    $scope.vm.form.companyTypeId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.companyTypeId = result[0].id;
+                    }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
                     if ($rootScope.isDefined(result[0])) {
@@ -159,13 +165,19 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    $scope.vm.form.childSectorId = result[0].id;
+                    if ($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[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[0])) {
+                        $scope.vm.form.statusId = result[0].id;
+                    }
                 });
 
                 //  �뤌 �쟾�넚
diff --git a/src/main/webapp/scripts/app/companyField/companyFieldImportExcel.controller.js b/src/main/webapp/scripts/app/companyField/companyFieldImportExcel.controller.js
index 9d736c8..f670bfa 100644
--- a/src/main/webapp/scripts/app/companyField/companyFieldImportExcel.controller.js
+++ b/src/main/webapp/scripts/app/companyField/companyFieldImportExcel.controller.js
@@ -62,13 +62,13 @@
                                 SweetAlert.success($filter("translate")("companyField.succeededCompanyFieldRegistration"), result.data.message.message); // �벑濡� �꽦怨�
                                 $scope.fn.cancel();
                                 $rootScope.$broadcast("getCompanyFieldList");
+                                $rootScope.spinner = false;
                             }, 1000);
                         }
                         else {
                             SweetAlert.error($filter("translate")("companyField.failedCompanyFieldRegistration"), result.data.message.message); // �벑濡� �떎�뙣
+                            $rootScope.spinner = false;
                         }
-
-                        $rootScope.spinner = false;
                     });
                 }
 
diff --git a/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js b/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
index 90ab5c3..16ded64 100644
--- a/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
+++ b/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
@@ -144,15 +144,21 @@
                 }
 
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    $scope.vm.form.ispId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.ispId = result[0].id;
+                    }
                 });
 
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    $scope.vm.form.hostingId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.hostingId = result[0].id;
+                    }
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    $scope.vm.form.companyTypeId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.companyTypeId = result[0].id;
+                    }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
                     if ($rootScope.isDefined(result[0])) {
@@ -163,13 +169,19 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    $scope.vm.form.childSectorId = result[0].id;
+                    if ($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[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[0])) {
+                        $scope.vm.form.statusId = result[0].id;
+                    }
                 });
 
                 //  �뤌 �쟾�넚
@@ -184,7 +196,7 @@
                             var ispId = -1;
                             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) {
+                            }else if ($scope.vm.form.issueIspFields != null && $scope.vm.form.issueIspFields.length > 0) {
                                 ispId = $scope.vm.form.issueIspFields[0].id;
                             }
                             return ispId;
@@ -193,7 +205,7 @@
                             var hostingId = -1;
                             if ($scope.vm.form.hostingName !== "" && $scope.vm.form.hostingId !== null && $scope.vm.form.hostingId !== -1) {
                                 hostingId = $scope.vm.form.hostingId;
-                            }else if ($scope.vm.form.issueHostingFields != null) {
+                            }else if ($scope.vm.form.issueHostingFields != null && $scope.vm.form.issueHostingFields.length > 0) {
                                 hostingId = $scope.vm.form.issueHostingFields[0].id;
                             }
                             return hostingId;
diff --git a/src/main/webapp/scripts/app/issue/issueAdd.controller.js b/src/main/webapp/scripts/app/issue/issueAdd.controller.js
index 054abd1..e0ed432 100644
--- a/src/main/webapp/scripts/app/issue/issueAdd.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueAdd.controller.js
@@ -525,30 +525,36 @@
 
                 //ISP�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    $scope.vm.ispId = result[0].id;
-                    $scope.vm.ispName = result[0].name;
-                    $scope.vm.ispCode = result[0].code;
-                    $scope.vm.ispManager = result[0].manager;
-                    $scope.vm.ispTel = result[0].tel;
-                    $scope.vm.ispEmail = result[0].email;
-                    $scope.vm.ispUrl = result[0].url;
-                    $scope.vm.ispMemo = result[0].memo;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.ispId = result[0].id;
+                        $scope.vm.ispName = result[0].name;
+                        $scope.vm.ispCode = result[0].code;
+                        $scope.vm.ispManager = result[0].manager;
+                        $scope.vm.ispTel = result[0].tel;
+                        $scope.vm.ispEmail = result[0].email;
+                        $scope.vm.ispUrl = result[0].url;
+                        $scope.vm.ispMemo = result[0].memo;
+                    }
                 });
 
                 // �샇�뒪�똿�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    $scope.vm.hostingId = result[0].id;
-                    $scope.vm.hostingName = result[0].name;
-                    $scope.vm.hostingCode = result[0].code;
-                    $scope.vm.hostingManager = result[0].manager;
-                    $scope.vm.hostingTel = result[0].tel;
-                    $scope.vm.hostingEmail = result[0].email;
-                    $scope.vm.hostingUrl = result[0].url;
-                    $scope.vm.hostingMemo = result[0].memo;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.hostingId = result[0].id;
+                        $scope.vm.hostingName = result[0].name;
+                        $scope.vm.hostingCode = result[0].code;
+                        $scope.vm.hostingManager = result[0].manager;
+                        $scope.vm.hostingTel = result[0].tel;
+                        $scope.vm.hostingEmail = result[0].email;
+                        $scope.vm.hostingUrl = result[0].url;
+                        $scope.vm.hostingMemo = result[0].memo;
+                    }
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    $scope.vm.form.companyTypeId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.companyTypeId = result[0].id;
+                    }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
                     if ($rootScope.isDefined(result[0])) {
@@ -559,13 +565,19 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    $scope.vm.form.childSectorId = result[0].id;
+                    if ($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[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[0])) {
+                        $scope.vm.form.statusId = result[0].id;
+                    }
                 });
 
                 //  �뤌 �쟾�넚
diff --git a/src/main/webapp/scripts/app/issue/issueAddDown.controller.js b/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
index c0ac2c3..e68f2ac 100644
--- a/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueAddDown.controller.js
@@ -513,30 +513,36 @@
 
                 // ISP�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    $scope.vm.ispId = result[0].id;
-                    $scope.vm.ispName = result[0].name;
-                    $scope.vm.ispCode = result[0].code;
-                    $scope.vm.ispManager = result[0].manager;
-                    $scope.vm.ispTel = result[0].tel;
-                    $scope.vm.ispEmail = result[0].email;
-                    $scope.vm.ispUrl = result[0].url;
-                    $scope.vm.ispMemo = result[0].memo;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.ispId = result[0].id;
+                        $scope.vm.ispName = result[0].name;
+                        $scope.vm.ispCode = result[0].code;
+                        $scope.vm.ispManager = result[0].manager;
+                        $scope.vm.ispTel = result[0].tel;
+                        $scope.vm.ispEmail = result[0].email;
+                        $scope.vm.ispUrl = result[0].url;
+                        $scope.vm.ispMemo = result[0].memo;
+                    }
                 });
 
                 // �샇�뒪�똿�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    $scope.vm.hostingId = result[0].id;
-                    $scope.vm.hostingName = result[0].name;
-                    $scope.vm.hostingCode = result[0].code;
-                    $scope.vm.hostingManager = result[0].manager;
-                    $scope.vm.hostingTel = result[0].tel;
-                    $scope.vm.hostingEmail = result[0].email;
-                    $scope.vm.hostingUrl = result[0].url;
-                    $scope.vm.hostingMemo = result[0].memo;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.hostingId = result[0].id;
+                        $scope.vm.hostingName = result[0].name;
+                        $scope.vm.hostingCode = result[0].code;
+                        $scope.vm.hostingManager = result[0].manager;
+                        $scope.vm.hostingTel = result[0].tel;
+                        $scope.vm.hostingEmail = result[0].email;
+                        $scope.vm.hostingUrl = result[0].url;
+                        $scope.vm.hostingMemo = result[0].memo;
+                    }
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    $scope.vm.form.companyTypeId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.companyTypeId = result[0].id;
+                    }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
                     if ($rootScope.isDefined(result[0])) {
@@ -547,13 +553,19 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    $scope.vm.form.childSectorId = result[0].id;
+                    if ($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[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[0])) {
+                        $scope.vm.form.statusId = result[0].id;
+                    }
                 });
 
                 //  �뤌 �쟾�넚
@@ -640,7 +652,7 @@
 
                         companyId : (function () {
                             var companyId = -1;
-                            if ($scope.vm.form.issueCompanyFields.length > 0) {
+                            if ($scope.vm.form.issueCompanyFields != null && $scope.vm.form.issueCompanyFields.length > 0) {
                                 companyId = $scope.vm.form.issueCompanyFields[0].id;
                             }
                             return companyId;
diff --git a/src/main/webapp/scripts/app/issue/issueAddRelation.controller.js b/src/main/webapp/scripts/app/issue/issueAddRelation.controller.js
index feda0af..5fc35f8 100644
--- a/src/main/webapp/scripts/app/issue/issueAddRelation.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueAddRelation.controller.js
@@ -528,30 +528,36 @@
 
                 // ISP�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    $scope.vm.ispId = result[0].id;
-                    $scope.vm.ispName = result[0].name;
-                    $scope.vm.ispCode = result[0].code;
-                    $scope.vm.ispManager = result[0].manager;
-                    $scope.vm.ispTel = result[0].tel;
-                    $scope.vm.ispEmail = result[0].email;
-                    $scope.vm.ispUrl = result[0].url;
-                    $scope.vm.ispMemo = result[0].memo;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.ispId = result[0].id;
+                        $scope.vm.ispName = result[0].name;
+                        $scope.vm.ispCode = result[0].code;
+                        $scope.vm.ispManager = result[0].manager;
+                        $scope.vm.ispTel = result[0].tel;
+                        $scope.vm.ispEmail = result[0].email;
+                        $scope.vm.ispUrl = result[0].url;
+                        $scope.vm.ispMemo = result[0].memo;
+                    }
                 });
 
                 // �샇�뒪�똿�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    $scope.vm.hostingId = result[0].id;
-                    $scope.vm.hostingName = result[0].name;
-                    $scope.vm.hostingCode = result[0].code;
-                    $scope.vm.hostingManager = result[0].manager;
-                    $scope.vm.hostingTel = result[0].tel;
-                    $scope.vm.hostingEmail = result[0].email;
-                    $scope.vm.hostingUrl = result[0].url;
-                    $scope.vm.hostingMemo = result[0].memo;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.hostingId = result[0].id;
+                        $scope.vm.hostingName = result[0].name;
+                        $scope.vm.hostingCode = result[0].code;
+                        $scope.vm.hostingManager = result[0].manager;
+                        $scope.vm.hostingTel = result[0].tel;
+                        $scope.vm.hostingEmail = result[0].email;
+                        $scope.vm.hostingUrl = result[0].url;
+                        $scope.vm.hostingMemo = result[0].memo;
+                    }
                 });
 
                 $scope.$on("companyTypeEvent", function (event, result) {
-                    $scope.vm.form.companyTypeId = result[0].id;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.form.companyTypeId = result[0].id;
+                    }
                 });
                 $scope.$on("parentSectorEvent", function (event, result) {
                     if ($rootScope.isDefined(result[0])) {
@@ -562,13 +568,19 @@
                     $scope.vm.form.childSectors = [];
                 });
                 $scope.$on("childSectorEvent", function (event, result) {
-                    $scope.vm.form.childSectorId = result[0].id;
+                    if ($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[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[0])) {
+                        $scope.vm.form.statusId = result[0].id;
+                    }
                 });
 
                 //  �뤌 �쟾�넚
@@ -655,7 +667,7 @@
 
                         companyId : (function () {
                             var companyId = -1;
-                            if ($scope.vm.form.issueCompanyFields.length > 0) {
+                            if ($scope.vm.form.issueCompanyFields != null && $scope.vm.form.issueCompanyFields.length > 0) {
                                 companyId = $scope.vm.form.issueCompanyFields[0].id;
                             }
                             return companyId;
diff --git a/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js b/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
index 3ce4cb6..555dd12 100644
--- a/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
@@ -135,21 +135,19 @@
                             }
                         },
                         fileFormDataName : "file"
-                    })
-                        .then(function (result) {
+                    }).then(function (result) {
                             if (result.data.message.status === "success") {
-
                                 $timeout(function () {
                                     SweetAlert.success($filter("translate")("issue.succeededIssueRegistration"), result.data.message.message); // �씠�뒋 �벑濡� �꽦怨�
                                     $scope.fn.cancel();
                                     $rootScope.$broadcast("getIssueList");
+                                    $rootScope.spinner = false;
                                 }, 1000);
                             }
                             else {
                                 SweetAlert.error($filter("translate")("issue.failedIssueRegistration"), result.data.message.message); // �씠�뒋 �벑濡� �떎�뙣
+                                $rootScope.spinner = false;
                             }
-
-                            $rootScope.spinner = false;
                         });
                 }
 
diff --git a/src/main/webapp/scripts/app/issue/issueModify.controller.js b/src/main/webapp/scripts/app/issue/issueModify.controller.js
index 49428eb..cf0dc79 100644
--- a/src/main/webapp/scripts/app/issue/issueModify.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueModify.controller.js
@@ -523,26 +523,30 @@
 
                 // ISP�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("ispFieldEvent", function (event, result) {
-                    $scope.vm.ispId = result[0].id;
-                    $scope.vm.ispName = result[0].name;
-                    $scope.vm.ispCode = result[0].code;
-                    $scope.vm.ispManager = result[0].manager;
-                    $scope.vm.ispTel = result[0].tel;
-                    $scope.vm.ispEmail = result[0].email;
-                    $scope.vm.ispUrl = result[0].url;
-                    $scope.vm.ispMemo = result[0].memo;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.ispId = result[0].id;
+                        $scope.vm.ispName = result[0].name;
+                        $scope.vm.ispCode = result[0].code;
+                        $scope.vm.ispManager = result[0].manager;
+                        $scope.vm.ispTel = result[0].tel;
+                        $scope.vm.ispEmail = result[0].email;
+                        $scope.vm.ispUrl = result[0].url;
+                        $scope.vm.ispMemo = result[0].memo;
+                    }
                 });
 
                 // �샇�뒪�똿�젙蹂� 寃곌낵 媛� Event 泥섎━(set)
                 $scope.$on("hostingFieldEvent", function (event, result) {
-                    $scope.vm.hostingId = result[0].id;
-                    $scope.vm.hostingName = result[0].name;
-                    $scope.vm.hostingCode = result[0].code;
-                    $scope.vm.hostingManager = result[0].manager;
-                    $scope.vm.hostingTel = result[0].tel;
-                    $scope.vm.hostingEmail = result[0].email;
-                    $scope.vm.hostingUrl = result[0].url;
-                    $scope.vm.hostingMemo = result[0].memo;
+                    if ($rootScope.isDefined(result[0])) {
+                        $scope.vm.hostingId = result[0].id;
+                        $scope.vm.hostingName = result[0].name;
+                        $scope.vm.hostingCode = result[0].code;
+                        $scope.vm.hostingManager = result[0].manager;
+                        $scope.vm.hostingTel = result[0].tel;
+                        $scope.vm.hostingEmail = result[0].email;
+                        $scope.vm.hostingUrl = result[0].url;
+                        $scope.vm.hostingMemo = result[0].memo;
+                    }
                 });
 
                 function formSubmit() {
@@ -639,7 +643,7 @@
                         companyId : (function () {
                             var companyId = -1;
 
-                            if ($scope.vm.form.issueCompanyFields.length > 0) {
+                            if ($scope.vm.form.issueCompanyFields != null && $scope.vm.form.issueCompanyFields.length > 0) {
                                 companyId = $scope.vm.form.issueCompanyFields[0].id;
                             }
 
@@ -649,7 +653,7 @@
                         ispId : (function () {
                             var ispId = -1;
 
-                            if ($scope.vm.form.issueIspFields.length > 0) {
+                            if ($scope.vm.form.issueIspFields != null && $scope.vm.form.issueIspFields.length > 0) {
                                 ispId = $scope.vm.form.issueIspFields[0].id;
                             }
 

--
Gitblit v1.8.0