return [map { $ordering_hash{$_} } @$id_list];
}
+# returns undef on success, Event on error
+sub log_user_activity {
+ my ($class, $user_id, $who, $what, $e, $async) = @_;
+
+ my $commit = 0;
+ if (!$e) {
+ $e = OpenILS::Utils::CStoreEditor->new(xact => 1);
+ $commit = 1;
+ }
+
+ my $res = $e->json_query({
+ from => [
+ 'actor.insert_usr_activity',
+ $user_id, $who, $what, OpenSRF::AppSession->ingress
+ ]
+ });
+
+ if ($res) { # call returned OK
+
+ $e->commit if $commit and @$res;
+ $e->rollback if $commit and !@$res;
+
+ } else {
+ return $e->die_event;
+ }
+
+ return undef;
+}
+
1;
my $editor;
my $config;
+my $login_account;
my $target_encoding; # FIXME: this is configured at the institution level.
use Digest::MD5 qw(md5_hex);
my $type = ref($class) || $class;
my $self = {};
- $self->{login} = $login;
+ $self->{login} = $login_account = $login;
$config = $institution;
syslog("LOG_DEBUG", "OILS: new ILS '%s'", $institution->{id});
sub config {
return $config;
}
+sub login_account {
+ return $login_account;
+}
sub get_option_value {
my($self, $option) = @_;
syslog("LOG_DEBUG", "OILS: new OpenILS Patron(%s => %s): found patron : barred=%s, card:active=%s",
$key, $patron_id, $user->barred, $user->card->active );
+ $U->log_user_activity($user->id, $self->get_act_who, 'verify');
+
return $self;
}
+sub get_act_who {
+ my $self = shift;
+ my $config = OpenILS::SIP->config();
+ my $login = OpenILS::SIP->login_account();
+
+ my $act_who = $config->{implementation_config}->{default_activity_who};
+ my $force_who = $config->{implementation_config}->{force_activity_who};
+
+ # 1. future: test sip extension for caller-provided ewho and !$force_who
+
+ # 2. See if the login is tagged with an ewho
+ return $login->{activity_who} if $login->{activity_who};
+
+ # 3. if all else fails, see if there is an institution-wide ewho
+ return $config->{activity_who} if $config->{activity_who};
+
+ return undef;
+}
+
# grab patron penalties. Only grab non-archived penalties that are for fines,
# excessive overdues, or otherwise block circluation activity
sub flesh_user_penalties {