Bug 32327 - When replacing bib record via z39.50, only 1 ISBN should be searched and it should be normalized
Summary: When replacing bib record via z39.50, only 1 ISBN should be searched and it s...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-22 20:16 UTC by Andrew Fuerste-Henry
Modified: 2023-04-16 10:57 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2022-11-22 20:16:41 UTC
The replace via z39.50 function pre-populates the z39.50 search form with values from the existing bib. Koha just pastes in the contents of biblioitems.isbn, which means it very often pre-populates that field with a value that will never find anything.

If the existing record has more than 1 ISBN, the prepopulated form will list them all, pipe-separated. This search will always return no results, even when either ISBN returns results successfully on its own.

If the existing record contains a parenthetical note about binding, that search will generally fail as well.

We should only put the first ISBN from the record into the search form and we should strip out any binding note or other fluff.
Comment 1 Lucas Gass (lukeg) 2022-12-08 20:45:14 UTC
This jQuery ( intranetuserjs ) can be helpful to trim the ISBN field down to just a single valid ISBN:

if ( $('#cat_z3950_search').length ) {
	let splitISBNfields = $('#isbn').val().split(/(\s+)/);
    let found;
    splitISBNfields.forEach( function(item) {
           	if ( item.match(/^(?=(?:\D*\d){10}(?:(?:\D*\d){3})?$)[\d-]+$/) && !found ) {
            	$('#isbn').val(item);
                found = 1;
            } 
    });
  $('#title').val('');
  $('#author').val('');
}
Comment 2 Manos PETRIDIS 2023-03-14 14:32:24 UTC
Or all ISBNs should be searched -each in normalised form- and the results be aggregated before reaching the results window. This would be more close to "search according to data already existing in the current entry".
Comment 3 Katrin Fischer 2023-04-16 10:57:29 UTC
(In reply to Manos PETRIDIS from comment #2)
> Or all ISBNs should be searched -each in normalised form- and the results be
> aggregated before reaching the results window. This would be more close to
> "search according to data already existing in the current entry".

While this would be the ideal solution, I would require quite a bit more of work. The solution Andrew suggests would work well for an immediate fix to the bug and we could also easily backport to stable releases.