LP#1830394: remove console noise from the holdings editor
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 24 May 2019 15:06:04 +0000 (11:06 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 3 Jul 2019 14:49:39 +0000 (10:49 -0400)
This patch removes browser console noise that occurs (among other
places) when moving a working item to the completed list in
the holdings editor

TypeError: "$scope.working.MultiMap[keys[i]] is undefined"
    hasMulti https://evergreen.example.org/js/ui/default/staff/cat/volcopy/app.js:1203
    ...

To test
-------
[1] Open the holdings editor to add or edit an item, then open the
    browser debug console.
[2] Make a change and move the item from working to complete. Note
    that the error message above shows up repeated in the
    console log.
[3] Apply the patch and repeat steps 1 and 2. This time, the errors
    should not appear.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 80d2a37..79dbf81 100644 (file)
@@ -1417,10 +1417,11 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
 
         $scope.clearWorking = function () {
             angular.forEach($scope.working, function (v,k,o) {
+                if (k != 'MultiMap') $scope.working.MultiMap[k] = [];
                 if (!angular.isObject(v)) {
                     if (typeof v != 'undefined')
                         $scope.working[k] = undefined;
-                } else if (k != 'circ_lib') {
+                } else if (k != 'circ_lib' && k != 'MultiMap') {
                     angular.forEach(v, function (sv,sk) {
                         if (typeof v != 'undefined')
                             $scope.working[k][sk] = undefined;
@@ -2566,11 +2567,12 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
 
                 $scope.clearWorking = function () {
                     angular.forEach($scope.working, function (v,k,o) {
+                        if (k != 'MultiMap') $scope.working.MultiMap[k] = [];
                         $scope.working.MultiMap[k] = [];
                         if (!angular.isObject(v)) {
                             if (typeof v != 'undefined')
                                 $scope.working[k] = undefined;
-                        } else if (k != 'circ_lib') {
+                        } else if (k != 'circ_lib' && k != 'MultiMap') {
                             angular.forEach(v, function (sv,sk) {
                                 $scope.working[k][sk] = undefined;
                             });