webstaff: grab default call number from bib when creating volume
authorGalen Charlton <gmc@esilibrary.com>
Tue, 26 Jan 2016 19:06:57 +0000 (14:06 -0500)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:54 +0000 (14:58 -0500)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 7b72add..f347be7 100644 (file)
@@ -1091,7 +1091,23 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                                 cn.label_class( $scope.defaults.classification || 1 );
                                 cn.owning_lib( proto.owner || egCore.auth.user().ws_ou() );
                                 cn.record( $scope.record_id );
-                                if (proto.label) cn.label( proto.label );
+                                if (proto.label) {
+                                     cn.label( proto.label );
+                                } else {
+                                    egCore.net.request(
+                                        'open-ils.cat',
+                                        'open-ils.cat.biblio.record.marc_cn.retrieve',
+                                        $scope.record_id,
+                                        $scope.defaults.classification || 1
+                                    ).then(function(cn_array) {
+                                        if (cn_array.length > 0) {
+                                            for (var field in cn_array[0]) {
+                                                cn.label( cn_array[0][field] );
+                                                break;
+                                            }
+                                        }
+                                    });
+                                } 
 
                                 var cp = new egCore.idl.acp();
                                 cp.call_number( cn );