From 64c34c4b11796c5517d60971e1768aa22aaa6deb Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 수, 26 1월 2022 17:43:36 +0900
Subject: [PATCH] 업체 수정 시 오류 해결

---
 src/main/webapp/scripts/app/issue/issueModify.controller.js |   56 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 30 insertions(+), 26 deletions(-)

diff --git a/src/main/webapp/scripts/app/issue/issueModify.controller.js b/src/main/webapp/scripts/app/issue/issueModify.controller.js
index 49428eb..fbbc251 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() {
@@ -560,7 +564,7 @@
                         companyMemo : $scope.vm.companyMemo,
 
                         companyTypeId : (function () {
-                            var companyTypeId = -1;
+                            var companyTypeId = null;
                             if ($scope.vm.form.companyTypes != null && $scope.vm.form.companyTypes.length > 0) {
                                 companyTypeId = $scope.vm.form.companyTypes[0].id;
                             } else {
@@ -569,7 +573,7 @@
                             return companyTypeId;
                         })(),
                         parentSectorId : (function () {
-                            var parentSectorId = -1;
+                            var parentSectorId = null;
                             if ($scope.vm.form.parentSectors != null && $scope.vm.form.parentSectors.length > 0) {
                                 parentSectorId = $scope.vm.form.parentSectors[0].id;
                             } else {
@@ -578,7 +582,7 @@
                             return parentSectorId;
                         })(),
                         childSectorId : (function () {
-                            var childSectorId = -1;
+                            var childSectorId = null;
                             if ($scope.vm.form.childSectors != null && $scope.vm.form.childSectors.length > 0) {
                                 childSectorId = $scope.vm.form.childSectors[0].id;
                             } else {
@@ -587,7 +591,7 @@
                             return childSectorId;
                         })(),
                         regionId : (function () {
-                            var regionId = -1;
+                            var regionId = null;
                             if ($scope.vm.form.regions != null && $scope.vm.form.regions.length > 0) {
                                 regionId = $scope.vm.form.regions[0].id;
                             } else {
@@ -596,7 +600,7 @@
                             return regionId;
                         })(),
                         statusId : (function () {
-                            var statusId = -1;
+                            var statusId = null;
                             if ($scope.vm.form.statuses != null && $scope.vm.form.statuses.length > 0) {
                                 statusId = $scope.vm.form.statuses[0].id;
                             } else {
@@ -637,9 +641,9 @@
                         issueStatusId : $scope.vm.form.issueStatusId,   //  �씠�뒋 �긽�깭 �븘�씠�뵒
 
                         companyId : (function () {
-                            var companyId = -1;
+                            var companyId = null;
 
-                            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;
                             }
 
@@ -647,9 +651,9 @@
                         }),
 
                         ispId : (function () {
-                            var ispId = -1;
+                            var ispId = null;
 
-                            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;
                             }
 
@@ -657,7 +661,7 @@
                         }),
 
                         hostingId : (function () {
-                            var hostingId = -1;
+                            var hostingId = null;
 
                             if ($scope.vm.form.issueHostingFields != null && $scope.vm.form.issueHostingFields.length > 0) {
                                 hostingId = $scope.vm.form.issueHostingFields[0].id;

--
Gitblit v1.8.0