2 use strict; use warnings;
3 use lib q|../../../perlmods/|;
4 use OpenILS::Utils::ScriptRunner;
5 use OpenILS::Utils::CStoreEditor qw/:funcs/;
6 use OpenILS::Application::Circ::ScriptBuilder;
7 use Time::HiRes qw/time/;
8 require '../oils_header.pl';
9 use vars qw/ $user $authtoken $apputils /;
11 my $events = 'result.events';
12 my $fatal_events = 'result.fatalEvents';
13 my $info_events = 'result.infoEvents';
16 # ---------------------------------------------------------------------
18 # ----------------------------------------------------------------------
20 my $patronid = 1000502;
22 my $patron_items_out = 11;
23 my $patron_overdue_count = 11;
24 my $patron_fines = 20;
26 # these are not currently tested in the scripts
31 # ---------------------------------------------------------------------
38 die "$0: <bootstrap> <script>\n" unless $script;
42 ($path, $script) = ($script =~ m#(/.*/)(.*)#);
44 osrf_connect($bsconfig);
47 my $runner = OpenILS::Application::Circ::ScriptBuilder->build(
50 patron_id => $patronid,
51 fetch_patron_circ_info => 1,
53 isNonCat => $is_non_cat,
54 isRenewal => $is_renewal,
55 nonCatType => $non_cat_type,
61 # ---------------------------------------------------------------------
62 # Override the default log functions for convenience
63 # ---------------------------------------------------------------------
64 $runner->insert(log_activity => sub { print "@_\n"; return 1;} );
65 $runner->insert(log_error => sub { print "@_\n"; return 1;} );
66 $runner->insert(log_warn => sub { print "@_\n"; return 1;} );
67 $runner->insert(log_info => sub { print "@_\n"; return 1;} );
68 $runner->insert(log_debug => sub { print "@_\n"; return 1;} );
69 $runner->insert(log_internal => sub { print "@_\n"; return 1;} );
72 $runner->add_path($path);
75 # ---------------------------------------------------------------------
77 # ---------------------------------------------------------------------
78 print "\nLoading script: $script\n";
79 print "\n" . '-'x70 . "\n";
81 $runner->load($script);
82 $runner->run or die "Script died: $@";
86 # ---------------------------------------------------------------------
87 # Print out any events that occurred
88 # ---------------------------------------------------------------------
89 print "\n" . '-'x70 . "\n";
91 show_events( 'events', $runner->retrieve($events));
92 show_events( 'fatal_events', $runner->retrieve($fatal_events));
93 show_events( 'info_events', $runner->retrieve($info_events));
95 print "\ntime = $end\n";
103 if($e and @e = split(/,/, $e)) {
104 print "$t : $_\n" for @e;
107 print "No $t occurred\n";
115 # don't forget these..
116 #$runner->insert( "$evt.isRenewal", $is_renewal );
117 #$runner->insert( "$evt.isNonCat", $is_non_cat );
118 #$runner->insert( "$evt.isHold", $is_hold );
119 #$runner->insert( "$evt.nonCatType", $non_cat_type );