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

(-)a/C4/Circulation.pm (-10 / +10 lines)
Lines 1574-1579 sub AddReturn { Link Here
1574
    # check if we have a transfer for this document
1574
    # check if we have a transfer for this document
1575
    my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} );
1575
    my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} );
1576
1576
1577
    # find reserves.....
1578
    # if we don't have a reserve with the status W, we launch the Checkreserves routine
1579
    my ($resfound, $resrec) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
1580
    if ($resfound) {
1581
          $resrec->{'ResFound'} = $resfound;
1582
        $messages->{'ResFound'} = $resrec;
1583
    }
1584
1577
    # if we have a transfer to do, we update the line of transfers with the datearrived
1585
    # if we have a transfer to do, we update the line of transfers with the datearrived
1578
    if ($datesent) {
1586
    if ($datesent) {
1579
        if ( $tobranch eq $branch ) {
1587
        if ( $tobranch eq $branch ) {
Lines 1583-1589 sub AddReturn { Link Here
1583
            $sth->execute( $item->{'itemnumber'} );
1591
            $sth->execute( $item->{'itemnumber'} );
1584
            # if we have a reservation with valid transfer, we can set it's status to 'W'
1592
            # if we have a reservation with valid transfer, we can set it's status to 'W'
1585
            C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W');
1593
            C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W');
1586
        } else {
1594
        } elsif ( !($resrec && $resrec->{branchcode} eq $tobranch) ) {
1595
            # Do not raise WrongTransfer if it is transrerring to reserve branch
1587
            $messages->{'WrongTransfer'}     = $tobranch;
1596
            $messages->{'WrongTransfer'}     = $tobranch;
1588
            $messages->{'WrongTransferItem'} = $item->{'itemnumber'};
1597
            $messages->{'WrongTransferItem'} = $item->{'itemnumber'};
1589
        }
1598
        }
Lines 1606-1619 sub AddReturn { Link Here
1606
        $messages->{'Debarred'} = $debardate if ($debardate);
1615
        $messages->{'Debarred'} = $debardate if ($debardate);
1607
    }
1616
    }
1608
1617
1609
    # find reserves.....
1610
    # if we don't have a reserve with the status W, we launch the Checkreserves routine
1611
    my ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
1612
    if ($resfound) {
1613
          $resrec->{'ResFound'} = $resfound;
1614
        $messages->{'ResFound'} = $resrec;
1615
    }
1616
1617
    # update stats?
1618
    # update stats?
1618
    # Record the fact that this book was returned.
1619
    # Record the fact that this book was returned.
1619
    UpdateStats(
1620
    UpdateStats(
1620
- 

Return to bug 6489