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 2137-2148 sub AddReturn { Link Here
2137
            (C4::Context->preference("UseBranchTransferLimits") and
2138
            (C4::Context->preference("UseBranchTransferLimits") and
2138
             ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType )
2139
             ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType )
2139
           )) {
2140
           )) {
2140
            $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->itemnumber,$branch, $returnbranch;
2141
            $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s, %s)", $item->itemnumber,$branch, $returnbranch, $transfer_trigger;
2141
            $debug and warn "item: " . Dumper($item_unblessed);
2142
            $debug and warn "item: " . Dumper($item_unblessed);
2142
            ModItemTransfer($item->itemnumber, $branch, $returnbranch);
2143
            ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger);
2143
            $messages->{'WasTransfered'} = 1;
2144
            $messages->{'WasTransfered'} = 1;
2144
        } else {
2145
        } else {
2145
            $messages->{'NeedsTransfer'} = $returnbranch;
2146
            $messages->{'NeedsTransfer'} = $returnbranch;
2147
            $messages->{'TransferTrigger'} = $transfer_trigger;
2146
        }
2148
        }
2147
    }
2149
    }
2148
2150
(-)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 237-243 if ($dotransfer){ Link Here
237
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
237
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
238
    my $transferitem = $query->param('transferitem');
238
    my $transferitem = $query->param('transferitem');
239
    my $tobranch     = $query->param('tobranch');
239
    my $tobranch     = $query->param('tobranch');
240
    ModItemTransfer($transferitem, $userenv_branch, $tobranch);
240
    my $trigger      = $query->param('trigger');
241
    ModItemTransfer($transferitem, $userenv_branch, $tobranch, $trigger);
241
}
242
}
242
243
243
if ($canceltransfer){
244
if ($canceltransfer){
Lines 376-381 if ( $messages->{'NeedsTransfer'} ){ Link Here
376
    $template->param(
377
    $template->param(
377
        found          => 1,
378
        found          => 1,
378
        needstransfer  => $messages->{'NeedsTransfer'},
379
        needstransfer  => $messages->{'NeedsTransfer'},
380
        trigger        => $messages->{'TransferTrigger'},
379
        itemnumber     => $itemnumber,
381
        itemnumber     => $itemnumber,
380
    );
382
    );
381
}
383
}
(-)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