From da10e38318098e5b7ceff05e4c9fd118aed2749f Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 28 May 2010 21:35:04 +0000 Subject: [PATCH] utilities for testing circ and ahr events git-svn-id: svn://svn.open-ils.org/ILS/trunk@16535 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/support-scripts/test-scripts/print_ahr.pl | 35 ++++++++++++++++++++++ .../src/support-scripts/test-scripts/print_circ.pl | 35 ++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100755 Open-ILS/src/support-scripts/test-scripts/print_ahr.pl create mode 100755 Open-ILS/src/support-scripts/test-scripts/print_circ.pl 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 index 0000000000..5d39945c09 --- /dev/null +++ b/Open-ILS/src/support-scripts/test-scripts/print_ahr.pl @@ -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 index 0000000000..eeaa069556 --- /dev/null +++ b/Open-ILS/src/support-scripts/test-scripts/print_circ.pl @@ -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"; + -- 2.11.0