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 |