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

(-)a/C4/Circulation.pm (-11 / +10 lines)
Lines 877-883 sub CanBookBeIssued { Link Here
877
877
878
        my $patron = Koha::Patrons->find( $issue->borrowernumber );
878
        my $patron = Koha::Patrons->find( $issue->borrowernumber );
879
879
880
        my ( $can_be_returned, $message ) = CanBookBeReturned( $item_unblessed, C4::Context->userenv->{branch} );
880
        my ( $can_be_returned, $message ) = CanBookBeReturned( $item_object, C4::Context->userenv->{branch} );
881
881
882
        unless ( $can_be_returned ) {
882
        unless ( $can_be_returned ) {
883
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
883
            $issuingimpossible{RETURN_IMPOSSIBLE} = 1;
Lines 1120-1126 Check whether the item can be returned to the provided branch Link Here
1120
1120
1121
=over 4
1121
=over 4
1122
1122
1123
=item C<$item> is a hash of item information as returned Koha::Items->find->unblessed (Temporary, should be a Koha::Item instead)
1123
=item C<$item> is a Koha::Item object
1124
1124
1125
=item C<$branch> is the branchcode where the return is taking place
1125
=item C<$branch> is the branchcode where the return is taking place
1126
1126
Lines 1147-1161 sub CanBookBeReturned { Link Here
1147
  my $message;
1147
  my $message;
1148
1148
1149
  # identify all cases where return is forbidden
1149
  # identify all cases where return is forbidden
1150
  if ($allowreturntobranch eq 'homebranch' && $branch ne $item->{'homebranch'}) {
1150
  if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) {
1151
     $allowed = 0;
1151
     $allowed = 0;
1152
     $message = $item->{'homebranch'};
1152
     $message = $item->homebranch;
1153
  } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->{'holdingbranch'}) {
1153
  } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) {
1154
     $allowed = 0;
1154
     $allowed = 0;
1155
     $message = $item->{'holdingbranch'};
1155
     $message = $item->holdingbranch;
1156
  } elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->{'homebranch'} && $branch ne $item->{'holdingbranch'}) {
1156
  } elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) {
1157
     $allowed = 0;
1157
     $allowed = 0;
1158
     $message = $item->{'homebranch'}; # FIXME: choice of homebranch is arbitrary
1158
     $message = $item->homebranch; # FIXME: choice of homebranch is arbitrary
1159
  }
1159
  }
1160
1160
1161
  return ($allowed, $message);
1161
  return ($allowed, $message);
Lines 1361-1367 sub AddIssue { Link Here
1361
            if ( $actualissue and not $switch_onsite_checkout ) {
1361
            if ( $actualissue and not $switch_onsite_checkout ) {
1362
                # This book is currently on loan, but not to the person
1362
                # This book is currently on loan, but not to the person
1363
                # who wants to borrow it now. mark it returned before issuing to the new borrower
1363
                # who wants to borrow it now. mark it returned before issuing to the new borrower
1364
                my ( $allowed, $message ) = CanBookBeReturned( $item_unblessed, C4::Context->userenv->{branch} );
1364
                my ( $allowed, $message ) = CanBookBeReturned( $item_object, C4::Context->userenv->{branch} );
1365
                return unless $allowed;
1365
                return unless $allowed;
1366
                AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'} );
1366
                AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'} );
1367
            }
1367
            }
Lines 1924-1930 sub AddReturn { Link Here
1924
    }
1924
    }
1925
1925
1926
    # check if the return is allowed at this branch
1926
    # check if the return is allowed at this branch
1927
    my ($returnallowed, $message) = CanBookBeReturned($item_unblessed, $branch);
1927
    my ($returnallowed, $message) = CanBookBeReturned($item, $branch);
1928
    unless ($returnallowed){
1928
    unless ($returnallowed){
1929
        $messages->{'Wrongbranch'} = {
1929
        $messages->{'Wrongbranch'} = {
1930
            Wrongbranch => $branch,
1930
            Wrongbranch => $branch,
1931
- 

Return to bug 7376