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

(-)a/C4/Circulation.pm (-7 / +5 lines)
Lines 1923-1929 sub AddReturn { Link Here
1923
    my $messages;
1923
    my $messages;
1924
    my $patron;
1924
    my $patron;
1925
    my $doreturn       = 1;
1925
    my $doreturn       = 1;
1926
    my $validTransfert = 0;
1926
    my $validTransfer = 1;
1927
    my $stat_type = 'return';
1927
    my $stat_type = 'return';
1928
1928
1929
    # get information on item
1929
    # get information on item
Lines 2077-2095 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
            $returnbranch = $branch;
2088
        } else {
2088
        } else {
2089
            $messages->{'WrongTransfer'}     = $tobranch;
2089
            $messages->{'WrongTransfer'}     = $tobranch;
2090
            $messages->{'WrongTransferItem'} = $item->itemnumber;
2090
            $messages->{'WrongTransferItem'} = $item->itemnumber;
2091
        }
2091
        }
2092
        $validTransfert = 1;
2093
    }
2092
    }
2094
2093
2095
    # fix up the accounts.....
2094
    # fix up the accounts.....
Lines 2212-2218 sub AddReturn { Link Here
2212
    }
2211
    }
2213
2212
2214
    # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer
2213
    # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer
2215
    if (!$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) ){
2216
        my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
2215
        my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
2217
        if  (C4::Context->preference("AutomaticItemReturn"    ) or
2216
        if  (C4::Context->preference("AutomaticItemReturn"    ) or
2218
            (C4::Context->preference("UseBranchTransferLimits") and
2217
            (C4::Context->preference("UseBranchTransferLimits") and
2219
- 

Return to bug 26078