Lines 1671-1677
sub AddIssue {
Link Here
|
1671 |
} |
1671 |
} |
1672 |
|
1672 |
|
1673 |
if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { |
1673 |
if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { |
1674 |
UpdateTotalIssues( $item_object->biblionumber, 1 ); |
1674 |
UpdateTotalIssues( $item_object->biblionumber, 1, undef, { skip_holds_queue => 1 } ); |
1675 |
} |
1675 |
} |
1676 |
|
1676 |
|
1677 |
# Record if item was lost |
1677 |
# Record if item was lost |
Lines 1683-1689
sub AddIssue {
Link Here
|
1683 |
$item_object->onloan($datedue->ymd()); |
1683 |
$item_object->onloan($datedue->ymd()); |
1684 |
$item_object->datelastborrowed( dt_from_string()->ymd() ); |
1684 |
$item_object->datelastborrowed( dt_from_string()->ymd() ); |
1685 |
$item_object->datelastseen( dt_from_string()->ymd() ); |
1685 |
$item_object->datelastseen( dt_from_string()->ymd() ); |
1686 |
$item_object->store({log_action => 0}); |
1686 |
$item_object->store( { log_action => 0, skip_holds_queue => 1 } ); |
1687 |
|
1687 |
|
1688 |
# If the item was lost, it has now been found, charge the overdue if necessary |
1688 |
# If the item was lost, it has now been found, charge the overdue if necessary |
1689 |
if ($was_lost) { |
1689 |
if ($was_lost) { |
Lines 2077-2083
sub AddReturn {
Link Here
|
2077 |
. Dumper($issue->unblessed) . "\n"; |
2077 |
. Dumper($issue->unblessed) . "\n"; |
2078 |
} else { |
2078 |
} else { |
2079 |
$messages->{'NotIssued'} = $barcode; |
2079 |
$messages->{'NotIssued'} = $barcode; |
2080 |
$item->onloan(undef)->store({skip_record_index=>1}) if defined $item->onloan; |
2080 |
$item->onloan(undef)->store( { skip_record_index => 1, skip_holds_queue => 1 } ) if defined $item->onloan; |
2081 |
|
2081 |
|
2082 |
# even though item is not on loan, it may still be transferred; therefore, get current branch info |
2082 |
# even though item is not on loan, it may still be transferred; therefore, get current branch info |
2083 |
$doreturn = 0; |
2083 |
$doreturn = 0; |
Lines 2110-2116
sub AddReturn {
Link Here
|
2110 |
(!defined $item->location && $update_loc_rules->{_ALL_} ne "") |
2110 |
(!defined $item->location && $update_loc_rules->{_ALL_} ne "") |
2111 |
) { |
2111 |
) { |
2112 |
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{_ALL_} }; |
2112 |
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{_ALL_} }; |
2113 |
$item->location($update_loc_rules->{_ALL_})->store({skip_record_index=>1}); |
2113 |
$item->location($update_loc_rules->{_ALL_})->store({ skip_record_index => 1, skip_holds_queue => 1}); |
2114 |
} |
2114 |
} |
2115 |
} |
2115 |
} |
2116 |
else { |
2116 |
else { |
Lines 2119-2125
sub AddReturn {
Link Here
|
2119 |
if ( $update_loc_rules->{$key} eq '_BLANK_') { $update_loc_rules->{$key} = '' ;} |
2119 |
if ( $update_loc_rules->{$key} eq '_BLANK_') { $update_loc_rules->{$key} = '' ;} |
2120 |
if ( ($item->location eq $key && $item->location ne $update_loc_rules->{$key}) || ($key eq '_BLANK_' && $item->location eq '' && $update_loc_rules->{$key} ne '') ) { |
2120 |
if ( ($item->location eq $key && $item->location ne $update_loc_rules->{$key}) || ($key eq '_BLANK_' && $item->location eq '' && $update_loc_rules->{$key} ne '') ) { |
2121 |
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{$key} }; |
2121 |
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{$key} }; |
2122 |
$item->location($update_loc_rules->{$key})->store({skip_record_index=>1}); |
2122 |
$item->location($update_loc_rules->{$key})->store({ skip_record_index => 1, skip_holds_queue => 1}); |
2123 |
last; |
2123 |
last; |
2124 |
} |
2124 |
} |
2125 |
} |
2125 |
} |
Lines 2138-2144
sub AddReturn {
Link Here
|
2138 |
foreach my $key ( keys %$rules ) { |
2138 |
foreach my $key ( keys %$rules ) { |
2139 |
if ( $item->notforloan eq $key ) { |
2139 |
if ( $item->notforloan eq $key ) { |
2140 |
$messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} }; |
2140 |
$messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} }; |
2141 |
$item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1 }); |
2141 |
$item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1 }); |
2142 |
last; |
2142 |
last; |
2143 |
} |
2143 |
} |
2144 |
} |
2144 |
} |
Lines 2174-2180
sub AddReturn {
Link Here
|
2174 |
|
2174 |
|
2175 |
if ($patron) { |
2175 |
if ($patron) { |
2176 |
eval { |
2176 |
eval { |
2177 |
MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy, { skip_record_index => 1} ); |
2177 |
MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy, { skip_record_index => 1, skip_holds_queue => 1} ); |
2178 |
}; |
2178 |
}; |
2179 |
unless ( $@ ) { |
2179 |
unless ( $@ ) { |
2180 |
if ( |
2180 |
if ( |
Lines 2200-2218
sub AddReturn {
Link Here
|
2200 |
$messages->{'WasReturned'} = 1; |
2200 |
$messages->{'WasReturned'} = 1; |
2201 |
|
2201 |
|
2202 |
} else { |
2202 |
} else { |
2203 |
$item->onloan(undef)->store({ log_action => 0 , skip_record_index => 1 }); |
2203 |
$item->onloan(undef)->store({ log_action => 0 , skip_record_index => 1, skip_holds_queue => 1 }); |
2204 |
} |
2204 |
} |
2205 |
} |
2205 |
} |
2206 |
|
2206 |
|
2207 |
# the holdingbranch is updated if the document is returned to another location. |
2207 |
# the holdingbranch is updated if the document is returned to another location. |
2208 |
# this is always done regardless of whether the item was on loan or not |
2208 |
# this is always done regardless of whether the item was on loan or not |
2209 |
if ($item->holdingbranch ne $branch) { |
2209 |
if ($item->holdingbranch ne $branch) { |
2210 |
$item->holdingbranch($branch)->store({ skip_record_index => 1 }); |
2210 |
$item->holdingbranch($branch)->store({ skip_record_index => 1, skip_holds_queue => 1 }); |
2211 |
} |
2211 |
} |
2212 |
|
2212 |
|
2213 |
my $item_was_lost = $item->itemlost; |
2213 |
my $item_was_lost = $item->itemlost; |
2214 |
my $leave_item_lost = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0; |
2214 |
my $leave_item_lost = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0; |
2215 |
my $updated_item = ModDateLastSeen( $item->itemnumber, $leave_item_lost, { skip_record_index => 1 } ); # will unset itemlost if needed |
2215 |
my $updated_item = ModDateLastSeen( $item->itemnumber, $leave_item_lost, { skip_record_index => 1, skip_holds_queue => 1 } ); # will unset itemlost if needed |
2216 |
|
2216 |
|
2217 |
# fix up the accounts..... |
2217 |
# fix up the accounts..... |
2218 |
if ($item_was_lost) { |
2218 |
if ($item_was_lost) { |
Lines 2509-2515
sub MarkIssueReturned {
Link Here
|
2509 |
# And finally delete the issue |
2509 |
# And finally delete the issue |
2510 |
$issue->delete; |
2510 |
$issue->delete; |
2511 |
|
2511 |
|
2512 |
$issue->item->onloan(undef)->store({ log_action => 0, skip_record_index => $params->{skip_record_index} }); |
2512 |
$issue->item->onloan(undef)->store( |
|
|
2513 |
{ log_action => 0, |
2514 |
skip_record_index => $params->{skip_record_index}, |
2515 |
skip_holds_queue => $params->{skip_holds_queue} |
2516 |
} |
2517 |
); |
2513 |
|
2518 |
|
2514 |
if ( C4::Context->preference('StoreLastBorrower') ) { |
2519 |
if ( C4::Context->preference('StoreLastBorrower') ) { |
2515 |
my $item = Koha::Items->find( $itemnumber ); |
2520 |
my $item = Koha::Items->find( $itemnumber ); |