Bug 26156

Summary: Record matching rule code should be unique
Product: Koha Reporter: David Cook <dcook>
Component: MARC Bibliographic record staging/importAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low    
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description David Cook 2020-08-06 08:02:58 UTC
Record matching rules don't have unique codes (or unique descriptions or unique combinations of the two).

These should be unique, so that people don't get confused by record matching rules with duplicate codes.
Comment 1 David Cook 2020-08-06 08:03:36 UTC
Of course, fixing this is easier said than done, as we need to make sure that any existing databases don't have duplicate marc_matcher codes...
Comment 2 Katrin Fischer 2020-08-06 08:22:48 UTC
I am not sure if I see the need as the table has a primary key that is unique and that key is used for example when you use the matching rules with the command line scripts.

We don't keep people from naming other things the same - it seems if they do, that's not ideal, but doesn't necessarily need a code solution.
Comment 3 David Cook 2020-08-06 23:46:40 UTC
(In reply to Katrin Fischer from comment #2)
> I am not sure if I see the need as the table has a primary key that is
> unique and that key is used for example when you use the matching rules with
> the command line scripts.
> 

The primary key isn't very friendly though. I've done some work with matching rules (before discarding it), and working with the codes is much nicer. 

It's also possible that you could delete your record matching rule and re-create it, and then your old primary key is gone, but your code could still be the same. 

> We don't keep people from naming other things the same - it seems if they
> do, that's not ideal, but doesn't necessarily need a code solution.

Well, this would be a database schema change rather than a code solution per se. It would just be making a unique key for the code column. (The code solution would just be necessary at update time before creating the unique key to prevent fatal database errors.)
Comment 4 Katrin Fischer 2020-08-07 08:44:20 UTC
Code in the GUI would be needed as well.
Comment 5 David Cook 2020-08-10 01:04:21 UTC
(In reply to Katrin Fischer from comment #4)
> Code in the GUI would be needed as well.

Ah touché. I forgot about that part ﷐[U+1F605]﷑