From: Galen Charlton Date: Tue, 20 Jun 2017 20:28:45 +0000 (-0400) Subject: webstaff: teach serials items grid about certain status changes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e2a1cfbb1dc3bcc6e6da32a1673359f0eb48c1ee;p=working%2FEvergreen.git webstaff: teach serials items grid about certain status changes Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/staff/serials/index.tt2 b/Open-ILS/src/templates/staff/serials/index.tt2 index 928584bb88..16e35a10e8 100644 --- a/Open-ILS/src/templates/staff/serials/index.tt2 +++ b/Open-ILS/src/templates/staff/serials/index.tt2 @@ -59,6 +59,8 @@ angular.module('egCoreMod').run(['egStrings', function(s) { s.CONFIRM_CHANGE_ITEMS_MESSAGE.reset = "[% l('Will reset {{items}} item(s) to Expected and remove unit(s).') %]"; s.CONFIRM_CHANGE_ITEMS.receive = "[% l('Receive selected items?') %]" s.CONFIRM_CHANGE_ITEMS_MESSAGE.receive = "[% l('Will receive {{items}} item(s) without barcoding.') %]"; + s.CONFIRM_CHANGE_ITEMS.status = "[% l('Change status selected items?') %]" + s.CONFIRM_CHANGE_ITEMS_MESSAGE.status = "[% l('Will change status of {{items}} item(s).') %]"; s.CONFIRM_DELETE_MFHDS = "[% l('Delete selected MFHD(s)?') %]"; s.CONFIRM_DELETE_MFHDS_MESSAGE = "[% l('Will delete {{items}} MFHD(s).') %]"; diff --git a/Open-ILS/src/templates/staff/serials/t_view_items_grid.tt2 b/Open-ILS/src/templates/staff/serials/t_view_items_grid.tt2 index acbb8e0096..9ae5b98ec2 100644 --- a/Open-ILS/src/templates/staff/serials/t_view_items_grid.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_view_items_grid.tt2 @@ -73,6 +73,15 @@ + + + + + diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js b/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js index a9f8d68672..1c2c3c8a3b 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js @@ -351,6 +351,27 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , orderByF }), true, true, $scope.do_print_routing_lists, function(){reload($scope.ssubId,_paging_filter)}); } + $scope.set_selected_as_claimed = function(list) { + return egSerialsCoreSvc.set_item_status('Claimed', $scope.bibId, list.map(function(item) { + return egCore.idl.Clone(egSerialsCoreSvc.itemMap[item.id]); + }), function(){reload($scope.ssubId,_paging_filter)}); + } + $scope.set_selected_as_discarded = function(list) { + return egSerialsCoreSvc.set_item_status('Discarded', $scope.bibId, list.map(function(item) { + return egCore.idl.Clone(egSerialsCoreSvc.itemMap[item.id]); + }), function(){reload($scope.ssubId,_paging_filter)}); + } + $scope.set_selected_as_not_published = function(list) { + return egSerialsCoreSvc.set_item_status('Not Published', $scope.bibId, list.map(function(item) { + return egCore.idl.Clone(egSerialsCoreSvc.itemMap[item.id]); + }), function(){reload($scope.ssubId,_paging_filter)}); + } + $scope.set_selected_as_not_held = function(list) { + return egSerialsCoreSvc.set_item_status('Not Held', $scope.bibId, list.map(function(item) { + return egCore.idl.Clone(egSerialsCoreSvc.itemMap[item.id]); + }), function(){reload($scope.ssubId,_paging_filter)}); + } + $scope.menu_print_routing_lists = function (items) { items = items.map(function(item) { return egCore.idl.Clone(egSerialsCoreSvc.itemMap[item.id]); diff --git a/Open-ILS/web/js/ui/default/staff/serials/services/core.js b/Open-ILS/web/js/ui/default/staff/serials/services/core.js index 8ace6ab525..ffe5bc7588 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/services/core.js +++ b/Open-ILS/web/js/ui/default/staff/serials/services/core.js @@ -768,6 +768,35 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm } + service.set_item_status = function(newStatus, bibId, list, callback) { + if (!callback) callback = function () { return $q.when() } + if (!list.length) return $q.reject(); + + return egConfirmDialog.open( + egCore.strings.CONFIRM_CHANGE_ITEMS.status, + egCore.strings.CONFIRM_CHANGE_ITEMS_MESSAGE.status, + {items : list.length} + ).result.then(function () { + var promises = [$q.when()]; + angular.forEach(list, function(item) { + item.status(newStatus); + promises.push( + egCore.net.request( + 'open-ils.serial', + 'open-ils.serial.item.update', + egCore.auth.token(), + item + ).then(function(res) { + return $q.when(); + }) + ); + }); + $q.all(promises).then(function() { + callback(); + }); + }); + } + service.process_items = function (mode, bibId, list, do_barcode, bind, print_rl, callback) { if (!callback) callback = function () { return $q.when() } if (!list.length) return $q.reject();