[open-ils-commits] r14222 - in trunk/Open-ILS/xul/staff_client: chrome/content/main server/circ server/locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 30 11:34:02 EDT 2009


Author: phasefx
Date: 2009-09-30 11:33:59 -0400 (Wed, 30 Sep 2009)
New Revision: 14222

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
   trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
Log:
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.



Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-09-30 14:41:53 UTC (rev 14221)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-09-30 15:33:59 UTC (rev 14222)
@@ -186,6 +186,7 @@
 	'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 },

Modified: trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js	2009-09-30 14:41:53 UTC (rev 14221)
+++ trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js	2009-09-30 15:33:59 UTC (rev 14222)
@@ -28,6 +28,13 @@
     }
 }
 
+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 @@
         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 @@
             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", '');

Modified: trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul	2009-09-30 14:41:53 UTC (rev 14221)
+++ trunk/Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul	2009-09-30 15:33:59 UTC (rev 14222)
@@ -31,6 +31,8 @@
 	<script type="text/javascript" src="/xul/server/main/JSAN.js"/>
 	<script type="text/javascript" src="alternate_copy_summary.js"/>
 
+    <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties"/>
+
     <groupbox flex="1">
 
         <caption label="Alternate View" />
@@ -141,7 +143,7 @@
                                 <label value="Holdable" />
                                 <textbox name="holdable" readonly="true" context="clipboard"/>
                                 <label value="Total Circs" />
-                                <textbox name="total_circs" readonly="true" context="clipboard"/>
+                                <textbox name="total_circ_count" readonly="true" context="clipboard"/>
                                 <label value="Checkin Scan Time" />
                                 <textbox name="checkin_scan_time" readonly="true" context="clipboard"/>
                             </row>

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties	2009-09-30 14:41:53 UTC (rev 14221)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties	2009-09-30 15:33:59 UTC (rev 14222)
@@ -81,6 +81,8 @@
 staff.circ.copy_details.user_details=%1$s, %2$s : %3$s
 staff.circ.copy_details.bad_hold_status=This item is not captured for a hold, however its status is incorrectly set to "On Holds Shelf".  Please check this item in to correct the status.
 staff.circ.copy_details.no_hold=This item is not captured for a hold.
+staff.circ.copy_details.circ_count_by_year=%1$s : %2$s
+staff.circ.copy_details.circ_count_by_year.legacy_label=Legacy/Not Dated
 staff.circ.copy_status.tab_name=Item Status
 staff.circ.copy_status.action.complete=Action complete.
 staff.circ.copy_status.sel_checkin.error=Checkin did not likely happen.



More information about the open-ils-commits mailing list