From b567cd0489074759da5bba0bf5201dcdd4505fb3 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 20 Mar 2014 10:07:56 +1300 Subject: [PATCH] CheckinItem handler --- lib/NCIP/Handler/CheckInItem.pm | 21 ++++++++++++--------- templates/problem.tt | 2 ++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/NCIP/Handler/CheckInItem.pm b/lib/NCIP/Handler/CheckInItem.pm index a71a7b1..8fdb5c4 100644 --- a/lib/NCIP/Handler/CheckInItem.pm +++ b/lib/NCIP/Handler/CheckInItem.pm @@ -23,21 +23,24 @@ sub handle { my $self = shift; my $xmldoc = shift; if ($xmldoc) { - my $root = $xmldoc->documentElement(); - my $xpc = $self->xpc(); - my $itemid = - $xpc->findnodes('//ns:ItemId',$root); + my $root = $xmldoc->documentElement(); + my $xpc = $self->xpc(); + my $itemid = $xpc->findnodes( '//ns:ItemIdentifierValue', $root ); # checkin the item - my $branch='AS'; # where the hell do we get this from??? - my $checkin = $self->ils->checkin( $itemid,$branch ); + my $branch = 'AS'; # where the hell do we get this from??? + my $checkin = $self->ils->checkin( $itemid, $branch ); my $output; my $vars; $vars->{'messagetype'} = 'CheckInItemResponse'; - $vars->{'barcode'} = $itemid; + $vars->{'barcode'} = $itemid; + my ( $from, $to ) = $self->get_agencies($xmldoc); + $vars->{'fromagency'} = $to; + $vars->{'toagency'} = $from; + if ( !$checkin->{success} ) { - $vars->{'processingerror'} = 1; - $vars->{'processingerrortype'} = $checkin->{'messages'}; + $vars->{'processingerror'} = 1; + $vars->{'processingerrortype'} = $checkin->{'messages'}; $vars->{'processingerrorelement'} = 'UniqueItemIdentifier'; $output = $self->render_output( 'problem.tt', $vars ); } diff --git a/templates/problem.tt b/templates/problem.tt index 0c8af19..6127e51 100644 --- a/templates/problem.tt +++ b/templates/problem.tt @@ -19,6 +19,8 @@ There is no hold on this item [% CASE 'NO_HOLD_BORROWER' %] We can not place a hold, we have no borrower information + [% CASE 'Wrongbranch' %] + We are trying to check this item in at the wrong branch [% END %] -- 2.11.0