From: phasefx Date: Wed, 30 Sep 2009 15:33:59 +0000 (+0000) Subject: This fetches action::circ_counts_by_year objects, an improvement over open-ils.circ... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b8ad257fdf63425cd930d7e71246a9395bcb1ca8;p=evergreen%2Fpines.git This fetches action::circ_counts_by_year objects, an improvement over open-ils.circ.circulation.count since it can aggregate native circs with legacy circs in a reporter extension table. The sum of the circ counts for each of these objects is rendered in a Total Circs field in Item Status -> Alternate View, and a tooltip/mouseover is set on the same field with a breakdown of counts by year. git-svn-id: svn://svn.open-ils.org/ILS/trunk@14222 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 8be10a0315..13e157e569 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -186,6 +186,7 @@ const api = { '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' }, + 'FM_CIRC_IMPROVED_COUNT_VIA_COPY' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.circbyyr.atomic' }, 'FM_CIRC_EDIT_DUE_DATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.due_date.update' }, 'FM_CIRC_BACKDATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate' }, 'FM_CIT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.ident_types.retrieve', 'secure' : false }, diff --git a/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js b/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js index 8e0b397b68..7a42022b18 100644 --- a/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js +++ b/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js @@ -28,6 +28,13 @@ function set(name,value) { } } +function set_tooltip(name,value) { + var nodes = document.getElementsByAttribute('name',name); + for (var i = 0; i < nodes.length; i++) { + nodes[i].setAttribute('tooltiptext',value); + } +} + function load_item() { try { if (! xulG.barcode) return; @@ -113,6 +120,7 @@ function load_item() { set("stat_cat_entry_copy_maps", ''); set("circulations", ''); set("total_circ_count", ''); + set_tooltip("total_circ_count", ''); set("holds", ''); if (details.copy) { @@ -147,8 +155,28 @@ function load_item() { set("notes", details.copy.notes()); set("stat_cat_entry_copy_maps", details.copy.stat_cat_entry_copy_maps()); set("circulations", details.copy.circulations()); - set("total_circ_count", details.copy.total_circ_count()); set("holds", details.copy.holds()); + + network.simple_request('FM_CIRC_IMPROVED_COUNT_VIA_COPY', [ses(), { 'copy' : details.copy.id() } ], function(req) { + var r = req.getResultObject(); + var total = 0; var tooltip = ''; var year = {}; + for (var i = 0; i < r.length; i++) { + total += Number( r[i].count() ); + if (typeof year[ r[i].year() ] == 'undefined') year[ r[i].year() ] = 0; + year[ r[i].year() ] += r[i].count(); // Add original circs and renewals together + } + set( 'total_circ_count', total ); + var keys = []; for (var i in year) { keys.push( i ); }; keys.sort(); + for (var i = 0; i < keys.length; i++) { + tooltip += document.getElementById('circStrings').getFormattedString( + 'staff.circ.copy_details.circ_count_by_year', [ + keys[i] == -1 ? document.getElementById('circStrings').getString('staff.circ.copy_details.circ_count_by_year.legacy_label') : keys[i], + year[keys[i]] + ] + ) + '\n'; + } + set_tooltip( 'total_circ_count', tooltip ); + } ); } set("copies", ''); diff --git a/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul b/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul index 9052f41c07..60ecf3d379 100644 --- a/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul +++ b/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul @@ -31,6 +31,8 @@