utilities for testing circ and ahr events
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 28 May 2010 21:35:04 +0000 (21:35 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 28 May 2010 21:35:04 +0000 (21:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16535 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/support-scripts/test-scripts/print_ahr.pl [new file with mode: 0755]
Open-ILS/src/support-scripts/test-scripts/print_circ.pl [new file with mode: 0755]

diff --git a/Open-ILS/src/support-scripts/test-scripts/print_ahr.pl b/Open-ILS/src/support-scripts/test-scripts/print_ahr.pl
new file mode 100755 (executable)
index 0000000..5d39945
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+#----------------------------------------------------------------
+# Print AHR
+#----------------------------------------------------------------
+
+require '../oils_header.pl';
+use vars qw/$apputils/;
+use strict;
+use Data::Dumper;
+my $config             = shift; 
+my $username   = shift || 'admin';
+my $password   = shift || 'open-ils';
+my $hold_id       = shift;
+my $hook        = shift || 'ahr.format.history.print';
+my $granularity        = shift || 'print-on-demand';
+
+osrf_connect($config);
+oils_login($username, $password);
+my $e = OpenILS::Utils::CStoreEditor->new;
+
+my $hold = $e->retrieve_action_hold_request($hold_id) or oils_event_die($e->event);
+print "hook = $hook, gran = $granularity, hold = $hold, request_lib = " . $hold->request_lib . "\n";
+
+# args = $self, $event_def, $hook, $object, $context_org, $granularity, $user_data
+my $result = $apputils->fire_object_event(
+    undef,
+    $hook,
+    [ $hold ],
+    $hold->request_lib,
+    $granularity,
+    [] 
+);
+
+print Dumper($result) . "\n";
+
diff --git a/Open-ILS/src/support-scripts/test-scripts/print_circ.pl b/Open-ILS/src/support-scripts/test-scripts/print_circ.pl
new file mode 100755 (executable)
index 0000000..eeaa069
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+#----------------------------------------------------------------
+# Print CIRC
+#----------------------------------------------------------------
+
+require '../oils_header.pl';
+use vars qw/$apputils/;
+use strict;
+use Data::Dumper;
+my $config             = shift; 
+my $username   = shift || 'admin';
+my $password   = shift || 'open-ils';
+my $circ_id       = shift;
+my $hook        = shift || 'circ.format.history.print';
+my $granularity        = shift || 'print-on-demand';
+
+osrf_connect($config);
+oils_login($username, $password);
+my $e = OpenILS::Utils::CStoreEditor->new;
+
+my $circ = $e->retrieve_action_circulation($circ_id) or oils_event_die($e->event);
+print "hook = $hook, gran = $granularity, circ = $circ, circ_lib = " . $circ->circ_lib . "\n";
+
+# args = $self, $event_def, $hook, $object, $context_org, $granularity, $user_data
+my $result = $apputils->fire_object_event(
+    undef,
+    $hook,
+    [ $circ ],
+    $circ->circ_lib,
+    $granularity,
+    [] 
+);
+
+print Dumper($result) . "\n";
+