From 65bc505abfe365ad165f13f3fbba4d2c9d066769 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 13 Jan 2014 08:25:20 +1300 Subject: [PATCH] Continuing on with the work --- lib/NCIP/Handler/CheckInItem.pm | 15 ++++++++++++--- lib/NCIP/ILS/Koha.pm | 4 +++- templates/includes/CheckOutItemResponse.inc | 3 +++ templates/problem.tt | 19 +++++++++++++++---- 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 templates/includes/CheckOutItemResponse.inc diff --git a/lib/NCIP/Handler/CheckInItem.pm b/lib/NCIP/Handler/CheckInItem.pm index 89581d2..88cd8bc 100644 --- a/lib/NCIP/Handler/CheckInItem.pm +++ b/lib/NCIP/Handler/CheckInItem.pm @@ -32,11 +32,20 @@ sub handle { # 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; } } diff --git a/lib/NCIP/ILS/Koha.pm b/lib/NCIP/ILS/Koha.pm index da1276c..38a4342 100644 --- a/lib/NCIP/ILS/Koha.pm +++ b/lib/NCIP/ILS/Koha.pm @@ -37,7 +37,9 @@ sub userdata { 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 { diff --git a/templates/includes/CheckOutItemResponse.inc b/templates/includes/CheckOutItemResponse.inc new file mode 100644 index 0000000..9659b3f --- /dev/null +++ b/templates/includes/CheckOutItemResponse.inc @@ -0,0 +1,3 @@ +[% date_due %] + + diff --git a/templates/problem.tt b/templates/problem.tt index a626a74..4da5935 100644 --- a/templates/problem.tt +++ b/templates/problem.tt @@ -1,8 +1,19 @@ [% INCLUDE 'includes/header.inc' %] - - [% error_detail %] - - + <[% messagetype %]> + [% IF processingerror %] + + + + [% processingerrortype %] + + + [% processingerrorelement %] + [% processingerrorvalue %] + + + [% error_detail %] + + -- 2.11.0