CheckinItem handler
authorChris Cormack <chrisc@catalyst.net.nz>
Wed, 19 Mar 2014 21:07:56 +0000 (10:07 +1300)
committerChris Cormack <chrisc@catalyst.net.nz>
Wed, 19 Mar 2014 21:07:56 +0000 (10:07 +1300)
lib/NCIP/Handler/CheckInItem.pm
templates/problem.tt

index a71a7b1..8fdb5c4 100644 (file)
@@ -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 );
         }
index 0c8af19..6127e51 100644 (file)
@@ -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 %]
                
           </Value>