[open-ils-commits] r8930 - in trunk/Open-ILS/src:
javascript/backend/circ perlmods/OpenILS/Application/Circ
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Mar 8 20:36:22 EST 2008
Author: erickson
Date: 2008-03-08 20:03:32 -0500 (Sat, 08 Mar 2008)
New Revision: 8930
Modified:
trunk/Open-ILS/src/javascript/backend/circ/circ_lib.js
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm
Log:
initial checkouts-by-circ-mods support
Modified: trunk/Open-ILS/src/javascript/backend/circ/circ_lib.js
===================================================================
--- trunk/Open-ILS/src/javascript/backend/circ/circ_lib.js 2008-03-09 00:40:47 UTC (rev 8929)
+++ trunk/Open-ILS/src/javascript/backend/circ/circ_lib.js 2008-03-09 01:03:32 UTC (rev 8930)
@@ -205,8 +205,13 @@
return false;
}
+/* returns a dictionary of circmod : count for checked out items */
+function checkoutsByCircModifier(userid) {
+ var key = scratchKey();
+ __OILS_FUNC_userCircsByCircmod(scratchPad(key), userid);
+ return getScratch(key);
+}
-
/* useful for testing */
function die(msg) {
log_error("die(): "+msg);
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm 2008-03-09 00:40:47 UTC (rev 8929)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm 2008-03-09 01:03:32 UTC (rev 8930)
@@ -390,6 +390,45 @@
return $val;
}
);
+
+ $runner->insert(__OILS_FUNC_userCircsByCircmod =>
+ sub {
+ my( $write_key, $userid ) = @_;
+
+ # this bug ugly thing generates a count of checkouts by circ_modifier
+ my $query = {
+ "select" => {
+ "acp" => ["circ_modifier"]
+ "circ"=>[{
+ "aggregate"=>1,
+ "transform"=>"count",
+ "alias"=>"count",
+ "column"=>"id"
+ }],
+ },
+ "from"=>{"acp"=>{"circ"=>{"field"=>"target_copy","fkey"=>"id"}}},
+ "where"=>{
+ "+circ"=>{
+ "checkin_time"=>undef,
+ "usr"=>$userid,
+ "-or"=>[
+ {"stop_fines"=>["LOST","LONGOVERDUE","CLAIMSRETURNED"]},
+ {"stop_fines"=>undef}
+ ]
+ }
+ }
+ };
+
+ my $mods = $e->json_query($query);
+ my $breakdown = {};
+ $breakdown->{$_->{circ_modifier}} = $_->{count} for @$mods;
+ use OpenSRF::Utils::JSON;
+ $logger->info("script_runner: Loaded checkouts by circ_modifier breakdown:".
+ OpenSRF::Utils::JSON->perl2JSON($breakdown));
+ $runner->insert($write_key, $breakdown, 1) if (keys %$breakdown);
+ }
+ );
+
}
More information about the open-ils-commits
mailing list