393 my $match = $matches->count ? $matches->next : undef; 394 my $biblionumber = $match ? $match->candidate_match_id : 0; 396 if ($biblionumber) { 397 $import_record->status('imported')->store; 398 if ( $overlay_action eq 'replace' ) { 399 my $biblio = Koha::Biblios->find($biblionumber); 400 $import_record->replace( { biblio => $biblio } ); 401 } 402 } else { import_record_matches does not have a foreign key to biblios stage + import some records to Koha stage again, matching on isbn - you should find matches form first import delete the records that already exist in koha SELECT * FROM import_record_matches Note that the matches are still there If you try adding these to a basket it will die because of the invalid match trying to be used as a bilbio
Created attachment 181576 [details] [review] 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
Created attachment 181639 [details] [review] 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>
Created attachment 181656 [details] [review] Bug 39752: (QA follow-up) Unit test Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 181657 [details] [review] 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>
Pushed for 25.05! Well done everyone, thank you!