From 0bd362eaf2d7404e53c44f4a9a859f48b3cd060d Mon Sep 17 00:00:00 2001 From: blake Date: Mon, 20 Jul 2015 10:11:22 -0500 Subject: [PATCH] LP1402770_column_picker_option_for_number_of_holds Added a virtual IDL defintion. Added a OpenSRF method to return the number of holds that a copy is a member of action.hold_copy_map. Added javascript column definition to surface this in the xul staff client. Added the column in the web based staff client as well. Signed-off-by: blake Signed-off-by: Andrea Neiman Signed-off-by: Kathy Lussier Signed-off-by: Ben Shum --- Open-ILS/examples/fm_IDL.xml | 25 +++++++++++++ .../lib/OpenILS/Application/Circ/Holds.pm | 36 +++++++++++++++++++ .../staff/circ/patron/t_items_out.tt2 | 1 + .../ui/default/staff/circ/patron/items_out.js | 2 +- .../chrome/content/main/constants.js | 1 + Open-ILS/xul/staff_client/server/circ/util.js | 11 ++++++ 6 files changed, 75 insertions(+), 1 deletion(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 42b66f27a9..981ccbb758 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -6674,6 +6674,7 @@ SELECT usr, + @@ -6698,6 +6699,7 @@ SELECT usr, + @@ -11346,6 +11348,29 @@ SELECT usr, + + + SELECT ahcm.target_copy AS "id",count(*) AS "count" + FROM + action.hold_request ahr, + action.hold_copy_map ahcm + WHERE + ahr.cancel_time IS NULL AND + ahr.fulfillment_time IS NULL AND + ahr.capture_time IS NULL AND + ahr.id = ahcm.hold + GROUP BY ahcm.target_copy + + + + + + + + + + + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index a859f114d9..65c3a6fe97 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -4410,4 +4410,40 @@ sub mr_hold_filter_attrs { return; } +__PACKAGE__->register_method( + method => "copy_has_holds_count", + api_name => "open-ils.circ.copy.has_holds_count", + authoritative => 1, + signature => { + desc => q/ + Returns the number of holds a paticular copy has + /, + params => [ + { desc => 'Authentication Token', type => 'string'}, + { desc => 'Copy ID', type => 'number'} + ], + return => { + desc => q/ + Simple count value + /, + type => 'number' + } + } +); + +sub copy_has_holds_count { + my( $self, $conn, $auth, $copyid ) = @_; + my $e = new_editor(authtoken=>$auth); + return $e->event unless $e->checkauth; + + if( $copyid && $copyid > 0 ) { + my $meth = 'retrieve_action_has_holds_count'; + my $data = $e->$meth($copyid); + if($data){ + return $data->count(); + } + } + return 0; +} + 1; diff --git a/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 index 24b4e0e790..270ef908fe 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 @@ -90,6 +90,7 @@ + diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js b/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js index 3bd2b2a0b6..380c42c757 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js @@ -98,7 +98,7 @@ function($scope, $q, $routeParams, $timeout, egCore , egUser, patronSvc , $ { flesh : 4, flesh_fields : { circ : ['target_copy', 'workstation', 'checkin_workstation'], - acp : ['call_number'], + acp : ['call_number', 'holds_count'], acn : ['record'], bre : ['simple_record'] }, diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index e17a89742f..0165ec5bb8 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -243,6 +243,7 @@ var api = { 'FM_CIRC_RETRIEVE_VIA_USER.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.authoritative' }, 'FM_CIRC_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_checkout_history.retrieve' }, /*'FM_CIRC_COUNT_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count' },*/ + 'FM_CIRC_HAS_HOLDS_COUNT_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy.has_holds_count', 'secure' : true }, 'FM_CIRC_COUNT_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count', 'cacheable' : true, 'ttl' : 60000 }, 'FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count.authoritative', 'cacheable' : true, 'ttl' : 60000 }, 'FM_CIRC_COUNT_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.count' }, diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 1af364643e..3c9bff8ff1 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -592,6 +592,17 @@ circ.util.columns = function(modify,params) { } } }, + { + 'id' : 'ahhc', + 'fm_class' : 'hasholdscount', + 'label' : 'Holds Count', + 'flex' : 1, + 'primary' : false, + 'hidden' : false, + 'editable' : false, 'render' : function(my) { + return network.simple_request("FM_CIRC_HAS_HOLDS_COUNT_RETRIEVE_VIA_COPY",[ ses(), my.acp.id() ] ); + } + }, { 'id' : 'prefix', 'fm_class' : 'acn', -- 2.43.2