LP#1778571 Fix logic error converting JS bool to DB bool
[evergreen-equinox.git] / Open-ILS / web / js / ui / default / staff / cat / volcopy / app.js
index 0928b7c..4b74018 100644 (file)
@@ -1173,6 +1173,19 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
         statcat_filter: undefined
     };
 
+    // Returns true if we are editing multiple copies and at least
+    // one field contains multiple values.
+    $scope.hasMulti = function() {
+        var keys = Object.keys($scope.working.MultiMap);
+        // for-loop for shortcut exit
+        for (var i = 0; i < keys.length; i++) {
+            if ($scope.working.MultiMap[keys[i]].length > 1) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     $scope.copyAlertUpdate = function (alerts) {
         if (!$scope.in_item_select &&
             $scope.workingGridControls &&
@@ -1989,7 +2002,20 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                             }
                         });
                     } else {
-                        $timeout(function(){$window.close()});
+                        $timeout(function(){
+                            if (typeof BroadcastChannel != 'undefined') {
+                                var bChannel = new BroadcastChannel("eg.holdings.update");
+                                var bre_ids = cnList && cnList.length > 0 ? cnList.map(function(cn){ return Number(cn.record()) }) : [];
+                                var cn_ids = cnList && cnList.length > 0 ? cnList.map(function(cn){ return cn.id() }) : [];
+                                bChannel.postMessage({
+                                    copies : copy_ids,
+                                    volumes: cn_ids,
+                                    records: bre_ids
+                                });
+                            }
+
+                            $window.close();
+                        });
                     }
                 }
             });
@@ -2066,7 +2092,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                             var n = new egCore.idl.acpn();
                             n.isnew(1);
                             n.creator(note.creator);
-                            n.pub(note.pub);
+                            n.pub(note.pub ? 't' : 'f');
                             n.title(note.title);
                             n.value(note.value);
                             n.owning_copy(cp.id());
@@ -2136,7 +2162,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                         { order_by : { 'acpt' : ['label'] } }, { atomic: true }
                     ).then(function(list) {
                         return list.map(function(item) {
-                            return item.label();
+                            return item.label() + " (" + egCore.org.get(item.owner()).shortname() + ")";
                         });
                     });
                 }