Bug 34596: Add rebuild queue where needed for existing calls to AddReturn
Existing calls to AddReturn:
C4/Circulation.pm
- transferbook - calls ModDateLastSeen, queue is rebuilt
- AddIssue - rebuild not needed, book is going out again immediately
C4/SIP/ILS/Transaction/Checkin.pm
- do_checkin - added
Koha/Checkouts.pm
- automatic_checkin - added
circ/circulation.pl
- called in stats checkout, not needed
circ/returns.pl
- added
opac/sci/sci-main.pl
- added
svc/checkin
- added
svc/recall
- wasn't actually called, removed the use statement
tools/inventory.pl
- added
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 18fba45afd)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
0246ec0914
commit
ff97e43d79
|
|
@ -1973,6 +1973,7 @@ sub AddIssue {
|
|||
}
|
||||
);
|
||||
|
||||
# Rebuilding holds queue here to ensure the item is removed from current queue
|
||||
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
|
||||
{ biblio_ids => [ $item_object->biblionumber ] } )
|
||||
if C4::Context->preference('RealTimeHoldsQueue');
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use C4::SIP::ILS::Transaction;
|
|||
use C4::Circulation qw( AddReturn LostItem );
|
||||
use C4::Items qw( ModItemTransfer );
|
||||
use C4::Reserves qw( ModReserve ModReserveAffect CheckReserves );
|
||||
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
use Koha::Items;
|
||||
|
||||
|
|
@ -206,6 +207,10 @@ sub do_checkin {
|
|||
$self->alert( !$return || defined $self->alert_type );
|
||||
}
|
||||
|
||||
# If item has been returned let's update the queue after transfers/holds handled above
|
||||
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $item->biblionumber ] } )
|
||||
if $return && C4::Context->preference('RealTimeHoldsQueue');
|
||||
|
||||
# Set sort bin based on info in the item associated with the issue, and the
|
||||
# mapping from SIP2SortBinMapping
|
||||
$self->sort_bin( _get_sort_bin( $item, $branch, $account ) );
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use Modern::Perl;
|
|||
|
||||
use C4::Context;
|
||||
use C4::Circulation qw( AddReturn );
|
||||
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
|
||||
use Koha::Checkout;
|
||||
use Koha::Database;
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
|
|
@ -84,7 +85,7 @@ sub automatic_checkin {
|
|||
|
||||
while ( my $checkout = $due_checkouts->next ) {
|
||||
if ( $checkout->item->itemtype->automatic_checkin ) {
|
||||
my ( undef, $messages ) = C4::Circulation::AddReturn(
|
||||
my ( $returned, $messages ) = C4::Circulation::AddReturn(
|
||||
$checkout->item->barcode, $checkout->branchcode, undef,
|
||||
dt_from_string( $checkout->date_due )
|
||||
);
|
||||
|
|
@ -103,6 +104,11 @@ sub automatic_checkin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If item is checked in let's update the holds queue, after hold/transfers handled above
|
||||
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
|
||||
{ biblio_ids => [ $checkout->item->biblionumber ] } )
|
||||
if $returned && C4::Context->preference('RealTimeHoldsQueue');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2307,7 +2307,14 @@ sub add_to_bundle {
|
|||
|
||||
my $branchcode = C4::Context->userenv->{'branch'};
|
||||
my ($success) = C4::Circulation::AddReturn( $bundle_item->barcode, $branchcode );
|
||||
unless ($success) {
|
||||
|
||||
if ($success) {
|
||||
|
||||
# HoldsQueue doesn't seem to mind bundles, not sure if this is correct, but rebuild for now
|
||||
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
|
||||
{ biblio_ids => [ $self->biblionumber ] } )
|
||||
if C4::Context->preference('RealTimeHoldsQueue');
|
||||
} else {
|
||||
Koha::Exceptions::Checkin::FailedCheckin->throw();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ use Koha::Holds;
|
|||
use C4::Context;
|
||||
use CGI::Session;
|
||||
use Koha::AuthorisedValues;
|
||||
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
|
||||
use Koha::Checkouts::ReturnClaims;
|
||||
use Koha::CsvProfiles;
|
||||
use Koha::Patrons;
|
||||
|
|
@ -375,6 +376,8 @@ if ( @$barcodes && $op eq 'cud-checkout' ) {
|
|||
my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) =
|
||||
AddReturn( $item->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 );
|
||||
|
||||
# No rebuild of holds queue here as the item hasn't really moved, just a stat checkout
|
||||
|
||||
$template->param(
|
||||
STATS => 1,
|
||||
CHECKEDIN => $stats_return,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ use C4::Output qw( output_html_with_http_headers );
|
|||
use C4::Reserves qw( ModReserve ModReserveAffect CheckReserves );
|
||||
use C4::RotatingCollections;
|
||||
use Koha::AuthorisedValues;
|
||||
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
|
||||
use Koha::BiblioFrameworks;
|
||||
use Koha::Calendar;
|
||||
use Koha::Checkouts;
|
||||
|
|
@ -360,8 +361,13 @@ if ( $barcode && ( $op eq 'cud-checkin' || $op eq 'cud-affect_reserve' ) ) {
|
|||
}
|
||||
|
||||
# do the return
|
||||
( $returned, $messages, $issue, $borrower ) = AddReturn( $barcode, $userenv_branch, $exemptfine, $return_date )
|
||||
unless ( $needs_confirm || $bundle_confirm );
|
||||
unless ( $needs_confirm || $bundle_confirm ) {
|
||||
( $returned, $messages, $issue, $borrower ) = AddReturn( $barcode, $userenv_branch, $exemptfine, $return_date );
|
||||
|
||||
# Rebuild the queue only after handling confirmations
|
||||
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $item->biblionumber ] } )
|
||||
if $returned && C4::Context->preference('RealTimeHoldsQueue');
|
||||
}
|
||||
|
||||
if ($returned) {
|
||||
my $date_due_dt = dt_from_string( $issue->date_due, 'sql' );
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use CGI qw ( -utf8 );
|
|||
use C4::Auth qw( get_template_and_user );
|
||||
use C4::Circulation qw( AddReturn );
|
||||
use C4::Output qw( output_html_with_http_headers );
|
||||
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
|
||||
use Koha::Items;
|
||||
|
||||
use List::MoreUtils qw( uniq );
|
||||
|
|
@ -86,6 +87,11 @@ if ( $op eq 'cud-check_in' ) {
|
|||
checkout => $checkout,
|
||||
patron => $patron
|
||||
};
|
||||
|
||||
# Rebuild holds queue on checkin
|
||||
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
|
||||
{ biblio_ids => [ $item->biblionumber ] } )
|
||||
if C4::Context->preference('RealTimeHoldsQueue');
|
||||
} else {
|
||||
push @errors,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use JSON qw(to_json);
|
|||
use C4::Circulation qw( AddReturn );
|
||||
use C4::Context;
|
||||
use C4::Auth qw(check_cookie_auth);
|
||||
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
|
||||
use Koha::Checkouts;
|
||||
use Koha::Items;
|
||||
|
||||
|
|
@ -69,4 +70,8 @@ $data->{patronnote} = $checkout ? $checkout->note : q||;
|
|||
|
||||
( $data->{returned} ) = AddReturn( $barcode, $branchcode, $exempt_fine );
|
||||
|
||||
# Rebuild holds queue if item returns
|
||||
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $item->biblionumber ] } )
|
||||
if C4::Context->preference('RealTimeHoldsQueue');
|
||||
|
||||
print to_json($data);
|
||||
|
|
|
|||
|
|
@ -22,9 +22,8 @@ use CGI;
|
|||
use JSON qw(encode_json);
|
||||
|
||||
use C4::Context;
|
||||
use C4::Auth qw(check_cookie_auth);
|
||||
use C4::Output qw(output_with_http_headers);
|
||||
use C4::Circulation qw(AddReturn);
|
||||
use C4::Auth qw(check_cookie_auth);
|
||||
use C4::Output qw(output_with_http_headers);
|
||||
use Koha::Recalls;
|
||||
|
||||
my $input = CGI->new;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ use C4::Reports::Guided qw( );
|
|||
use C4::Charset qw( NormalizeString );
|
||||
|
||||
use Koha::I18N qw(__);
|
||||
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
|
||||
use Koha::Biblios;
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
use Koha::Database::Columns;
|
||||
|
|
@ -269,6 +270,11 @@ if ( $op eq 'cud-inventory'
|
|||
if ($doreturn) {
|
||||
$item_unblessed->{onloan} = undef;
|
||||
$item_unblessed->{datelastseen} = dt_from_string;
|
||||
|
||||
# Rebuild the holds queue when item found on shelf
|
||||
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
|
||||
{ biblio_ids => [ $item->biblionumber ] } )
|
||||
if C4::Context->preference('RealTimeHoldsQueue');
|
||||
} else {
|
||||
push @errorloop, { barcode => $barcode, ERR_ONLOAN_NOT_RET => 1 };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue