# checkin the item
my $checkin = $self->ils->checkin( $userid, $itemid );
+ my $output;
my $vars;
$vars->{'messagetype'} = 'CheckInItemResponse';
- $vars->{'elements'} = \@elements;
- $vars->{'checkin'} = $checkin;
- my $output = $self->render_output( 'response.tt', $vars );
+
+ if ( !$checkin->{success} ) {
+
+ $output = $self->render_output( 'problem.tt', $vars );
+ }
+ else {
+
+ $vars->{'elements'} = \@elements;
+ $vars->{'checkin'} = $checkin;
+ $output = $self->render_output( 'response.tt', $vars );
+ }
return $output;
}
}
sub checkin {
my $self = shift;
my $barcode = shift;
- my $result = AddReturn( $barcode, $branch, $exemptfine, $dropbox );
+ my ($success, $messages, $issue, $borrower) = AddReturn( $barcode, $branch, $exemptfine, $dropbox );
+ my $result = { success => $success, messages => $messages, iteminformation => $issue, borrower=> $borrower};
+ return $result;
}
sub checkout {
--- /dev/null
+<DateDue>[% date_due %]</DateDue>
+<UserOptionalFields>
+</UserOptionalFields>
[% INCLUDE 'includes/header.inc' %]
<NCIPMessage>
- <Problem>
- <ProblemDetail>[% error_detail %]</ProblemDetail>
- </Problem>
-
+ <[% messagetype %]>
+ [% IF processingerror %]
+ <Problem>
+ <ProcessingError>
+ <ProcessingErrorType>
+ <Value>[% processingerrortype %]</Value>
+ </ProcessingErrorType>
+ <ProcessingErrorElement>
+ <ElementName>[% processingerrorelement %]</ElementName>
+ <ProcessingErrorValue>[% processingerrorvalue %]</ProcessingErrorValue>
+ </ProcessingErrorElement>
+ </ProcessingError>
+ <ProblemDetail>[% error_detail %]</ProblemDetail>
+ </Problem>
+ </[% messagetype %]>
</NCIPMessage>