From 02e478cdef0d219069352d2114d615f400f9f226 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 6 Mar 2014 10:55:18 +1300 Subject: [PATCH] Koha specific driver work --- lib/NCIP/ILS/Koha.pm | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/NCIP/ILS/Koha.pm b/lib/NCIP/ILS/Koha.pm index e50f758..9c8d7db 100644 --- a/lib/NCIP/ILS/Koha.pm +++ b/lib/NCIP/ILS/Koha.pm @@ -44,12 +44,31 @@ sub userdata { return $userdata; } +sub userenv { + my $self = shift; + my @USERENV = ( + 1, + 'test', + 'MASTERTEST', + 'Test', + 'Test', + 'AS', #branchcode need to set this properly + 'Auckland', + 0, + ); + + C4::Context->_new_userenv('DUMMY_SESSION_ID'); + C4::Context->set_userenv(@USERENV); + return; +} + sub checkin { my $self = shift; my $barcode = shift; my $branch = shift; my $exemptfine = undef; my $dropbox = undef; + $self->userenv(); my ( $success, $messages, $issue, $borrower ) = AddReturn( $barcode, $branch, $exemptfine, $dropbox ); my $result = { @@ -69,20 +88,7 @@ sub checkout { my $borrower = GetMemberDetails( undef, $userid ); my $error; my $confirm; - my @USERENV = ( - 1, - 'test', - 'MASTERTEST', - 'Test', - 'Test', - 'AS', #branchcode need to set this properly - 'Auckland', - 0, - ); - - C4::Context->_new_userenv('DUMMY_SESSION_ID'); - C4::Context->set_userenv(@USERENV); - + $self->userenv(); if ($borrower) { ( $error, $confirm ) = CanBookBeIssued( $borrower, $barcode ); -- 2.11.0