From: Jason Etheridge Date: Fri, 14 Apr 2017 13:53:47 +0000 (-0400) Subject: webstaff: provide MVR's for use with Print Labels X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=52376f79f6809195c463dcad177e6473e1a0fc25;p=working%2FEvergreen.git webstaff: provide MVR's for use with Print Labels better than super simple record, but Display Fields will be better yet later on Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_item_label.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_item_label.tt2 index fed5e331d1..0480193a53 100644 --- a/Open-ILS/src/templates/staff/share/print_templates/t_item_label.tt2 +++ b/Open-ILS/src/templates/staff/share/print_templates/t_item_label.tt2 @@ -10,6 +10,15 @@ with a variety of keys, including call_number.label location.name +There are also utility functions: + + get_cn_for(copy) -> returns the formatted call number from the + Call Number Template and Call Numbers tab + + get_bib_for(copy) -> returns an "MVR" with keys like title, + author, publisher, pubdate, series, + edition, and isbn + Line-wrapping may be done with the | wrap filter. The first parameter is the number of characters to target for the string width. The second parameter is the wrapping algorithm to use. @@ -67,8 +76,8 @@ Certain library settings are also available:
 {{copy.barcode}}
 {{copy['call_number.label']}}
-{{copy['call_number.record.simple_record.author']}}
-{{copy['call_number.record.simple_record.title'] | wrap:28:'once':' '}}
+{{get_bib_for(copy).author }}
+{{get_bib_for(copy).title | wrap:28:'once':' '}}
 
diff --git a/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js b/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js index 15a6a7413c..1815652a20 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js @@ -130,7 +130,11 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , return '...'; } } + ,'get_bib_for' : function(copy) { + return $scope.record_details[copy['call_number.record.id']]; + } }; + $scope.record_details = {}; var promises = []; @@ -157,20 +161,37 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , angular.forEach(data.copies, function(copy) { promises.push( itemSvc.fetch(null,copy).then(function(res) { - $scope.preview_scope.copies.push(egCore.idl.toHash(res.copy, true)); + var flat_copy = egCore.idl.toHash(res.copy, true); + $scope.preview_scope.copies.push(flat_copy); + $scope.record_details[ flat_copy['call_number.record.id'] ] = 1; }) ) }); $q.all(promises).then(function() { - // today, staff, current_location, etc. - egCore.print.fleshPrintScope($scope.preview_scope); - - $scope.template_changed(); // load the default - $scope.rebuild_cn_set(); + var promises2 = []; + angular.forEach($scope.record_details, function(el,k,obj) { + promises2.push( + egNet.request( + 'open-ils.search', + 'open-ils.search.biblio.record.mods_slim.retrieve.authoritative', + k + ).then(function (data) { + obj[k] = egCore.idl.toHash(data, true); + }) + ); + }); + + $q.all(promises2).then(function() { + // today, staff, current_location, etc. + egCore.print.fleshPrintScope($scope.preview_scope); + console.log($scope.record_details); + $scope.template_changed(); // load the default + $scope.rebuild_cn_set(); + }); - }) + }); } else { ngToast.danger(egCore.strings.KEY_EXPIRED); }