2 use strict; use warnings;
3 use lib q|../../../perlmods/|;
4 use Time::HiRes qw/time/;
5 use OpenILS::Application::Circ::ScriptBuilder;
6 require '../oils_header.pl';
7 use vars qw/ $user $authtoken $apputils /;
9 # ---------------------------------------------------------------------
11 # ----------------------------------------------------------------------
13 my $patronid = 1000502;
15 my $patron_items_out = 11;
16 my $patron_overdue_count = 11;
17 my $patron_fines = 20;
19 # these are not currently tested in the scripts
24 # ---------------------------------------------------------------------
31 die "$0: <bootstrap> <script>\n" unless $script;
35 ($path, $script) = ($script =~ m#(/.*/)(.*)#);
37 osrf_connect($bsconfig);
40 #use OpenILS::Utils::ScriptRunner;
41 #my $r = OpenILS::Utils::ScriptRunner->new;
43 #$r->load($script) or die "Script died: $@";
44 #$r->run or die "Script died: $@";
49 my $runner = OpenILS::Application::Circ::ScriptBuilder->build(
52 patron_id => $patronid,
53 fetch_patron_circ_info => 1,
55 isNonCat => $is_non_cat,
56 isRenewal => $is_renewal,
57 nonCatType => $non_cat_type,
63 # ---------------------------------------------------------------------
64 # Override the default log functions for convenience
65 # ---------------------------------------------------------------------
66 $runner->insert(log_activity => sub { print "@_\n"; return 1;} );
67 $runner->insert(log_error => sub { print "@_\n"; return 1;} );
68 $runner->insert(log_warn => sub { print "@_\n"; return 1;} );
69 $runner->insert(log_info => sub { print "@_\n"; return 1;} );
70 $runner->insert(log_debug => sub { print "@_\n"; return 1;} );
71 $runner->insert(log_internal => sub { print "@_\n"; return 1;} );
74 $runner->add_path('/openils/var/web/opac/common/js');
75 $runner->add_path($path);
76 $runner->add_path("$path/../catalog/");
79 # ---------------------------------------------------------------------
81 # ---------------------------------------------------------------------
82 print "\nLoading script: $script\n";
83 print "\n" . '-'x70 . "\n";
85 $runner->load($script);
86 my $result = $runner->run or die "Script died: $@";
91 # ---------------------------------------------------------------------
92 # Print out any events that occurred
93 # ---------------------------------------------------------------------
94 print "\n" . '-'x70 . "\n";
96 my $events = $result->{events};
97 my $ievents = $result->{infoEvents};
98 my $fevents = $result->{fatalEvents};
100 print "events = @$events\n";
101 print "info events = @$ievents\n";
102 print "fatal events = @$fevents\n";
104 print "\ntime = $end\n";
111 if($e and @e = split(/,/, $e)) {
112 print "$t : $_\n" for @e;
115 print "No $t occurred\n";