To support retrieval of billing details, OpenILS::SIP::Patron
objects need an auth token.
Teach OpenILS::SIP->find_patron to pass patron objects an auth
token, and also move existing "find patron by what key: barcode or
database id?" logic into find_patron (and out of
OpenILS::SIP::Patron->new).
Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
return $self->{authtoken} = $key;
}
+#
+# find_patron($barcode);
+# find_patron(barcode => $barcode); # same as above
+# find_patron(usr => $id);
sub find_patron {
my $self = shift;
- return OpenILS::SIP::Patron->new(@_);
+ my $key = (@_ > 1) ? shift : 'barcode'; # if we have multiple args, the first is the key index (default barcode)
+ my $patron_id = shift;
+
+ return OpenILS::SIP::Patron->new($key => $patron_id, authtoken => $self->{authtoken}, @_);
}
my $INET_PRIVS;
-#
-# OpenILS::SIP::Patron->new($barcode);
-# OpenILS::SIP::Patron->new(barcode => $barcode); # same as above
-# OpenILS::SIP::Patron->new( usr => $id);
-
sub new {
my $class = shift;
- my $key = (@_ > 1) ? shift : 'barcode'; # if we have multiple args, the first is the key index (default barcode)
+ my $key = shift;
my $patron_id = shift;
my %args = @_;
$self->flesh_user_penalties($user, $e) unless $args{slim_user};
+ $self->{authtoken} = $args{authtoken} if $args{authtoken};
$self->{editor} = $e;
$self->{user} = $user;
$self->{id} = ($key eq 'barcode') ? $patron_id : $user->card->barcode; # The barcode IS the ID to SIP.