From 52168e68909139418c28647d003ecd0e033bcea2 Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Tue, 21 Oct 2025 16:05:15 +0000 Subject: [PATCH] Bug 21272: (follow-up) fix error 500 when there is no title To test: 1. Import the record 1record_bz21272.mrc 2. Create a record matching rule to check 001 2.1. Go to Administration > Record matching rules 2.2. Click "New record matching rule" 2.3. Fill out the form - Matching rule code: 001 - Description: Control number (001) - Match threshold: 1000 - Record type: Bibliographic records - Match point 1: - Search index: control-number - Score: 1000 - Matchpoint components: - Tag: 001 2.3. Click "Save" 3. Import the item using the staff interface 3.1. Go to Cataloging > Stage records for import 3.2. Choose the file 1item_bz21272.mrc 3.3. Click "Upload file" 3.4. Set these field - Record matching rule: 001 (Control number (001)) - Action if matching record found: Ignore incoming record (its items may still be processed) - Action if no match is found: Ignore incoming record 3.4. Click "Stage for import" 3.5. Click "View batch" ==> Error 500 4. Apply the path 5. Refresh the page or repeat step 3 ==> There is no Error --- C4/ImportBatch.pm | 2 +- tools/manage-marc-import.pl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index c54c8f893ac..886a288d27d 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -1382,7 +1382,7 @@ sub GetTitleImportRecord { $record->[0]->{'encoding'} ); $sth->finish(); - my $title = $marc_record->field('245')->subfield('a'); + my $title = $marc_record->subfield( 245, 'a' ); return $title; } diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl index 58c55111682..c07d79f100a 100755 --- a/tools/manage-marc-import.pl +++ b/tools/manage-marc-import.pl @@ -100,8 +100,8 @@ if ( $op eq "" ) { my @bad_item_titles; my @missing_branches; foreach my $item (@import_items) { - push @bad_item_titles, $item->{title}; - push @missing_branches, $item->{branch}; + push @bad_item_titles, $item->{title} if ( $item->{title} ); + push @missing_branches, $item->{branch} if ( $item->{title} ); } @bad_item_titles = uniq @bad_item_titles; @missing_branches = uniq @missing_branches; -- 2.34.1