View | Details | Raw Unified | Return to bug 7376
Collapse All | Expand All

(-)a/C4/Circulation.pm (-11 / +11 lines)
Lines 879-885 sub CanBookBeIssued { Link Here
879
879
880
        my $patron = Koha::Patrons->find( $issue->borrowernumber );
880
        my $patron = Koha::Patrons->find( $issue->borrowernumber );
881
881
882
        my ( $can_be_returned, $message ) = CanBookBeReturned( $item_unblessed, C4::Context->userenv->{branch} );
882
        my ( $can_be_returned, $message ) = CanBookBeReturned( $item_object, C4::Context->userenv->{branch} );
883
883
884
        unless ( $can_be_returned ) {
884
        unless ( $can_be_returned ) {
885
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
885
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
Lines 1131-1137 Check whether the item can be returned to the provided branch Link Here
1131
1131
1132
=over 4
1132
=over 4
1133
1133
1134
=item C<$item> is a hash of item information as returned Koha::Items->find->unblessed (Temporary, should be a Koha::Item instead)
1134
=item C<$item> is a Koha::Item object
1135
1135
1136
=item C<$branch> is the branchcode where the return is taking place
1136
=item C<$branch> is the branchcode where the return is taking place
1137
1137
Lines 1158-1172 sub CanBookBeReturned { Link Here
1158
  my $message;
1158
  my $message;
1159
1159
1160
  # identify all cases where return is forbidden
1160
  # identify all cases where return is forbidden
1161
  if ($allowreturntobranch eq 'homebranch' && $branch ne $item->{'homebranch'}) {
1161
  if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) {
1162
     $allowed = 0;
1162
     $allowed = 0;
1163
     $message = $item->{'homebranch'};
1163
     $message = $item->homebranch;
1164
  } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->{'holdingbranch'}) {
1164
  } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) {
1165
     $allowed = 0;
1165
     $allowed = 0;
1166
     $message = $item->{'holdingbranch'};
1166
     $message = $item->holdingbranch;
1167
  } elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->{'homebranch'} && $branch ne $item->{'holdingbranch'}) {
1167
  } elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) {
1168
     $allowed = 0;
1168
     $allowed = 0;
1169
     $message = $item->{'homebranch'}; # FIXME: choice of homebranch is arbitrary
1169
     $message = $item->homebranch; # FIXME: choice of homebranch is arbitrary
1170
  }
1170
  }
1171
1171
1172
  return ($allowed, $message);
1172
  return ($allowed, $message);
Lines 1379-1385 sub AddIssue { Link Here
1379
            if ( $actualissue and not $switch_onsite_checkout ) {
1379
            if ( $actualissue and not $switch_onsite_checkout ) {
1380
                # This book is currently on loan, but not to the person
1380
                # This book is currently on loan, but not to the person
1381
                # who wants to borrow it now. mark it returned before issuing to the new borrower
1381
                # who wants to borrow it now. mark it returned before issuing to the new borrower
1382
                my ( $allowed, $message ) = CanBookBeReturned( $item_unblessed, C4::Context->userenv->{branch} );
1382
                my ( $allowed, $message ) = CanBookBeReturned( $item_object, C4::Context->userenv->{branch} );
1383
                return unless $allowed;
1383
                return unless $allowed;
1384
                AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'} );
1384
                AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'} );
1385
            }
1385
            }
Lines 1953-1959 sub AddReturn { Link Here
1953
    }
1953
    }
1954
1954
1955
    # check if the return is allowed at this branch
1955
    # check if the return is allowed at this branch
1956
    my ($returnallowed, $message) = CanBookBeReturned($item->unblessed, $branch);
1956
    my ($returnallowed, $message) = CanBookBeReturned($item, $branch);
1957
1957
    unless ($returnallowed){
1958
    unless ($returnallowed){
1958
        $messages->{'Wrongbranch'} = {
1959
        $messages->{'Wrongbranch'} = {
1959
            Wrongbranch => $branch,
1960
            Wrongbranch => $branch,
1960
- 

Return to bug 7376