Bug 41728: (QA follow-up) Move data consistency check before blocker handling
The data inconsistency die (checkout exists but patron does not) was placed after the blocker handling block. This meant that if an item had corrupt data AND triggered a blocker (e.g. withdrawn+blocked), the blocker handler would return early with patron as undef instead of dying on the inconsistency, silently masking database corruption. Move the check to immediately after extracting context from the availability result, before any blocker handling, matching the original AddReturn behavior where the die fired during checkout lookup. Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
2e4459ea69
commit
d46b0c1106
|
|
@ -2444,6 +2444,16 @@ sub AddReturn {
|
|||
my $issue = $availability->context->{checkout};
|
||||
$patron = $availability->context->{patron};
|
||||
|
||||
# Data consistency check for issued items - must run before any blocker
|
||||
# handling so that DB corruption is never masked by an early return
|
||||
if ( $issue && !$patron ) {
|
||||
die "Data inconsistency: barcode $barcode (itemnumber:"
|
||||
. $item->itemnumber
|
||||
. ") claims to be issued to non-existent borrowernumber '"
|
||||
. $issue->borrowernumber . "'\n"
|
||||
. Dumper( $issue->unblessed ) . "\n";
|
||||
}
|
||||
|
||||
# Set NotIssued message if item not checked out
|
||||
if ( !$issue ) {
|
||||
$messages->{'NotIssued'} = $barcode;
|
||||
|
|
|
|||
Loading…
Reference in New Issue