From f8225787365305ef86a88bcd35f25877280c6008 Mon Sep 17 00:00:00 2001 From: Adam Bowling Date: Tue, 3 Sep 2019 01:00:11 -0400 Subject: [PATCH] Cumulative fixes to label printing issues, including correct display of long call numbers, ability to edit unique call numbers, and inherited sorting from page feeding call number printout. Signed-off-by: Adam Bowling --- .../src/templates/staff/cat/printlabels/t_view.tt2 | 253 ++++++++++------- .../web/js/ui/default/staff/cat/bucket/copy/app.js | 50 ++-- .../web/js/ui/default/staff/cat/catalog/app.js | 79 +++--- Open-ILS/web/js/ui/default/staff/cat/item/app.js | 189 ++----------- .../web/js/ui/default/staff/cat/printlabels/app.js | 299 +++++++++------------ .../web/js/ui/default/staff/cat/volcopy/app.js | 90 ++----- .../web/js/ui/default/staff/circ/checkin/app.js | 32 +-- 7 files changed, 408 insertions(+), 584 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2 b/Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2 index 791091e187..e4e25a8b8f 100644 --- a/Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2 +++ b/Open-ILS/src/templates/staff/cat/printlabels/t_view.tt2 @@ -1,38 +1,95 @@ - -
-
- [% l('Print Item Labels') %] -
-
-
-
-
- [% l('Template') %] - -
-
-
- -
-
-
- [% l('Printer') %] - +

[% l('Print Item Labels') %]

+ +
+
+
+
+ [% l('Template') %] +
+
+ +
+
+ +
+
+ [% l('Printer') %] +
+
+ +
@@ -128,127 +185,118 @@ [% l('Manual adjustments may be made here. These do not get saved with templates.') %]
-
-
- [% l('*All settings will be saved with templates') %] + *All settings will be saved with templates
-
-
-

Font & Label Settings

