Bug 39752: Check for biblio existence when matches are found

Currently when adding to a basket from a new/staged file, we don't check whether a matched record still exists when importing. This patch changes the conditional check to be based on the existence of the biblio record rather than just on the biblionumber from the match

Test plan:
1) Stage and import a record into Koha
2) Stage the same record again, this time matching on ISBN
3) Check that the match has been found in the batch details
4) Delete the original record that you imported in step 1
5) Find a basket, and add to it from a staged file
6) Choose the file/record you imported in stage 2
7) Select the record and save to add the orders
8) You will get a 500 error
9) Apply patch and restart_all
10) Refresh the page to re-submit the form
11) The form should submit correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 37538b22a0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Matt Blenkinsop 2025-04-28 09:44:48 +01:00 committed by Fridolin Somers
parent 2f45f272a2
commit d31f8d7279
No known key found for this signature in database
GPG Key ID: 9A8E73E2A8B96537
1 changed files with 2 additions and 2 deletions

View File

@ -393,11 +393,11 @@ sub add_biblio_from_import_record {
my $matches = $import_record->get_import_record_matches( { chosen => 1 } );
my $match = $matches->count ? $matches->next : undef;
my $biblionumber = $match ? $match->candidate_match_id : 0;
my $biblio = $biblionumber ? Koha::Biblios->find($biblionumber) : undef;
if ($biblionumber) {
if ($biblio) {
$import_record->status('imported')->store;
if ( $overlay_action eq 'replace' ) {
my $biblio = Koha::Biblios->find($biblionumber);
$import_record->replace( { biblio => $biblio } );
}
} else {