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

(-)a/C4/Circulation.pm (-2 / +4 lines)
Lines 1882-1887 sub AddReturn { Link Here
1882
        # get the proper branch to which to return the item
1882
        # get the proper branch to which to return the item
1883
    my $returnbranch = $hbr ne 'noreturn' ? $item->$hbr : $branch;
1883
    my $returnbranch = $hbr ne 'noreturn' ? $item->$hbr : $branch;
1884
        # if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch)
1884
        # if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch)
1885
    my $transfer_trigger = $hbr eq 'homebranch' ? 'ReturnToHome' : $hbr eq 'holdingbranch' ? 'ReturnToHolding' : undef;
1885
1886
1886
    my $borrowernumber = $patron ? $patron->borrowernumber : undef;    # we don't know if we had a borrower or not
1887
    my $borrowernumber = $patron ? $patron->borrowernumber : undef;    # we don't know if we had a borrower or not
1887
    my $patron_unblessed = $patron ? $patron->unblessed : {};
1888
    my $patron_unblessed = $patron ? $patron->unblessed : {};
Lines 2115-2126 sub AddReturn { Link Here
2115
            (C4::Context->preference("UseBranchTransferLimits") and
2116
            (C4::Context->preference("UseBranchTransferLimits") and
2116
             ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType )
2117
             ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType )
2117
           )) {
2118
           )) {
2118
            $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->itemnumber,$branch, $returnbranch;
2119
            $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s, %s)", $item->itemnumber,$branch, $returnbranch, $transfer_trigger;
2119
            $debug and warn "item: " . Dumper($item_unblessed);
2120
            $debug and warn "item: " . Dumper($item_unblessed);
2120
            ModItemTransfer($item->itemnumber, $branch, $returnbranch);
2121
            ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger);
2121
            $messages->{'WasTransfered'} = 1;
2122
            $messages->{'WasTransfered'} = 1;
2122
        } else {
2123
        } else {
2123
            $messages->{'NeedsTransfer'} = $returnbranch;
2124
            $messages->{'NeedsTransfer'} = $returnbranch;
2125
            $messages->{'TransferTrigger'} = $transfer_trigger;
2124
        }
2126
        }
2125
    }
2127
    }
2126
2128
(-)a/C4/Items.pm (-7 / +6 lines)
Lines 538-552 sub ModItem { Link Here
538
538
539
=head2 ModItemTransfer
539
=head2 ModItemTransfer
540
540
541
  ModItemTransfer($itenumber, $frombranch, $tobranch);
541
  ModItemTransfer($itemnumber, $frombranch, $tobranch, $trigger);
542
542
543
Marks an item as being transferred from one branch
543
Marks an item as being transferred from one branch to another and records the trigger.
544
to another.
545
544
546
=cut
545
=cut
547
546
548
sub ModItemTransfer {
547
sub ModItemTransfer {
549
    my ( $itemnumber, $frombranch, $tobranch ) = @_;
548
    my ( $itemnumber, $frombranch, $tobranch, $trigger ) = @_;
550
549
551
    my $dbh = C4::Context->dbh;
550
    my $dbh = C4::Context->dbh;
552
    my $item = Koha::Items->find( $itemnumber );
551
    my $item = Koha::Items->find( $itemnumber );
Lines 558-566 sub ModItemTransfer { Link Here
558
557
559
    #new entry in branchtransfers....
558
    #new entry in branchtransfers....
560
    my $sth = $dbh->prepare(
559
    my $sth = $dbh->prepare(
561
        "INSERT INTO branchtransfers (itemnumber, frombranch, datesent, tobranch)
560
        "INSERT INTO branchtransfers (itemnumber, frombranch, datesent, tobranch, reason)
562
        VALUES (?, ?, NOW(), ?)");
561
        VALUES (?, ?, NOW(), ?, ?)");
563
    $sth->execute($itemnumber, $frombranch, $tobranch);
562
    $sth->execute($itemnumber, $frombranch, $tobranch, $trigger);
564
563
565
    ModItem({ holdingbranch => $frombranch }, undef, $itemnumber, { log_action => 0 });
564
    ModItem({ holdingbranch => $frombranch }, undef, $itemnumber, { log_action => 0 });
566
    ModDateLastSeen($itemnumber);
565
    ModDateLastSeen($itemnumber);
(-)a/C4/SIP/ILS/Transaction/Checkin.pm (-1 / +2 lines)
Lines 121-127 sub do_checkin { Link Here
121
                $messages->{ResFound}->{borrowernumber}, 1, $messages->{ResFound}->{reserve_id});
121
                $messages->{ResFound}->{borrowernumber}, 1, $messages->{ResFound}->{reserve_id});
122
            ModItemTransfer( $messages->{ResFound}->{itemnumber},
122
            ModItemTransfer( $messages->{ResFound}->{itemnumber},
123
                $branch,
123
                $branch,
124
                $messages->{ResFound}->{branchcode}
124
                $messages->{ResFound}->{branchcode},
125
                $messages->{TransferTrigger},
125
            );
126
            );
126
127
127
        }
128
        }
(-)a/circ/returns.pl (-1 / +3 lines)
Lines 232-238 if ($dotransfer){ Link Here
232
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
232
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
233
    my $transferitem = $query->param('transferitem');
233
    my $transferitem = $query->param('transferitem');
234
    my $tobranch     = $query->param('tobranch');
234
    my $tobranch     = $query->param('tobranch');
235
    ModItemTransfer($transferitem, $userenv_branch, $tobranch);
235
    my $trigger      = $query->param('trigger');
236
    ModItemTransfer($transferitem, $userenv_branch, $tobranch, $trigger);
236
}
237
}
237
238
238
if ($canceltransfer){
239
if ($canceltransfer){
Lines 371-376 if ( $messages->{'NeedsTransfer'} ){ Link Here
371
    $template->param(
372
    $template->param(
372
        found          => 1,
373
        found          => 1,
373
        needstransfer  => $messages->{'NeedsTransfer'},
374
        needstransfer  => $messages->{'NeedsTransfer'},
375
        trigger        => $messages->{'TransferTrigger'},
374
        itemnumber     => $itemnumber,
376
        itemnumber     => $itemnumber,
375
    );
377
    );
376
}
378
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-1 / +1 lines)
Lines 519-524 Link Here
519
                                                    <input type="hidden" name="tobranch" value="[% returnbranch | html %]" />
519
                                                    <input type="hidden" name="tobranch" value="[% returnbranch | html %]" />
520
                                                    <input type="hidden" name="transferitem" value="[% itemnumber | html %]" />
520
                                                    <input type="hidden" name="transferitem" value="[% itemnumber | html %]" />
521
                                                    <input type="hidden" name="barcode" value="0" />
521
                                                    <input type="hidden" name="barcode" value="0" />
522
                                                    <input type="hidden" name="trigger" value="[% trigger %]" />
522
                                                    [% INCLUDE all_checkin_messages %]
523
                                                    [% INCLUDE all_checkin_messages %]
523
                                                </div>
524
                                                </div>
524
                                                <div class="modal-footer">
525
                                                <div class="modal-footer">
525
- 

Return to bug 24298