+
[% l('These settings do get saved with templates and will override corresponding Library Settings.') %]
-
-
-
-
+
+
+
+
{{s.label}}
-
-
-
+
+
+
{{s.description}}
+
+
@@ -275,3 +323,4 @@ label. Use pocket label left margin to identify how much space to provide betwee
+ diff --git a/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js b/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js index e5cc7f4738..1921488694 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js @@ -560,13 +560,6 @@ function($scope, $q , $routeParams , $timeout , $window , $uibModal , bucketSvc bucketSvc.bucketNeedsRefresh = true; return $q.all(promises).then(drawBucket); } - - $scope.moveToPending = function(copies) { - angular.forEach(copies, function(copy) { - bucketSvc.pendingList.push(copy.id); - }); - $scope.detachCopies(copies); - } $scope.spawnHoldingsEdit = function (copies) { var cp_list = [] @@ -594,23 +587,40 @@ function($scope, $q , $routeParams , $timeout , $window , $uibModal , bucketSvc } $scope.print_labels = function() { - var cp_list = [] + var cp_list = []; console.log($scope.gridControls.selectedItems()); angular.forEach($scope.gridControls.selectedItems(), function (i) { cp_list.push(i.id); }) + var cp_full = [], promises = []; + promises.push( + egCore.pcrud.search('ccbi', { bucket: bucketSvc.currentBucket.a[2], "target_copy": { "in": cp_list } }).then( + null + , null + , function (ccbi) { + cp_full.push(egCore.idl.toHash(ccbi, true)); + } + ) + ); - egCore.net.request( - 'open-ils.actor', - 'open-ils.actor.anon_cache.set_value', - null, 'print-labels-these-copies', { - copies : cp_list - } - ).then(function(key) { - if (key) { - var url = egCore.env.basePath + 'cat/printlabels/' + key; - $timeout(function() { $window.open(url, '_blank') }); + $q.all(promises).then(function () { + // console.log(cp_full); + if (cp_full.length > 0) { + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.anon_cache.set_value', + null, 'print-labels-these-copies', { + copies : cp_list + } + ).then(function(key) { + if (key) { + var url = egCore.env.basePath + 'cat/printlabels/' + key; + $timeout(function() { $window.open(url, '_blank') }); + } else { + alert('Could not create anonymous cache key!'); + } + }); } else { - alert('Could not create anonymous cache key!'); + alert('Could not create print label export.'); } }); } @@ -618,7 +628,7 @@ function($scope, $q , $routeParams , $timeout , $window , $uibModal , bucketSvc $scope.requestItems = function() { var copy_list = $scope.gridControls.selectedItems().map( function (i) { - return i.id; + i.id; } ); var record_list = $scope.gridControls.selectedItems().map( diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index f474dc4401..3e7dd07da4 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -181,29 +181,24 @@ function($scope , $routeParams , $location , $q , egCore ) { .then(function(resp) { // get_barcodes - if (resp.count) { - return $q.when(resp); - } else { - // Search again including deleted records - return egCore.net.request('open-ils.search', - 'open-ils.search.biblio.tcn', args.record_tcn, true); + if (evt = egCore.evt.parse(resp)) { + alert(evt); // FIXME + return; } - }).then(function(resp2) { - - if (!resp2.count) { + if (!resp.count) { $scope.recordNotFound = args.record_tcn; $scope.selectMe = true; return; } - if (resp2.count > 1) { + if (resp.count > 1) { $scope.moreRecordsFound = args.record_tcn; $scope.selectMe = true; return; } - var record_id = resp2.ids[0]; + var record_id = resp.ids[0]; return loadRecord(record_id); }); } @@ -648,7 +643,6 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e $scope.conjoinedGridDataProvider.refresh(); }); init_parts_url(); - $scope.grid_actions.refresh(); $location.update_path('/cat/catalog/record/' + $scope.record_id); // update_path() bypasses the controller for path // /cat/catalog/record/:record_id. Manually set title here too. @@ -1632,20 +1626,26 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e } $scope.selectedHoldingsPrintLabels = function() { - egCore.net.request( - 'open-ils.actor', - 'open-ils.actor.anon_cache.set_value', - null, 'print-labels-these-copies', { - copies : gatherSelectedHoldingsIds() - } - ).then(function(key) { - if (key) { - var url = egCore.env.basePath + 'cat/printlabels/' + key; - $timeout(function() { $window.open(url, '_blank') }); - } else { - alert('Could not create anonymous cache key!'); - } - }); + var cp_list = gatherSelectedHoldingsIds(); + var cp_full = [], promises = []; + if (cp_list.length > 0) { + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.anon_cache.set_value', + null, 'print-labels-these-copies', { + copies : cp_list + } + ).then(function(key) { + if (key) { + var url = egCore.env.basePath + 'cat/printlabels/' + key; + $timeout(function() { $window.open(url, '_blank') }); + } else { + alert('Could not create anonymous cache key!'); + } + }); + } else { + alert('Could not create print label export.'); + } } $scope.selectedHoldingsDamaged = function () { @@ -1665,26 +1665,12 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e }); } - $scope.selectedHoldingsDiscard = function () { - var copy_list = gatherSelectedRawCopies(); - if (copy_list.length == 0) return; - egCirc.mark_discard(copy_list.map(function(cp) { - return {id: cp.id(), barcode: cp.barcode()};})).then(function() { - holdingsSvcInst.fetchAgain().then(function() { - $scope.holdingsGridDataProvider.refresh(); - }); - }); - } - $scope.selectedHoldingsMissing = function () { - var copy_list = gatherSelectedRawCopies(); - if (copy_list.length == 0) return; - egCirc.mark_missing(copy_list.map(function(cp) { - return {id: cp.id(), barcode: cp.barcode()};})).then(function() { - holdingsSvcInst.fetchAgain().then(function() { - $scope.holdingsGridDataProvider.refresh(); - }); + egCirc.mark_missing(gatherSelectedHoldingsIds()).then(function() { + holdingsSvcInst.fetchAgain().then(function() { + $scope.holdingsGridDataProvider.refresh(); }); + }); } $scope.selectedHoldingsCopyAlertsAdd = function() { @@ -1748,14 +1734,13 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e // ------------------------------------------------------------------ // Holds var provider = egGridDataProvider.instance({}); - var holds = []; // current list of holds - var hold_count = 0; - $scope.hold_grid_data_provider = provider; $scope.grid_actions = egHoldGridActions; $scope.grid_actions.refresh = function () { holds = []; hold_count = 0; provider.refresh() }; $scope.hold_grid_controls = {}; + var holds = []; // current list of holds + var hold_count = 0; provider.get = function(offset, count) { if ($scope.record_tab != 'holds') return $q.when(); diff --git a/Open-ILS/web/js/ui/default/staff/cat/item/app.js b/Open-ILS/web/js/ui/default/staff/cat/item/app.js index 857e522c0f..0b593dfc7f 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/item/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/item/app.js @@ -52,8 +52,8 @@ angular.module('egItemStatus', * Parent scope for list and detail views */ .controller('SearchCtrl', - ['$scope','$q','$window','$location','$timeout','egCore','egNet','egGridDataProvider','egItem', 'egCirc', -function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc , egCirc) { + ['$scope','$location','$timeout','egCore','egGridDataProvider','egItem', +function($scope , $location , $timeout , egCore , egGridDataProvider , itemSvc) { $scope.args = {}; // search args // sub-scopes (search / detail-view) apply their version @@ -86,15 +86,6 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD itemSvc.add_copies_to_bucket([$scope.args.copyId]); } - $scope.show_in_catalog = function() { - window.open('/eg/staff/cat/catalog/record/' + $scope.args.recordId + '/catalog', '_blank'); - } - - $scope.print_labels = function() { - itemSvc.print_spine_labels([$scope.args.copyId]); - } - - $scope.make_copies_bookable = function() { itemSvc.make_copies_bookable([{ id : $scope.args.copyId, @@ -145,41 +136,6 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD itemSvc.manage_reservations([$scope.args.copyBarcode]); } - $scope.findAcquisition = function() { - var acqData; - var promises = []; - $scope.openAcquisitionLineItem([$scope.args.copyId]); - } - - $scope.openAcquisitionLineItem = function (cp_list) { - var hasResults = false; - var promises = []; - - angular.forEach(cp_list, function (copyId) { - promises.push( - egNet.request( - 'open-ils.acq', - 'open-ils.acq.lineitem.retrieve.by_copy_id', - egCore.auth.token(), - copyId - ).then(function (acqData) { - if (acqData) { - if (acqData.a) { - acqData = egCore.idl.toHash(acqData); - var url = '/eg/acq/po/view/' + acqData.purchase_order + '/' + acqData.id; - $timeout(function () { $window.open(url, '_blank') }); - hasResults = true; - } - } - }) - ) - }); - - $q.all(promises).then(function () { - !hasResults ? alert('There is no corresponding purchase order for this item.') : false; - }); - } - $scope.requestItems = function() { itemSvc.requestItems([$scope.args.copyId],[$scope.args.recordId]); } @@ -191,27 +147,6 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD }); } - $scope.show_triggered_events = function() { - $location.path('/cat/item/' + $scope.args.copyId + '/triggered_events'); - } - - $scope.show_item_holds = function() { - $location.path('/cat/item/' + $scope.args.copyId + '/holds'); - } - - $scope.show_record_holds = function() { - window.open('/eg/staff/cat/catalog/record/' + $scope.args.recordId + '/holds', '_blank'); - } - - $scope.add_item_alerts = function() { - egCirc.add_copy_alerts([$scope.args.copyId]); - } - - $scope.manage_item_alerts = function() { - egCirc.manage_copy_alerts([$scope.args.copyId]); - } - - $scope.attach_to_peer_bib = function() { itemSvc.attach_to_peer_bib([{ id : $scope.args.copyId, @@ -255,17 +190,10 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD }]); } - $scope.selectedHoldingsDiscard = function () { - itemSvc.selectedHoldingsDiscard([{ - id : $scope.args.copyId, - barcode : $scope.args.barcode - }]); - } - $scope.selectedHoldingsMissing = function () { itemSvc.selectedHoldingsMissing([{ id : $scope.args.copyId, - barcode : $scope.args.barcode + barcode : $scope.args.copyBarcode }]); } @@ -352,19 +280,16 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD ['$scope','$q','$routeParams','$location','$timeout','$window','egCore', 'egGridDataProvider','egItem','egUser','$uibModal','egCirc','egConfirmDialog', 'egProgressDialog', 'ngToast', -// function($scope , $q , $routeParams , $location , $timeout , $window , egCore , -// egGridDataProvider , itemSvc , egUser , $uibModal , egCirc , egConfirmDialog, -// egProgressDialog, ngToast) { - function($scope , $q , $routeParams , $location , $timeout , $window , egCore , egGridDataProvider , itemSvc , egUser , $uibModal , egCirc , egConfirmDialog, - egProgressDialog, ngToast) { +function($scope , $q , $routeParams , $location , $timeout , $window , egCore , + egGridDataProvider , itemSvc , egUser , $uibModal , egCirc , egConfirmDialog, + egProgressDialog, ngToast) { + var copyId = []; var cp_list = $routeParams.idList; if (cp_list) { copyId = cp_list.split(','); } - var modified_items = new Set(); - $scope.context.page = 'list'; /* @@ -398,14 +323,10 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD $scope.args.barcode = ''; var barcodes = []; - angular.forEach(newVal.split(/\r?\n/), function(line) { - //remove all whitespace and commas - line = line.replace(/[\s,]+/g,''); - - //Or remove leading/trailing whitespace - //line = line.replace(/(^[\s,]+|[\s,]+$/g,''); - + angular.forEach(newVal.split(/\n/), function(line) { if (!line) return; + // scrub any trailing spaces or commas from the barcode + line = line.replace(/(.*?)($|\s.*|,.*)/,'$1'); barcodes.push(line); }); @@ -414,12 +335,10 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD var barcode = barcodes.pop(); egProgressDialog.increment(); - if (barcode == undefined) { // All done here. + if (!barcode) { // All done here. egProgressDialog.close(); copyGrid.refresh(); - if(itemSvc.copies[0]){ // Were any copies actually retrieved - copyGrid.selectItems([itemSvc.copies[0].index]); - } + copyGrid.selectItems([itemSvc.copies[0].index]); return; } @@ -504,39 +423,11 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD return cp_id_list; } - $scope.refreshGridData = function() { - var chain = $q.when(); - var all_items = itemSvc.copies.map(function(item) { - return item.id; - }); - angular.forEach(all_items.reverse(), function(i) { - itemSvc.copies.shift(); - chain = chain.then(function() { - return itemSvc.fetch(null, i); - }); - }); - return chain.then(function() { - copyGrid.refresh(); - }); - } - - $scope.add_copies_to_bucket = function() { var copy_list = gatherSelectedHoldingsIds(); itemSvc.add_copies_to_bucket(copy_list); } - $scope.locateAcquisition = function() { - if (gatherSelectedHoldingsIds) { - var cp_list = gatherSelectedHoldingsIds(); - if (cp_list) { - if (cp_list.length > 0) { - $scope.openAcquisitionLineItem(cp_list); - } - } - } - } - $scope.update_inventory = function() { var copy_list = gatherSelectedHoldingsIds(); itemSvc.updateInventory(copy_list, $scope.gridControls.allItems()).then(function(res) { @@ -609,10 +500,6 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD itemSvc.selectedHoldingsDamaged(copyGrid.selectedItems()); } - $scope.selectedHoldingsDiscard = function () { - itemSvc.selectedHoldingsDiscard(copyGrid.selectedItems()); - } - $scope.selectedHoldingsMissing = function () { itemSvc.selectedHoldingsMissing(copyGrid.selectedItems()); } @@ -685,20 +572,27 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD } $scope.print_labels = function() { - egCore.net.request( + var cp_list = gatherSelectedHoldingsIds(); + !$scope.gridDataProvider.sort ? cp_list.reverse() : $scope.gridDataProvider.sort.length === 0 ? cp_list.reverse() : false; + var i = 1; + if (cp_list.length > 0) { + egCore.net.request( 'open-ils.actor', 'open-ils.actor.anon_cache.set_value', null, 'print-labels-these-copies', { - copies : gatherSelectedHoldingsIds() + copies : cp_list } - ).then(function(key) { + ).then(function(key) { if (key) { var url = egCore.env.basePath + 'cat/printlabels/' + key; $timeout(function() { $window.open(url, '_blank') }); } else { alert('Could not create anonymous cache key!'); } - }); + }); + } else { + alert('Could not generate print labels.'); + } } $scope.print_list = function() { @@ -717,40 +611,11 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD } if (copyId.length > 0) { - var fetch_list = []; - angular.forEach(copyId, function (c) { - fetch_list.push(itemSvc.fetch(null,c)); - }); - - return $q.all(fetch_list).then(function (res) { copyGrid.refresh(); }); - } - - $scope.statusIconColumn = { - isEnabled: true, - template: function(item) { - var icon = ''; - if (modified_items.has(item['id'])) { - icon = '' + - ''; + itemSvc.fetch(null,copyId).then( + function() { + copyGrid.refresh(); } - return icon - } - } - - if (typeof BroadcastChannel != 'undefined') { - var holdings_bChannel = new BroadcastChannel("eg.holdings.update"); - holdings_bChannel.onmessage = function(e) { - angular.forEach(e.data.copies, function(i) { - modified_items.add(i); - }); - ngToast.create(egCore.strings.ITEMS_SUCCESSFULLY_MODIFIED); - $scope.refreshGridData(); - } - $scope.$on('$destroy', function() { - holdings_bChannel.close(); - }); + ); } }]) 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 766a4ea939..3df81bc5c8 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 @@ -33,8 +33,8 @@ function (egCore) { service.flesh = { flesh: 3, flesh_fields: { - acp: ['call_number', 'location', 'status', 'location', 'floating', 'circ_modifier', 'age_protect', 'circ_lib'], - acn: ['record', 'prefix', 'suffix', 'owning_lib'], + acp: ['call_number', 'location', 'status', 'location', 'floating', 'circ_modifier', 'age_protect'], + acn: ['record', 'prefix', 'suffix'], bre: ['simple_record', 'creator', 'editor'] }, select: { @@ -117,13 +117,13 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, }, mode: { options: [ - { label: "Spine Label", value: "spine-only" }, - { label: "Pocket Label", value: "spine-pocket" } + { label: "Label 1 Only", value: "spine-only" }, + { label: "Labels 1 & 2", value: "spine-pocket" } ], selected: "spine-pocket" }, page: { - column_class: ["spine", "pocket"], + column_class: ["spine"], dimensions: { columns: 2, rows: 1 @@ -160,20 +160,13 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, ).then(function (data) { if (data) { - $scope.preview_scope = { 'copies': [] , 'settings': {} - , 'toolbox_settings': JSON.parse(JSON.stringify(toolbox_settings)) + , 'toolbox_settings': toolbox_settings , 'get_cn_for': function (copy) { - var key = $scope.rendered_cn_key_by_copy_id[copy.id]; - if (key) { - var manual_cn = $scope.rendered_call_number_set[key]; - if (manual_cn && manual_cn.value) { - return manual_cn.value; - } else { - return '..'; - } + if (copy.rendered_cn) { + return copy.rendered_cn.value; } else { return '...'; } @@ -255,11 +248,6 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, } } }); - egCore.hatch.getItem('cat.printlabels.last_toolbox_settings').then(function (last_toolbox_settings) { - if (last_toolbox_settings) { - $scope.preview_scope.toolbox_settings = JSON.parse(JSON.stringify(last_toolbox_settings)); - } - }); }) ); @@ -290,9 +278,17 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, $q.all(promises2).then(function () { // today, staff, current_location, etc. + $scope.preview_scope.copies.sort((a, b) => (data.copies.indexOf(a.id) > data.copies.indexOf(b.id)) ? 1 : ((data.copies.indexOf(b.id) > data.copies.indexOf(a.id)) ? -1 : 0)); egCore.print.fleshPrintScope($scope.preview_scope); $scope.template_changed(); // load the default $scope.rebuild_cn_set(); + if ($scope.preview_scope.toolbox_settings && $scope.template_name && $scope.print.template_content) { + var re = /eg\_plt/i; + if (re.test($scope.print.template_content)) { + $scope.applyTemplate($scope.template_name); + $scope.redraw_label_table(); + } + } }); }); @@ -304,12 +300,6 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, } - $scope.checkForToolboxCustomizations = function (tText, redraw) { - var re = /eg\_plt\_(\d+)/; - redraw ? $scope.redraw_label_table() : false; - return re.test(tText); - } - $scope.fetchTemplates = function (set_default) { return egCore.hatch.getItem('cat.printlabels.templates').then(function (t) { if (t) { @@ -335,7 +325,8 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, $scope.preview_scope.settings[s] = $scope.templates[n].settings[s]; } if ($scope.templates[n].toolbox_settings) { - $scope.preview_scope.toolbox_settings = JSON.parse(JSON.stringify($scope.templates[n].toolbox_settings)); + $scope.preview_scope.toolbox_settings = $scope.templates[n].toolbox_settings; + $scope.create_print_label_table(); } egCore.hatch.setItem('cat.printlabels.default_template', n); $scope.save_locally(); @@ -364,8 +355,8 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, content: $scope.print.template_content , context: $scope.print.template_context , cn_content: $scope.print.cn_template_content - , settings: JSON.parse(JSON.stringify($scope.preview_scope.settings)) - , toolbox_settings: JSON.parse(JSON.stringify($scope.preview_scope.toolbox_settings)) + , settings: $scope.preview_scope.settings + , toolbox_settings: $scope.preview_scope.toolbox_settings }; $scope.template_name_list = Object.keys($scope.templates); @@ -400,7 +391,6 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, .then( function (html) { $scope.print.template_content = html; - $scope.checkForToolboxCustomizations(html, true); }, function () { $scope.print.template_content = ''; @@ -423,15 +413,9 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, ); egCore.hatch.getItem('cat.printlabels.last_settings').then(function (s) { if (s) { - $scope.preview_scope.settings = JSON.parse(JSON.stringify(s)); + $scope.preview_scope.settings = s; } }); - egCore.hatch.getItem('cat.printlabels.last_toolbox_settings').then(function (t) { - if (t) { - $scope.preview_scope.toolbox_settings = JSON.parse(JSON.stringify(t)); - } - }); - } $scope.reset_to_default = function () { @@ -445,12 +429,10 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, 'item_label_cn' ); egCore.hatch.removeItem('cat.printlabels.last_settings'); - egCore.hatch.removeItem('cat.printlabels.last_toolbox_settings'); for (s in $scope.preview_scope.settings) { $scope.preview_scope.settings[s] = undefined; } - $scope.preview_scope.toolbox_settings = JSON.parse(JSON.stringify(toolbox_settings)); - + $scope.preview_scope.settings = {}; egCore.org.settings($scope.org_unit_setting_list).then(function (res) { $scope.preview_scope.settings = res; }); @@ -471,8 +453,7 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, 'item_label_cn', $scope.print.cn_template_content ); - egCore.hatch.setItem('cat.printlabels.last_settings', JSON.parse(JSON.stringify($scope.preview_scope.settings))); - egCore.hatch.setItem('cat.printlabels.last_toolbox_settings', JSON.parse(JSON.stringify($scope.preview_scope.toolbox_settings))); + egCore.hatch.setItem('cat.printlabels.last_settings', $scope.preview_scope.settings); } $scope.imported_print_templates = { data: '' }; @@ -485,11 +466,9 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, content: el.content , context: el.context , cn_content: el.cn_content - , settings: JSON.parse(JSON.stringify(el.settings)) + , settings: el.settings + , toolbox_settings: el.toolbox_settings }; - if (el.toolbox_settings) { - $scope.templates[k].toolbox_settings = JSON.parse(JSON.stringify(el.toolbox_settings)); - } }); $scope.saveTemplate(); $scope.template_changed(); // refresh @@ -500,63 +479,65 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, } }); - $scope.rendered_call_number_set = {}; - $scope.rendered_cn_key_by_copy_id = {}; $scope.rebuild_cn_set = function () { $timeout(function () { - $scope.rendered_call_number_set = {}; - $scope.rendered_cn_key_by_copy_id = {}; for (var i = 0; i < $scope.preview_scope.copies.length; i++) { var copy = $scope.preview_scope.copies[i]; + copy.rendered_cn = {}; var rendered_cn = document.getElementById('cn_for_copy_' + copy.id); if (rendered_cn && rendered_cn.textContent) { - var key = rendered_cn.textContent; - if (typeof $scope.rendered_call_number_set[key] == 'undefined') { - $scope.rendered_call_number_set[key] = { - value: key - }; - } - $scope.rendered_cn_key_by_copy_id[copy.id] = key; + copy.rendered_cn = { value : rendered_cn.textContent }; } } $scope.preview_scope.tickle = Date() + ' ' + Math.random(); }); } - $scope.redraw_label_table = function () { + $scope.create_print_label_table = function () { if ($scope.print_label_form.$valid && $scope.print.template_content && $scope.preview_scope) { $scope.preview_scope.label_output_copies = labelOutputRowsFilter($scope.preview_scope.copies, $scope.preview_scope.toolbox_settings); - var d = new Date().getTime().toString(); var html = $scope.print.template_content; - if ($scope.checkForToolboxCustomizations(html)) { - html = html.replace(/eg\_plt\_\d+/, "eg_plt_" + d); - $scope.print.template_content = html; - } else { - var table = " 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" ng-init=\"parentIndex = $index\" ng-repeat=\"row in label_output_copies\">\n"; - table += "\n"; - table += "\n" - table += "\n"; - table += "
0 ? toolbox_settings.page.space_between_labels.vertical.size : parentIndex > 0 ? toolbox_settings.page.space_between_labels.vertical.size : 0}} 0 0 {{$index === 0 ? toolbox_settings.page.margins.left.size : col.styl ? col.styl : toolbox_settings.page.space_between_labels.horizontal.size}};\" ng-repeat=\"col in row.columns\">\n"; - table += "
\n";
-                table += "{{col.c ? get_cn_for(col.c) : ''}}";
-                table += "
\n"; - table += "
 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" style=\"border: none;  margin-bottom: 0; margin-top: 0; overflow: hidden;\" ng-if=\"col.cls === 'pocket'\">\n";
-                table += "{{col.c ? col.c.barcode : ''}}\n";
-                table += "{{col.c ? col.c['call_number.label'] : ''}}\n";
-                table += "{{col.c ? get_bib_for(col.c).author : ''}}\n";
-                table += "{{col.c ? (get_bib_for(col.c).title | wrap:28:'once':'  ') : ''}}\n";
-                table += "
\n"; - table += "
"; - var comments = html.match(/\<\!\-\-(?:(?!\-\-\>)(?:.|\s))*\-\-\>\s*/g); - html = html.replace(/\<\!\-\-(?:(?!\-\-\>)(?:.|\s))*\-\-\>\s*/g, ''); - var style = html.match(/\]*\>(?:(?!\<\/style\>)(?:.|\s))*\<\/style\>\s*/gi); - var output = (comments ? comments.join("\n") : "") + (style ? style.join("\n") : "") + table; - output = output.replace(/\n+/, "\n"); - $scope.print.template_content = output; - } + var d = new Date(); //Added to table ID with 'eg_plt_' to cause $complie on $scope.print.template_content to fire due to template content change. + var table = " 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" ng-init=\"parentIndex = $index\" ng-repeat=\"row in label_output_copies\">\n"; + table += "\n"; + table += "\n" + table += "\n"; + table += "
0 ? toolbox_settings.page.space_between_labels.vertical.size : parentIndex > 0 ? toolbox_settings.page.space_between_labels.vertical.size : 0}} 0 0 {{$index === 0 ? toolbox_settings.page.margins.left.size : col.styl ? col.styl : toolbox_settings.page.space_between_labels.horizontal.size}};\" ng-repeat=\"col in row.columns\">\n"; + table += "
\n";
+            table += "{{col.c ? get_cn_for(col.c) : ''}}";
+            table += "
\n"; + table += "
 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" style=\"border: none;  margin-bottom: 0; margin-top: 0; overflow: hidden;\" ng-if=\"col.cls === 'pocket'\">\n";
+            table += "{{col.c ? col.c.barcode : ''}}\n";
+            table += "{{col.c ? col.c['call_number.label'] : ''}}\n";
+            table += "{{col.c ? get_bib_for(col.c).author : ''}}\n";
+            table += "{{col.c ? (get_bib_for(col.c).title | wrap:28:'once':'  ') : ''}}\n";
+            table += "
\n"; + table += "
"; + var comments = html.match(/\<\!\-\-(?:(?!\-\-\>)(?:.|\s))*\-\-\>\s*/g); + html = html.replace(/\<\!\-\-(?:(?!\-\-\>)(?:.|\s))*\-\-\>\s*/g, ""); + var style = html.match(/\]*\>(?:(?!\<\/style\>)(?:.|\s))*\<\/style\>\s*/gi); + var output = (style ? style.join("\n") : "") + (comments ? comments.join("\n") : "") + table; + output = output.replace(/\n+/, "\n"); + $scope.print.template_content = output; + $scope.save_locally(); } } + $scope.redraw_label_table = function () { + var d = new Date(); //Added to table ID with 'eg_plt_' to cause $complie on $scope.print.template_content to fire due to template content change. + var table = "
\n"; + $scope.print.template_content += table; + $scope.create_print_label_table(); + } + + $scope.$watch('preview_scope.toolbox_settings.page.dimensions.columns', + function (newVal, oldVal) { + if (newVal && newVal != oldVal && $scope.preview_scope) { + $scope.redraw_label_table(); + } + } + ); + $scope.$watch('print.cn_template_content', function (newVal, oldVal) { if (newVal && newVal != oldVal) { $scope.rebuild_cn_set(); @@ -575,14 +556,14 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, } }); - $scope.$watchGroup(['preview_scope.toolbox_settings.page.margins.top.size', 'preview_scope.toolbox_settings.page.margins.left.size', 'preview_scope.toolbox_settings.page.dimensions.rows', 'preview_scope.toolbox_settings.page.dimensions.columns', 'preview_scope.toolbox_settings.page.space_between_labels.horizontal.size', 'preview_scope.toolbox_settings.page.space_between_labels.vertical.size', 'preview_scope.toolbox_settings.page.start_position.row', 'preview_scope.toolbox_settings.page.start_position.column', 'preview_scope.toolbox_settings.page.label.gap.size'], function (newVal, oldVal) { + $scope.$watchGroup(['preview_scope.toolbox_settings.page.margins.top.size', 'preview_scope.toolbox_settings.page.margins.left.size', 'preview_scope.toolbox_settings.page.dimensions.rows', 'preview_scope.toolbox_settings.page.space_between_labels.horizontal.size', 'preview_scope.toolbox_settings.page.space_between_labels.vertical.size', 'preview_scope.toolbox_settings.page.start_position.row', 'preview_scope.toolbox_settings.page.start_position.column', 'preview_scope.toolbox_settings.page.label.gap.size'], function (newVal, oldVal) { if (newVal && newVal != oldVal && $scope.preview_scope.label_output_copies) { $scope.redraw_label_table(); } }); $scope.$watch("preview_scope.toolbox_settings.mode.selected", function (newVal, oldVal) { - if (newVal && newVal != oldVal && $scope.preview_scope) { + if (newVal && newVal != oldVal) { var ts_p = $scope.preview_scope.toolbox_settings.page; if (ts_p.label.set.size === 1) { if (newVal === "spine-pocket") { @@ -605,7 +586,7 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, }); $scope.$watch("preview_scope.toolbox_settings.page.label.set.size", function (newVal, oldVal) { - if (newVal && newVal != oldVal && oldVal) { + if (newVal && newVal != oldVal) { var ts_p = $scope.preview_scope.toolbox_settings.page; if (angular.isNumber(newVal)) { while (ts_p.column_class.length > ts_p.label.set.size) { @@ -615,24 +596,7 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, ts_p.column_class.push("spine"); } } - } - }); - - $scope.$watch('print.cn_template_content', function (newVal, oldVal) { - if (newVal && newVal != oldVal) { - $scope.rebuild_cn_set(); - } - }); - - $scope.$watch("preview_scope.settings['webstaff.cat.label.call_number_wrap_filter_height']", function (newVal, oldVal) { - if (newVal && newVal != oldVal) { - $scope.rebuild_cn_set(); - } - }); - - $scope.$watch("preview_scope.settings['webstaff.cat.label.call_number_wrap_filter_width']", function (newVal, oldVal) { - if (newVal && newVal != oldVal) { - $scope.rebuild_cn_set(); + $scope.redraw_label_table(); } }); @@ -725,7 +689,9 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, .filter('cn_wrap', function () { return function (input, w, h, wrap_type) { - var names; + var addedElements = 0; + /* Pattern matches for LC ([0]) and non-LC ([1]) CNs */ + var patterns = [/^([A-Z]{1,3})\s*(\d{1,4})(\.*\d{1,3})?\s*(\d[A-Z0-9]{0,3})?(\.*[A-Z]\d{1,3})?(\d[A-Z0-9]{0,3})?([A-Z]\d{1,3})?(.*)?/i, /^([A-Z]+)?\s*(\d+)(\.\d+)?\s*(.*)?$/i]; var prefix = input[0]; var callnum = input[1]; var suffix = input[2]; @@ -733,78 +699,77 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, if (!w) { w = 8; } if (!h) { h = 9; } - /* handle spine labels differently if using LC */ - if (wrap_type == 'lc' || wrap_type == 3) { - /* Establish a pattern where every return value should be isolated on its own line - on the spine label: subclass letters, subclass numbers, cutter numbers, trailing stuff (date) */ - var patt1 = /^([A-Z]{1,3})\s*(\d+(?:\.\d+)?)\s*(\.[A-Z]\d*)\s*([A-Z]\d*)?\s*(\d\d\d\d(?:-\d\d\d\d)?)?\s*(.*)$/i; - var result = callnum.match(patt1); - if (result) { - callnum = result.slice(1).join('\t'); - } else { - callnum = callnum.split(/\s+/).join('\t'); + var cn_patt; /* <- regex from patterns to use based on wrap_type */ + var z = 3; /* <-Text match position in patterns for variable text (7th position in LC regex pattern); default to non-LC (3rd position in non-LC regex pattern) */ + if (wrap_type === 3 || wrap_type === 'lc') { + cn_patt = patterns[0]; + z = 7; + } else { + cn_patt = patterns[1]; + } + + var result = callnum.match(cn_patt); + if (result) { + result = result.slice(1); + /* Fix the variable lines of the call number that are longer than 'w'; proceed through algorithm to break up the elements in a standard spine label format (on spaces, periods, decimals, etc.) */ + if (result[z + addedElements]) { + result[z + addedElements] = result[z + addedElements].replace(/\s+$/, ""); + if (result[z + addedElements].length > w) { + var n = z + addedElements; + var sub_patt = [/^([^\.]+?)(?!\.) ([^\s]+)$/, /^(.+?) ([^\s]+)$/]; + while (n < result.length) { + var y = result[n].match(sub_patt[0]) ? 0 : result[n].match(sub_patt[1]) ? 1 : 0; + if (result[n].match(sub_patt[y]) && result[n].length > w) { + var str = result[n].match(sub_patt[y]); + result[n] = str[1]; + result.splice(n + 1, 0, str[2]); + addedElements++; + } else { + n++; + } + } + } } - - /* If result is null, leave callnum alone. Can't parse this malformed call num */ } else { - callnum = callnum.split(/\s+/).join('\t'); + result = []; + divideOnCharLen(callnum, result, 0, 0); } + prefix ? result.splice(0, 0, prefix) : false; + suffix ? result.push(suffix) : false; - if (prefix) { - callnum = prefix + '\t' + callnum; + /* Give each line a final check and cleanup if it exceeds width of 'w' */ + addedElements = 0; + for (var i = 0; i < result.length; i++) { + if (result[i]) { + divideOnCharLen(result[i], result, i, addedElements); + } } - if (suffix) { - callnum += '\t' + suffix; + var output = []; + for (var j = 0; j < result.length; j++) { + result[j] ? result[j] = result[j].replace(/^\s*(.*?)\s*$/, "$1") : false; + result[j] ? output.push(result[j]) : false; } + output = output.slice(0, h); /*Limit lines to height in org unit settings (or default) */ - /* At this point, the call number pieces are separated by tab characters. This allows - * some space-containing constructs like "v. 1" to appear on one line - */ - callnum = callnum.replace(/\t\t/g, '\t'); /* Squeeze out empties */ - names = callnum.split('\t'); - var j = 0; var tb = []; - while (j < h) { - - /* spine */ - if (j < w) { - - var name = names.shift(); - if (name) { - name = String(name); - - /* if the name is greater than the label width... */ - if (name.length > w) { - /* then try to split it on periods */ - var sname = name.split(/\./); - if (sname.length > 1) { - /* if we can, then put the periods back in on each splitted element */ - if (name.match(/^\./)) sname[0] = '.' + sname[0]; - for (var k = 1; k < sname.length; k++) sname[k] = '.' + sname[k]; - /* and put all but the first one back into the names array */ - names = sname.slice(1).concat(names); - /* if the name fragment is still greater than the label width... */ - if (sname[0].length > w) { - /* then just truncate and throw the rest back into the names array */ - tb[j] = sname[0].substr(0, w); - names = [sname[0].substr(w)].concat(names); - } else { - /* otherwise we're set */ - tb[j] = sname[0]; - } - } else { - /* if we can't split on periods, then just truncate and throw the rest back into the names array */ - tb[j] = name.substr(0, w); - names = [name.substr(w)].concat(names); - } + return output.join('\n'); + + function divideOnCharLen(val, arr, index, incr) { + var x = 1; + while ((val.length / x) > w) { + x++; + } + var charMatch = val.match(new RegExp(".{1," + Math.ceil((val.length / x)) + "}", "g")); + if (charMatch) { + for (var t = 0; t < charMatch.length; t++) { + if (t === 0) { + arr[index] = charMatch[t]; } else { - /* otherwise we're set */ - tb[j] = name; + arr.splice((index + t), 0, charMatch[t]); + incr++; } } } - j++; } - return tb.join('\n'); } }) diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index 9dbdb9e75f..22f0cfdfd6 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -131,8 +131,6 @@ function(egCore , $q) { flesh_fields : { asc : ['owner','entries'], asce : ['value'] - }, - order_by : [{'class':'asc', 'field':'owner'},{'class':'asc', 'field':'name'},{'class':'asce', 'field':'value'} ] }, { atomic : true } ); @@ -273,8 +271,7 @@ function(egCore , $q) { return egCore.pcrud.search('bmp', {record : rec, deleted : 'f'}, - {order_by: {bmp : 'label_sortkey DESC'}}, - {atomic : true} + null, {atomic : true} ).then(function(list) { service.bmp_parts[rec] = list; return list; @@ -479,8 +476,7 @@ function(egCore , $q) { '
'+ ''+ + ' type="text" ng-model="barcode" ng-change="updateBarcode()"/>'+ '
{{duplicate_barcode_string}}
'+ '
{{empty_barcode_string}}
'+ '
'+ @@ -500,11 +496,6 @@ function(egCore , $q) { if (!$scope.copy.barcode()) $scope.copy.empty_barcode = true; - $scope.selectOnFocus = function($event) { - if (!$scope.copy.empty_barcode) - $event.target.select(); - } - $scope.nextBarcode = function (i) { $scope.focusNext(i, $scope.barcode); } @@ -1061,27 +1052,12 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , if ($scope.defaults.barcode_checkdigit) itemSvc.barcode_checkdigit = true; if ($scope.defaults.auto_gen_barcode) itemSvc.auto_gen_barcode = true; } - - // Fetch the list of bib-level callnumbers based on the applied - // classification scheme. If none is defined, default to "1" - // (Generic) since it provides the most options. - egCore.net.request( - 'open-ils.cat', - 'open-ils.cat.biblio.record.marc_cn.retrieve', - $scope.record_id, - $scope.batch.classification || 1 - ).then(function(list) { - $scope.batch.marcCallNumbers = []; - list.forEach(function(hash) { - $scope.batch.marcCallNumbers.push(Object.values(hash)[0]); - }); - }); }); } + $scope.fetchDefaults(); - $scope.$watch('defaults.statcat_filter', function(n,o) { - if (n && n != o) - $scope.saveDefaults(); + $scope.$watch('defaults.statcat_filter', function() { + $scope.saveDefaults(); }); $scope.$watch('defaults.auto_gen_barcode', function (n,o) { itemSvc.auto_gen_barcode = n @@ -1185,20 +1161,6 @@ 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]] && - $scope.working.MultiMap[keys[i]].length > 1) { - return true; - } - } - return false; - } - $scope.copyAlertUpdate = function (alerts) { if (!$scope.in_item_select && $scope.workingGridControls && @@ -1295,13 +1257,11 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , // trim out all deleted ones; the API used to // do the update doesn't actually consult // isdeleted for stat cat entries - if (cp.stat_cat_entries()) { - cp.stat_cat_entries( - cp.stat_cat_entries().filter(function (e) { - return !Boolean(e.isdeleted()); - }) - ); - } + cp.stat_cat_entries( + cp.stat_cat_entries().filter(function (e) { + return !Boolean(e.isdeleted()); + }) + ); cp.ischanged(1); } @@ -1407,11 +1367,10 @@ 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' && k != 'MultiMap') { + } else if (k != 'circ_lib') { angular.forEach(v, function (sv,sk) { if (typeof v != 'undefined') $scope.working[k][sk] = undefined; @@ -1487,7 +1446,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , } $scope.circTypeValue = function (x) { - if (x === null || x === undefined) return egCore.strings.UNSET; + if (x === null) return egCore.strings.UNSET; var s = $scope.circ_type_list.filter(function(y) { return y.code() == x; }); @@ -1496,7 +1455,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , } $scope.ageprotectName = function (x) { - if (x === null || x === undefined) return egCore.strings.UNSET; + if (x === null) return egCore.strings.UNSET; var s = $scope.age_protect_list.filter(function(y) { return y.id() == x; }); @@ -1505,7 +1464,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , } $scope.floatingName = function (x) { - if (x === null || x === undefined) return egCore.strings.UNSET; + if (x === null) return egCore.strings.UNSET; var s = $scope.floating_list.filter(function(y) { return y.id() == x; }); @@ -1514,7 +1473,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , } $scope.circmodName = function (x) { - if (x === null || x === undefined) return egCore.strings.UNSET; + if (x === null) return egCore.strings.UNSET; var s = $scope.circ_modifier_list.filter(function(y) { return y.code() == x; }); @@ -1537,9 +1496,6 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , $scope.record_id = data.record_id; - // Fetch defaults - $scope.fetchDefaults(); - function fetchRaw () { if (!$scope.only_vols) $scope.dirty = true; $scope.add_vols_copies = true; @@ -2003,12 +1959,19 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , ).then(function(copy_ids) { if (and_exit) { $scope.dirty = false; + !$scope.completedGridDataProvider.sort ? copy_ids.reverse() : $scope.completedGridDataProvider.sort.length === 0 ? copy_ids.reverse() : false; if ($scope.defaults.print_item_labels) { + var cp_full = []; + var i = 1; + angular.forEach(copy_ids, function (copy) { + cp_full.push({ id: i, target_copy: copy}); + i++; + }); egCore.net.request( 'open-ils.actor', 'open-ils.actor.anon_cache.set_value', null, 'print-labels-these-copies', { - copies : copy_ids + copies : cp_full } ).then(function(key) { if (key) { @@ -2111,7 +2074,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 ? 't' : 'f'); + n.pub(note.pub); n.title(note.title); n.value(note.value); n.owning_copy(cp.id()); @@ -2181,7 +2144,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() + " (" + egCore.org.get(item.owner()).shortname() + ")"; + return item.label(); }); }); } @@ -2557,10 +2520,11 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , $scope.clearWorking = function () { angular.forEach($scope.working, function (v,k,o) { + $scope.working.MultiMap[k] = []; if (!angular.isObject(v)) { if (typeof v != 'undefined') $scope.working[k] = undefined; - } else if (k != 'circ_lib' && k != 'MultiMap') { + } else if (k != 'circ_lib') { angular.forEach(v, function (sv,sk) { $scope.working[k][sk] = undefined; }); diff --git a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js index d0e5106248..a40246af1d 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js @@ -233,13 +233,9 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg {already_checked_in : final_resp.evt.copy_barcode}; } - if ($scope.trim_list && checkinSvc.checkins.length > 20) { + if ($scope.trim_list && checkinSvc.checkins.length > 20) //cut array short at 20 items checkinSvc.checkins.length = 20; - checkinGrid.prepend(20); - } else { - checkinGrid.prepend(); - } }, function() { // Checkin was rejected somewhere along the way. @@ -253,7 +249,9 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg checkinSvc.checkins.splice(pos, 1); })['finally'](function() { - // when all is said and done, refocus + + // when all is said and done, refresh the grid and refocus + checkinGrid.refresh(); $scope.focusMe = true; }); } @@ -337,20 +335,6 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg } - $scope.showMarkDiscard = function(items) { - var copies = []; - angular.forEach(items, function(item) { - if (item.acp) { - copies.push(egCore.idl.toHash(item.acp)); - } - }); - if (copies.length) { - egCirc.mark_discard(copies).then(function() { - // update grid items? - }); - } - } - $scope.abortTransit = function(items) { var transit_ids = []; angular.forEach(items, function(item) { @@ -414,11 +398,13 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg } $scope.printSpineLabels = function(items){ - var copy_ids = []; + var cp_list = []; + var i = 1; angular.forEach(items, function(item) { - if (item.acp) copy_ids.push(item.acp.id()); + if (item.acp) cp_list.push(item.acp.id()); }); - itemSvc.print_spine_labels(copy_ids); + !$scope.gridDataProvider.sort ? cp_list.reverse() : $scope.gridDataProvider.sort.length === 0 ? cp_list.reverse() : false; + itemSvc.print_spine_labels(cp_list); } $scope.addCopyAlerts = function(items) { -- 2.11.0