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

(-)a/C4/Circulation.pm (-2 / +4 lines)
Lines 1898-1903 sub AddReturn { Link Here
1898
        # get the proper branch to which to return the item
1898
        # get the proper branch to which to return the item
1899
    my $returnbranch = $hbr ne 'noreturn' ? $item->$hbr : $branch;
1899
    my $returnbranch = $hbr ne 'noreturn' ? $item->$hbr : $branch;
1900
        # if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch)
1900
        # if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch)
1901
    my $transfer_trigger = $hbr eq 'homebranch' ? 'ReturnToHome' : $hbr eq 'holdingbranch' ? 'ReturnToHolding' : undef;
1901
1902
1902
    my $borrowernumber = $patron ? $patron->borrowernumber : undef;    # we don't know if we had a borrower or not
1903
    my $borrowernumber = $patron ? $patron->borrowernumber : undef;    # we don't know if we had a borrower or not
1903
    my $patron_unblessed = $patron ? $patron->unblessed : {};
1904
    my $patron_unblessed = $patron ? $patron->unblessed : {};
Lines 2146-2157 sub AddReturn { Link Here
2146
            (C4::Context->preference("UseBranchTransferLimits") and
2147
            (C4::Context->preference("UseBranchTransferLimits") and
2147
             ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType )
2148
             ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType )
2148
           )) {
2149
           )) {
2149
            $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->itemnumber,$branch, $returnbranch;
2150
            $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s, %s)", $item->itemnumber,$branch, $returnbranch, $transfer_trigger;
2150
            $debug and warn "item: " . Dumper($item_unblessed);
2151
            $debug and warn "item: " . Dumper($item_unblessed);
2151
            ModItemTransfer($item->itemnumber, $branch, $returnbranch);
2152
            ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger);
2152
            $messages->{'WasTransfered'} = 1;
2153
            $messages->{'WasTransfered'} = 1;
2153
        } else {
2154
        } else {
2154
            $messages->{'NeedsTransfer'} = $returnbranch;
2155
            $messages->{'NeedsTransfer'} = $returnbranch;
2156
            $messages->{'TransferTrigger'} = $transfer_trigger;
2155
        }
2157
        }
2156
    }
2158
    }
2157
2159
(-)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 229-235 if ($dotransfer){ Link Here
229
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
229
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
230
    my $transferitem = $query->param('transferitem');
230
    my $transferitem = $query->param('transferitem');
231
    my $tobranch     = $query->param('tobranch');
231
    my $tobranch     = $query->param('tobranch');
232
    ModItemTransfer($transferitem, $userenv_branch, $tobranch);
232
    my $trigger      = $query->param('trigger');
233
    ModItemTransfer($transferitem, $userenv_branch, $tobranch, $trigger);
233
}
234
}
234
235
235
if ($canceltransfer){
236
if ($canceltransfer){
Lines 368-373 if ( $messages->{'NeedsTransfer'} ){ Link Here
368
    $template->param(
369
    $template->param(
369
        found          => 1,
370
        found          => 1,
370
        needstransfer  => $messages->{'NeedsTransfer'},
371
        needstransfer  => $messages->{'NeedsTransfer'},
372
        trigger        => $messages->{'TransferTrigger'},
371
        itemnumber     => $itemnumber,
373
        itemnumber     => $itemnumber,
372
    );
374
    );
373
}
375
}
(-)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