# We have invalid xml, or we can't figure out what kind of request this is
# Handle error here
- warn "We can't find request type";
+# warn "We can't find request type";
my $output = $self->_error("We can't find request type");
return $output;
}
if ( $strict_validation && !$self->validate($dom) ) {
# we want strict validation, bail out if dom doesnt validate
- warn " Not valid xml";
+# warn " Not valid xml";
# throw/log error
return;
$dom->getElementsByTagNameNS( $self->namespace(), 'NCIPMessage' );
if ($nodes) {
my @childnodes = $nodes->[0]->childNodes();
- if ( $childnodes[0] ) {
- return $childnodes[0]->localname();
+ if ( $childnodes[1] ) {
+ return $childnodes[1]->localname();
}
else {
warn "Got a node, but no child node";
my ($user_id) =
$xmldoc->getElementsByTagNameNS( $self->namespace(),
'UserIdentifierValue' );
+ my $xpc = XML::LibXML::XPathContext->new;
+ $xpc->registerNs( 'ns', $self->namespace() );
+ unless ($user_id) {
+
+ # We may get a password, username combo instead of userid
+ # Need to deal with that also
+ my $root = $xmldoc->documentElement();
+ my @authtypes =
+ $xpc->findnodes( '//ns:AuthenticationInput', $root );
+ my $barcode;
+ my $pin;
+ foreach my $node (@authtypes) {
+ my $class =
+ $xpc->findnodes( './ns:AuthenticationInputType', $node );
+ my $value =
+ $xpc->findnodes( './ns:AuthenticationInputData', $node );
+ if ( $class->[0]->textContent eq 'Barcode Id' ) {
+ $barcode = $value->[0]->textContent;
+ }
+ elsif ( $class->[0]->textContent eq 'PIN' ) {
+ $pin = $value->[0]->textContent;
+ }
+
+ }
+ $user_id = $barcode;
+ }
# We may get a password, username combo instead of userid
# Need to deal with that also
# if we have blank user, we need to return that
# and can skip looking for elementtypes
-
- my $root = $xmldoc->documentElement();
- my @elements = $root->findnodes('LookupUser/UserElementType/Value');
+ if ( $user->userdata->{'borrowernumber'} eq '' ) {
+ my $vars;
+ $vars->{'messagetype'} = 'LookupUser';
+ $vars->{'error_detail'} = "Borrower not found";
+ my $output = $self->render_output( 'problem.tt', $vars );
+ return $output;
+ }
+
+ my $root = $xmldoc->documentElement();
+ my @elements =
+ $xpc->findnodes( 'ns:LookupUser/UserElementType/Value', $root );
#set up the variables for our template
my $vars;
use C4::Members qw{ GetMemberDetails };
use C4::Circulation qw { AddReturn CanBookBeIssued AddIssue };
use C4::Context;
+use C4::Items qw { GetItem };
sub itemdata {
- my $self = shift;
- return ( { barcode => '123', title => 'fish' }, undef );
+ my $self = shift;
+ my $barcode = shift;
+ my $itemdata = GetItem( undef, $barcode );
+ if ($itemdata) {
+ return ( $itemdata, undef );
+ }
+ else {
+ return ( undef, 1 ); # item not found error
+ }
}
sub userdata {
my $borrower = GetMemberDetails( undef, $userid );
my $error;
my $confirm;
- my (
- $usernum, $userid, $usercnum, $userfirstname,
- $usersurname, $userbranch, $branchname, $userflags,
- $emailaddress, $branchprinter, $persona
- ) = @_;
my @USERENV = (
1,
'test',
}
else {
-#handle stuff here
+ #handle stuff here
}
}
1;
</version>
<ils value='Koha' />
- <namespace value= '' />
+ <namespace value= 'http://www.niso.org/2008/ncip' />
<templates value= 'templates/' />
</acsconfig>