Bug 34860 - New framework plugin for ISBN/ISSN
Summary: New framework plugin for ISBN/ISSN
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on: 35062
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-21 06:01 UTC by Marcel de Rooy
Modified: 2023-10-17 11:41 UTC (History)
1 user (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
Bug 34860: New framework plugin for ISBN/ISSN (10.44 KB, patch)
2023-09-21 06:19 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2023-09-21 06:01:09 UTC
Something similar as on bug 34817.
But obstacle currently is REST API not supporting ccl search on index. So in its current form it should need a svc script to do the index search.
Comment 1 Marcel de Rooy 2023-09-21 06:19:16 UTC
Created attachment 155966 [details] [review]
Bug 34860: New framework plugin for ISBN/ISSN

A Koha patch should still be submitted. The REST API does not
yet support an index search like the one in isbn_count.
Comment 2 Marcel de Rooy 2023-09-21 06:34:45 UTC
Added concept code for now. Not yet ready for inclusion.

The svc/isbn_count does the index search. The isbn.js includes checking the validity of ISBN on client side.

As to hyphenation, I have chosen the following approach: LOC seems to recommend no hyphens in 020 and one hypen in 022 for the MARC fields. When displaying you can add the hyphens for ISBN. The code here removes the hyphens from ISBN when searching the index and does also replace the contents of 020 when hyphens were entered. (The current version removes additional text too..)

From 2013 onwards, additional text should actually be in $q.

In order to make this ready for submittal, the following is probably needed:
- proper handling of $a suffixes for 020/022 (We may still assume presence.)
- allow hyphenation for ISBN in MARC (index, db) - Pref needed?
- removing code overlap between isbn/issn code in js
- prepare transition from svc script to REST API
- the red or green color approach might be replaced by an alert

Please do not hesitate to give your feedback.
Comment 3 Marcel de Rooy 2023-09-21 08:28:04 UTC
Code with optional suffix stripping:

function isbn_check ( subfield, strip_suffix ) {
    // Remove hyphens from isbn part, handle suffix by split on space
    var split_field = subfield.split( ' ', 2 );
    var isbn = split_field[0].replace( /[-]/g, '' );
    var suffix;
    if( strip_suffix ) suffix = '';
    else suffix = split_field[1] ? ' ' + split_field[1] : '';

    if ( isbn.match(/^\d{9}(\d{3})?[0-9X]$/) ) {
        if( valid_isbn_check_digit(isbn) ) return [ 1, isbn + suffix ];
    }
    return [ 0, isbn + suffix ];
}
Comment 4 Marcel de Rooy 2023-10-17 11:41:11 UTC
Comment on attachment 155966 [details] [review]
Bug 34860: New framework plugin for ISBN/ISSN

This version is obsolete. I will upload an new version later on.