diff --git a/modules/portal/public/lib/controllers/controller.records.js b/modules/portal/public/lib/controllers/controller.records.js index 5e5e50b77..9be6b0fda 100644 --- a/modules/portal/public/lib/controllers/controller.records.js +++ b/modules/portal/public/lib/controllers/controller.records.js @@ -191,7 +191,11 @@ angular.module('controller.records', []) $scope.editRecord = function(record) { $scope.currentRecord = angular.copy(record); - $scope.currentRecord.recordSetGroupChange = angular.copy(record.recordSetGroupChange); + if ($scope.currentRecord.recordSetGroupChange == undefined){ + $scope.currentRecord.recordSetGroupChange = {} + $scope.currentRecord.recordSetGroupChange.requestedOwnerGroupId = angular.copy(record.ownerGroupId); + $scope.currentRecord.recordSetGroupChange.ownerShipTransferStatus = angular.copy("AutoApproved"); + } getGroup($scope.currentRecord.recordSetGroupChange.requestedOwnerGroupId); $scope.recordModal = { previous: angular.copy(record), @@ -208,7 +212,12 @@ angular.module('controller.records', []) $scope.requestOwnerShip = function(record) { $scope.currentRecord = angular.copy(record); - $scope.currentRecord.recordSetGroupChange.ownerShipTransferStatus = angular.copy("AutoApproved") + if ($scope.currentRecord.recordSetGroupChange == undefined){ + $scope.currentRecord.recordSetGroupChange = {} + $scope.currentRecord.recordSetGroupChange.requestedOwnerGroupId = angular.copy(record.ownerGroupId); + $scope.currentRecord.recordSetGroupChange.ownerShipTransferStatus = angular.copy("AutoApproved"); + } + $scope.currentRecord.recordSetGroupChange.ownerShipTransferStatus = angular.copy("AutoApproved"); $scope.recordModal = { action: $scope.recordModalState.UPDATE, title: "Request OwnerShip transfer", @@ -224,6 +233,11 @@ angular.module('controller.records', []) $scope.requestOwnerShipTransfer = function(record, isOwnerShipRequest) { $scope.currentRecord = angular.copy(record); + if ($scope.currentRecord.recordSetGroupChange == undefined){ + $scope.currentRecord.recordSetGroupChange = {} + $scope.currentRecord.recordSetGroupChange.requestedOwnerGroupId = angular.copy(record.ownerGroupId); + $scope.currentRecord.recordSetGroupChange.ownerShipTransferStatus = angular.copy("AutoApproved"); + } $scope.currentRecord.recordSetGroupChange = angular.copy(record.recordSetGroupChange); $scope.recordModal = { previous: angular.copy(record), @@ -331,7 +345,7 @@ angular.module('controller.records', []) record.recordSetGroupChange.requestedOwnerGroupId = angular.copy(record.ownerGroupId); record.recordSetGroupChange.ownerShipTransferStatus = angular.copy("ManuallyApproved"); } - } + } else {record.recordSetGroupChange.requestedOwnerGroupId = angular.copy(record.ownerGroupId);} record['onlyFour'] = true; if ($scope.addRecordForm.$valid) { updateRecordSet(record);