=cut
-
use Modern::Perl;
use NCIP::Handler;
-use NCIP::Item;
+use NCIP::User;
our @ISA = qw(NCIP::Handler);
my $self = shift;
my $xmldoc = shift;
if ($xmldoc) {
+
# Given our xml document, lets find the itemid
my ($user_id) =
$xmldoc->getElementsByTagNameNS( $self->namespace(),
'UserIdentifierValue' );
- warn $user_id->textContent();
-# my $item = NCIP::User->new( { itemid => $user_id->textContent(), ils => $self->ils} );
-# my ($itemdata,$error) = $item->itemdata();
-# if ($error){
-# handle error here
-# }
-# warn $user->itemid();
+
+ my $user = NCIP::User->new(
+ { userid => $user_id->textContent(), ils => $self->ils } );
+ $user->initialise();
+ use Data::Dumper;
+ warn Dumper $user->userdata();
+ return $user->userid();
}
- return $self->type;
}
1;
use Modern::Perl;
use Object::Tiny qw{ name };
+use C4::Members qw{ GetMemberDetails };
sub itemdata {
my $self = shift;
- return ( {barcode=>'123',title=>'fish'}, undef);
+ return ( { barcode => '123', title => 'fish' }, undef );
}
+
+sub userdata {
+ my $self = shift;
+ my $userid = shift;
+ my $userdata = GetMemberDetails( undef, $userid );
+ return $userdata;
+}
+
1;
# User Id
# Make accessors for the ones that makes sense
-NCIP::User->mk_accessors(qw(firstname surname address language privilege userid dateofbirth));
+NCIP::User->mk_accessors(qw(userid ils userdata));
+
+sub initialise {
+ my $self = shift;
+ my $ils = $self->ils;
+ my ( $userdata, $error ) = $ils->userdata( $self->userid );
+ $self->{'userdata'} = $userdata;
+
+}
sub authentication {
}
}
sub status {
- # Is the user blocked
- # if so, why
+
+ # Is the user blocked
+ # if so, why
}
1;
my $lookupuser = read_file('t/sample_data/LookupUser.xml') || die "Cant open file";
ok( $response = $ncip->process_request($lookupuser), 'Try looking up a user' );
-is( $response, 'LookupUser', 'We got lookupuser' );
+is( $response, 'FLO-WHEELOCK', 'Got the user we expected' );