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

(-)a/C4/Circulation.pm (-5 / +4 lines)
Lines 2077-2090 sub AddReturn { Link Here
2077
    # if we have a transfer to do, we update the line of transfers with the datearrived
2077
    # if we have a transfer to do, we update the line of transfers with the datearrived
2078
    my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $item->itemnumber );
2078
    my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $item->itemnumber );
2079
    if ($datesent) {
2079
    if ($datesent) {
2080
        # At this point we will either fill the transfer or it is a wrong transfer
2081
        # either way we should not now generate a new transfer
2082
        $validTransfer = 0;
2080
        if ( $tobranch eq $branch ) {
2083
        if ( $tobranch eq $branch ) {
2081
            my $sth = C4::Context->dbh->prepare(
2084
            my $sth = C4::Context->dbh->prepare(
2082
                "UPDATE branchtransfers SET datearrived = now() WHERE itemnumber= ? AND datearrived IS NULL"
2085
                "UPDATE branchtransfers SET datearrived = now() WHERE itemnumber= ? AND datearrived IS NULL"
2083
            );
2086
            );
2084
            $sth->execute( $item->itemnumber );
2087
            $sth->execute( $item->itemnumber );
2085
2086
            # If we are completing a transfer we should not generate a new transfer from return policy
2087
            $validTransfer = 0;
2088
        } else {
2088
        } else {
2089
            $messages->{'WrongTransfer'}     = $tobranch;
2089
            $messages->{'WrongTransfer'}     = $tobranch;
2090
            $messages->{'WrongTransferItem'} = $item->itemnumber;
2090
            $messages->{'WrongTransferItem'} = $item->itemnumber;
Lines 2211-2217 sub AddReturn { Link Here
2211
    }
2211
    }
2212
2212
2213
    # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer
2213
    # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer
2214
    if ($validTransfer && !$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'}){
2214
    if ($validTransfer && !$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) ){
2215
        my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
2215
        my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
2216
        if  (C4::Context->preference("AutomaticItemReturn"    ) or
2216
        if  (C4::Context->preference("AutomaticItemReturn"    ) or
2217
            (C4::Context->preference("UseBranchTransferLimits") and
2217
            (C4::Context->preference("UseBranchTransferLimits") and
2218
- 

Return to bug 26078