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

(-)a/C4/Circulation.pm (-18 / +35 lines)
Lines 365-371 sub transferbook { Link Here
365
        ModItemTransfer( $itemnumber, $fbr, $tbr, $trigger );
365
        ModItemTransfer( $itemnumber, $fbr, $tbr, $trigger );
366
366
367
        # don't need to update MARC anymore, we do it in batch now
367
        # don't need to update MARC anymore, we do it in batch now
368
        $messages->{'WasTransfered'} = 1;
368
        $messages->{'WasTransfered'} = $tbr;
369
369
370
    }
370
    }
371
    ModDateLastSeen( $itemnumber );
371
    ModDateLastSeen( $itemnumber );
Lines 1881-1887 sub AddReturn { Link Here
1881
    my $messages;
1881
    my $messages;
1882
    my $patron;
1882
    my $patron;
1883
    my $doreturn       = 1;
1883
    my $doreturn       = 1;
1884
    my $validTransfert = 0;
1885
    my $stat_type = 'return';
1884
    my $stat_type = 'return';
1886
1885
1887
    # get information on item
1886
    # get information on item
Lines 2030-2052 sub AddReturn { Link Here
2030
    ModDateLastSeen( $item->itemnumber, $leave_item_lost );
2029
    ModDateLastSeen( $item->itemnumber, $leave_item_lost );
2031
2030
2032
    # check if we have a transfer for this document
2031
    # check if we have a transfer for this document
2033
    my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->itemnumber );
2032
    my $transfer = $item->get_transfer;
2034
2033
2035
    # if we have a transfer to do, we update the line of transfers with the datearrived
2034
    # if we have a transfer to do, we update the line of transfers with the datearrived
2036
    my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $item->itemnumber );
2035
    my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $item->itemnumber );
2037
    if ($datesent) {
2036
    if ($transfer) {
2038
        if ( $tobranch eq $branch ) {
2037
        if ( $transfer->in_transit ) {
2039
            my $sth = C4::Context->dbh->prepare(
2038
            if ( $transfer->tobranch eq $branch ) {
2040
                "UPDATE branchtransfers SET datearrived = now() WHERE itemnumber= ? AND datearrived IS NULL"
2039
                $transfer->receipt();
2041
            );
2040
2042
            $sth->execute( $item->itemnumber );
2041
                # if we have a reservation with completed transfer, we can set it's status to 'W'
2043
            # if we have a reservation with valid transfer, we can set it's status to 'W'
2042
                C4::Reserves::ModReserveStatus( $item->itemnumber, 'W' );
2044
            C4::Reserves::ModReserveStatus($item->itemnumber, 'W');
2043
            }
2045
        } else {
2044
            else {
2046
            $messages->{'WrongTransfer'}     = $tobranch;
2045
                $messages->{'WrongTransfer'}     = $transfer->tobranch;
2047
            $messages->{'WrongTransferItem'} = $item->itemnumber;
2046
                $messages->{'WrongTransferItem'} = $item->itemnumber;
2047
            }
2048
        }
2049
        else {
2050
            if ( $transfer->tobranch eq $branch ) {
2051
                $transfer->receipt();
2052
            }
2053
            else {
2054
                $messages->{'WasTransfered'}   = $transfer->tobranch;
2055
                $messages->{'TransferTrigger'} = $transfer->reason;
2056
            }
2048
        }
2057
        }
2049
        $validTransfert = 1;
2050
    }
2058
    }
2051
2059
2052
    # fix up the accounts.....
2060
    # fix up the accounts.....
Lines 2170-2176 sub AddReturn { Link Here
2170
    }
2178
    }
2171
2179
2172
    # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer
2180
    # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer
