Setting the correct branch on CheckOut
authorChris Cormack <chrisc@catalyst.net.nz>
Wed, 16 Jul 2014 23:49:51 +0000 (11:49 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Wed, 16 Jul 2014 23:49:51 +0000 (11:49 +1200)
lib/NCIP/ILS/Koha.pm

index a5f5590..24b708b 100644 (file)
@@ -53,13 +53,14 @@ sub userdata {
 
 sub userenv {
     my $self    = shift;
+    my $branch = shift || 'AS';
     my @USERENV = (
         1,
         'test',
         'MASTERTEST',
         'Test',
         'Test',
-        'AS',    #branchcode need to set this properly
+         $branch,    #branchcode need to set this properly
         'Auckland',
         0,
     );
@@ -93,15 +94,14 @@ sub checkout {
     my $userid   = shift;
     my $barcode  = shift;
     my $borrower = GetMemberDetails( undef, $userid );
+    my $item = GetItem( undef, $barcode);
     my $error;
     my $confirm;
-    $self->userenv();
+    $self->userenv($item->{holdingbranch});
     if ($borrower) {
 
         ( $error, $confirm ) = CanBookBeIssued( $borrower, $barcode );
 
-  #( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower,
-  #                      $barcode, $duedatespec, $inprocess, $ignore_reserves );
         if (%$error) {
 
             # Can't issue item, return error hash