From 2b0e0bacef3774fb9d1328fa0bf461704cf9e3a6 Mon Sep 17 00:00:00 2001 From: Cesar Velez Date: Fri, 21 Jul 2017 18:04:34 -0400 Subject: [PATCH] LP#1685929 - Add actions to CheckIn grid Adds mark pieces missing action to checkin. Signed-off by: Cesar Velez --- .../src/templates/staff/circ/checkin/index.tt2 | 10 ++++ .../staff/circ/checkin/t_checkin_table.tt2 | 4 ++ Open-ILS/web/js/ui/default/staff/cat/item/app.js | 67 ++++++++++++++++++++-- .../web/js/ui/default/staff/circ/checkin/app.js | 8 +++ 4 files changed, 84 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/checkin/index.tt2 b/Open-ILS/src/templates/staff/circ/checkin/index.tt2 index c254f75d26..4bc925d637 100644 --- a/Open-ILS/src/templates/staff/circ/checkin/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/checkin/index.tt2 @@ -9,6 +9,16 @@ + + [% INCLUDE 'staff/circ/share/circ_strings.tt2' %] diff --git a/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 b/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 index 6d5975508f..a2dfb1b02d 100644 --- a/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 +++ b/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 @@ -23,6 +23,10 @@ handler="showMarkDamaged" label="[% l('Mark Items Damaged') %]"> + + 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 002061eaee..5709433e48 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 @@ -48,8 +48,8 @@ angular.module('egItemStatus', }) .factory('itemSvc', - ['egCore','egCirc','$uibModal','$q','$timeout','$window','egConfirmDialog', -function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog ) { + ['egCore','egCirc','$uibModal','$q','$timeout','$window','egConfirmDialog','egAlertDialog', +function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog, egAlertDialog ) { var service = { copies : [], // copy barcode search results @@ -91,17 +91,21 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog //Retrieve separate copy, combcirc, and accs information service.getCopy = function(barcode, id) { - if (barcode) return egCore.pcrud.search( - 'acp', {barcode : barcode, deleted : 'f'}, - service.flesh).then(function(copy) {return copy}); + if (barcode) { + return egCore.pcrud + .search('acp', {barcode : barcode, deleted : 'f'}, service.flesh) + .then(function(copy) {return copy}); + } return egCore.pcrud.retrieve( 'acp', id, service.flesh) .then(function(copy) {return copy}); } + service.getCirc = function(id) { return egCore.pcrud.search('combcirc', { target_copy : id }, service.circFlesh).then(function(circ) {return circ}); } + service.getSummary = function(id) { return circ_summary = egCore.net.request( 'open-ils.circ', @@ -868,6 +872,59 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog } } + service.mark_missing_pieces = function(copy) { + var b = copy.barcode(); + var t = egCore.idl.toHash(copy.call_number()).record.title; + egConfirmDialog.open( + egCore.strings.CONFIRM_MARK_MISSING_TITLE, + egCore.strings.CONFIRM_MARK_MISSING_BODY, + { barcode : b, title : t } + ).result.then(function() { + + // kick off mark missing + return egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.mark_item_missing_pieces', + egCore.auth.token(), copy.id() + ) + + }).then(function(resp) { + var evt = egCore.evt.parse(resp); // should always produce event + + if (evt.textcode == 'ACTION_CIRCULATION_NOT_FOUND') { + return egAlertDialog.open( + egCore.strings.CIRC_NOT_FOUND, {barcode : copy.barcode()}); + } + + var payload = evt.payload; + + // TODO: open copy editor inline? new tab? + + // print the missing pieces slip + var promise = $q.when(); + if (payload.slip) { + // wait for completion, since it may spawn a confirm dialog + promise = egCore.print.print({ + context : 'default', + content_type : 'text/html', + content : payload.slip.template_output().data() + }); + } + + if (payload.letter) { + $scope.letter = payload.letter.template_output().data(); + } + + // apply patron penalty + if (payload.circ) { + promise.then(function() { + egCirc.create_penalty(payload.circ.usr()) + }); + } + + }); + } + return service; }]) 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 8c35dc2be3..8f2fb5070f 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 @@ -366,5 +366,13 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg }); itemSvc.spawnHoldingsEdit(itemObjs,false,false); } + + $scope.show_mark_missing_pieces = function(items){ + angular.forEach(items, function(i){ + i.acp.call_number(i.acn); + i.acp.call_number().record(i.record); + itemSvc.mark_missing_pieces(i.acp); + }); + } }]) -- 2.11.0