2173
    if (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'}){
2181
    if ( !$is_in_rotating_collection
2182
        && ( $doreturn or $messages->{'NotIssued'} )
2183
        and !$resfound
2184
        and ( $branch ne $returnbranch )
2185
        and not $messages->{'WrongTransfer'}
2186
        and not $messages->{'WasTransfered'} )
2187
    {
2174
        my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
2188
        my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
2175
        if  (C4::Context->preference("AutomaticItemReturn"    ) or
2189
        if  (C4::Context->preference("AutomaticItemReturn"    ) or
2176
            (C4::Context->preference("UseBranchTransferLimits") and
2190
            (C4::Context->preference("UseBranchTransferLimits") and
Lines 2179-2185 sub AddReturn { Link Here
2179
            $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s, %s)", $item->itemnumber,$branch, $returnbranch, $transfer_trigger;
2193
            $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s, %s)", $item->itemnumber,$branch, $returnbranch, $transfer_trigger;
2180
            $debug and warn "item: " . Dumper($item->unblessed);
2194
            $debug and warn "item: " . Dumper($item->unblessed);
2181
            ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger);
2195
            ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger);
2182
            $messages->{'WasTransfered'} = 1;
2196
            $messages->{'WasTransfered'} = $returnbranch;
2197
            $messages->{'TransferTrigger'} = $transfer_trigger;
2183
        } else {
2198
        } else {
2184
            $messages->{'NeedsTransfer'} = $returnbranch;
2199
            $messages->{'NeedsTransfer'} = $returnbranch;
2185
            $messages->{'TransferTrigger'} = $transfer_trigger;
2200
            $messages->{'TransferTrigger'} = $transfer_trigger;
Lines 3430-3436 sub GetTransfers { Link Here
3430
        SELECT datesent,
3445
        SELECT datesent,
3431
               frombranch,
3446
               frombranch,
3432
               tobranch,
3447
               tobranch,
3433
               branchtransfer_id
3448
               branchtransfer_id,
3449
               daterequested,
3450
               reason
3434
        FROM branchtransfers
3451
        FROM branchtransfers
3435
        WHERE itemnumber = ?
3452
        WHERE itemnumber = ?
3436
          AND datearrived IS NULL
3453
          AND datearrived IS NULL
(-)a/circ/returns.pl (-1 / +2 lines)
Lines 358-364 my $reserved = 0; Link Here
358
if ( $messages->{'WasTransfered'} ) {
358
if ( $messages->{'WasTransfered'} ) {
359
    $template->param(
359
    $template->param(
360
        found          => 1,
360
        found          => 1,
361
        transfer       => 1,
361
        transfer       => $messages->{'WasTransfered'},
362
        trigger        => $messages->{'TransferTrigger'},
362
        itemnumber     => $itemnumber,
363
        itemnumber     => $itemnumber,
363
    );
364
    );
364
}
365
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-3 / +21 lines)
Lines 106-111 Link Here
106
                                </div> <!-- /.hold-auto-filled -->
106
                                </div> <!-- /.hold-auto-filled -->
107
                            [% END # /IF hold_auto_filled %]
107
                            [% END # /IF hold_auto_filled %]
108
108
109
                            [% IF ( trigger ) %]
110
                                 <div id="transfer-trigger" class="dialog message">
111
                                     <h3>Reason for transfer</h3>
112
                                     <p>
113
                                         [%- SWITCH trigger -%]
114
                                             [%- CASE 'Manual' -%]Manual
115
                                             [%- CASE 'StockrotationAdvance' -%]Stock rotation advance
116
                                             [%- CASE 'StockrotationRepatriation' -%]Stock rotation repatriation
117
                                             [%- CASE 'ReturnToHome' -%]Return to home library
118
                                             [%- CASE 'ReturnToHolding' -%]Return to holding library
119
                                             [%- CASE 'RotatingCollection' -%]Rotating collection
120
                                             [%- CASE 'Reserve' -%]Reserve
121
                                             [%- CASE 'LostReserve' -%]Lost reserve
122
                                             [%- CASE 'CancelReserve' -%]Cancelled reserve
123
                                         [%- END -%]
124
                                     </p>
125
                                 </div>
126
                            [% END %]
127
109
                            [% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
128
                            [% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
110
                                <div class="dialog alert">
129
                                <div class="dialog alert">
111
                                    <strong>Error:</strong>
130
                                    <strong>Error:</strong>
Lines 494-500 Link Here
494
513
495
                                                <div class="modal-header">
514
                                                <div class="modal-header">
496
                                                    <h3>
515
                                                    <h3>
497
                                                        Please return this item to [% Branches.GetName( returnbranch ) | html %]
516
                                                        Please return this item to [% IF transfer %][% Branches.GetName( transfer ) | html %][% ELSE %][% Branches.GetName( returnbranch ) | html %][% END %]
498
                                                    </h3>
517
                                                    </h3>
499
                                                </div>
518
                                                </div>
500
                                                <div class="modal-body">
519
                                                <div class="modal-body">
Lines 521-527 Link Here
521
                                                        <button type="button" data-dismiss="modal" class="btn btn-default deny" name="notransfer" value="No"><i class="fa fa-times"></i> No</button>
540
                                                        <button type="button" data-dismiss="modal" class="btn btn-default deny" name="notransfer" value="No"><i class="fa fa-times"></i> No</button>
522
                                                    [% ELSE %]
541
                                                    [% ELSE %]
523
                                                        <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
542
                                                        <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
524
                                                        <button type="button" data-dismiss="modal" name="dotransfer" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | uri %]&amp;branchcode=[% returnbranch | uri %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button>
543
                                                        <button type="button" data-dismiss="modal" name="dotransfer" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | uri %]&amp;branchcode=[% transfer | uri %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button>
525
                                                    [% END %]
544
                                                    [% END %]
526
                                                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
545
                                                    <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
527
                                                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
546
                                                    <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
528
- 

Return to bug 24446