my @ORG_LIST;
-
# -----------------------------------------------------------------------
# Possible Args:
# copy
$runner->insert("$evt.$_", $ctx->{_direct}->{$_}, 1) for keys %{$ctx->{_direct}};
- $ctx->{runner} = $runner;
-
- insert_org_methods( $editor, $ctx );
+ insert_org_methods( $editor, $runner );
return $runner;
}
sub insert_org_methods {
- my ( $editor, $ctx ) = @_;
- my $runner = $ctx->{runner};
+ my ( $editor, $runner ) = @_;
if(!$ORG_TREE) {
$ORG_TREE = $editor->search_actor_org_unit(
my $r = $runner;
weaken($r);
- $runner->insert(__OILS_FUNC_isOrgDescendent =>
+ $r->insert(__OILS_FUNC_isOrgDescendent =>
sub {
my( $write_key, $sname, $id ) = @_;
my ($parent) = grep { $_->shortname eq $sname } @ORG_LIST;
my ($child) = grep { $_->id == $id } @ORG_LIST;
my $val = is_org_descendent( $parent, $child );
- $r->insert($write_key, $val);
+ $r->insert($write_key, $val, 1);
return $val;
}
);
+
}
$logger->debug("Running permit_copy_hold on copy " . $$params{copy}->id);
load_scripts($runner);
- my $result = $runner->run or throw OpenSRF::EX::ERROR ("Hold Copy Permit Script Died: $@");
+ my $result = $runner->run or
+ throw OpenSRF::EX::ERROR ("Hold Copy Permit Script Died: $@");
- $runner->context->destroy;
+ $runner->cleanup;
# --------------------------------------------------------------
# Extract and uniquify the event list
{ local $/ = undef; $__json_js = <DATA>; }
+sub DESTROY {
+ my $self = shift;
+ $logger->info("script_runner destroying self: $self");
+}
+
+sub cleanup {
+ my $runner = shift;
+ $runner->context->destroy;
+ delete($$runner{$_}) for (keys %$runner);
+}
+
sub new {
my $class = shift;
my %params = @_;