Bug 13412

Summary: Allow configuration of auto-created authorities
Product: Koha Reporter: paxed <pasi.kallinen>
Component: MARC Authority data supportAssignee: Roch D'Amour <roch.damour>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: bgkriegel, david, hagud, josef.moravec, katrin.fischer, marjorie.barry-vila, martin.renvoize, patrick.robitaille, philippe.blouin, roch.damour, shi-yao.wang
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00
Attachments: Add 2 new system preferences: GenerateAuthorityField
Bug 13412: Allow configuration of auto-created authorities
Bug 13412: Allow configuration of auto-created authorities
Bug 13412: Allow configuration of auto-created authorities
Bug 13412: (QA follow-up) Fix alphabetic order in sysprefs.sql
Bug 13412: (QA follow-up) Rephrase and link system preference descriptions
Bug 13142: (QA follow-up) Convert database update to current format

Description paxed 2014-12-09 06:09:23 UTC
When AutoCreateAuthorities and BiblioAddsAuthorities sysprefs are on, Koha automagically creates authority records from biblios.

Currently there's no way to change what data goes into the auth record. For example, field 667a always contains the text "Machine generated authority record."
 and 670a contains "Work cat. ($MARCOrgCode)$999c: $bib.author, $bib.title_proper, $bib.publication_date"


Perhaps a new syspref where you could enter stuff like

"
667a  Machine generated authority record.
670a  Work cat. ($MARCOrgCode)$999c: $bib.author, $bib.title_proper, $bib.publication_date
"

(meaning the fields 667a and 670a get the same text as they used to; see LinkBibHeadingsToAuthorities() in C4/Biblio.pm)
Comment 1 Roch D'Amour 2018-02-21 16:42:40 UTC
Created attachment 72031 [details] [review]
Add 2 new system preferences: GenerateAuthorityField

This patch add 2 new system preferences:
- GenerateAuthorityField667
- GenerateAuthorityField670

When Koha creates authority records from biblios, use these preferences instead of the hard-coded "Machine generated authority record." and "Work cat." values.

Test plan: 
    1. Make sure AutoCreateAuthorities and BiblioAddsAuthorities are enabled in the system preferences
    2. Go to Home › Cataloging › Add MARC record and add a new record
    3. Fill in the required fields and add a name in the 100$a field. Note the name, and add the new record.
    4. run rebuild_zebra.pl -a
    5. Go to Home › Authorities and search for the name you entered in 100$a
    6. Select details and look at the 667 and 670 fields. They should default to the hard-coded values.
    7. Apply patch, run update database
    8. Edit the new GenerateAuthorityField667 and GenerateAuthorityField670 system preferences
    9. Do 2-6 . Now the 667 and 670 fields should be what you entered in the system preferences.

Thanks for testing
Comment 2 Hugo Agud 2018-09-20 10:39:22 UTC
morning..

the patch it works fine when creating auth from the staff interface, but it doesnt work when creating from command line (perl link_bibs_to_authorities.pl -v) probably it doesn't suppose to do it.. but it should be desirable if the user configure it, right?
Comment 3 David Nind 2020-02-23 17:29:03 UTC
The patch still applies!

Not sure whether comment 2 needs to be addressed (make it work when creating from the command line) so that bug can progress.
Comment 4 Bernardo Gonzalez Kriegel 2020-02-27 18:04:49 UTC
Created attachment 99710 [details] [review]
Bug 13412: Allow configuration of auto-created authorities

This patch add 2 new system preferences:
- GenerateAuthorityField667
- GenerateAuthorityField670

When Koha creates authority records from biblios, use these preferences instead of the hard-coded "Machine generated authority record." and "Work cat." values.

Test plan:
    1. Make sure AutoCreateAuthorities and BiblioAddsAuthorities are enabled in the system preferences
    2. Go to Home › Cataloging › Add MARC record and add a new record
    3. Fill in the required fields and add a name in the 100$a field. Note the name, and add the new record.
    4. run rebuild_zebra.pl -a
    5. Go to Home › Authorities and search for the name you entered in 100$a
    6. Select details and look at the 667 and 670 fields. They should default to the hard-coded values.
    7. Apply patch, run update database
    8. Edit the new GenerateAuthorityField667 and GenerateAuthorityField670 system preferences
    9. Do 2-6 . Now the 667 and 670 fields should be what you entered in the system preferences.

Thanks for testing

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works well, no errors
Comment 5 Bernardo Gonzalez Kriegel 2020-02-27 18:07:46 UTC
(In reply to David Nind from comment #3)
> The patch still applies!
> 
> Not sure whether comment 2 needs to be addressed (make it work when creating
> from the command line) so that bug can progress.

Hi, 
Hugo's comment makes reference to link_bibs_to_authorities.pl script, it links existing auth records with bibs, does not create new ones.
Comment 6 Katrin Fischer 2020-02-29 20:11:33 UTC
Hi Roch,

I did some first testing and this looks good, I just have have 2 small issues:

1) I believe this would be a MARC21 specific feature as it's proposed now. Could we make it MARC agnostic? Like use a general term in the pref and make it work for UNIMARC as well? I am not sure if there is code for UNIMARC to do a similar thing yet, if not, we could just add a note to the pref description that this is MARC21 only.

2) syspref.sql is sorted alphabetically, actually that helps us to avoid rebasing a lot as not everyone adds their new prefs in the same spot at the end. Can you please sort your new prefs in

Please submit a follow-up patch and switch back to Signed-off.
Comment 7 Shi Yao Wang 2022-04-21 19:03:15 UTC
Created attachment 133607 [details] [review]
Bug 13412: Allow configuration of auto-created authorities

This patch add 2 new system preferences:
- GenerateAuthorityField667
- GenerateAuthorityField670

When Koha creates authority records from biblios, use these preferences instead of the hard-coded "Machine generated authority record." and "Work cat." values.

Test plan:
    1. Make sure AutoCreateAuthorities and BiblioAddsAuthorities are enabled in the system preferences
    2. Go to Home › Cataloging › Add MARC record and add a new record
    3. Fill in the required fields and add a name in the 100$a field. Note the name, and add the new record.
    4. run rebuild_zebra.pl -a
    5. Go to Home › Authorities and search for the name you entered in 100$a
    6. Select details and look at the 667 and 670 fields. They should default to the hard-coded values.
    7. Apply patch, run update database
    8. Edit the new GenerateAuthorityField667 and GenerateAuthorityField670 system preferences
    9. Do 2-6 . Now the 667 and 670 fields should be what you entered in the system preferences.

Thanks for testing

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works well, no errors
Comment 8 Katrin Fischer 2022-04-28 14:03:09 UTC
Created attachment 134266 [details] [review]
Bug 13412: Allow configuration of auto-created authorities

This patch add 2 new system preferences:
- GenerateAuthorityField667
- GenerateAuthorityField670

When Koha creates authority records from biblios, use these preferences instead of the hard-coded "Machine generated authority record." and "Work cat." values.

Test plan:
    1. Make sure AutoCreateAuthorities and BiblioAddsAuthorities are enabled in the system preferences
    2. Go to Home › Cataloging › Add MARC record and add a new record
    3. Fill in the required fields and add a name in the 100$a field. Note the name, and add the new record.
    4. run rebuild_zebra.pl -a
    5. Go to Home › Authorities and search for the name you entered in 100$a
    6. Select details and look at the 667 and 670 fields. They should default to the hard-coded values.
    7. Apply patch, run update database
    8. Edit the new GenerateAuthorityField667 and GenerateAuthorityField670 system preferences
    9. Do 2-6 . Now the 667 and 670 fields should be what you entered in the system preferences.

Thanks for testing

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works well, no errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2022-04-28 14:03:14 UTC
Created attachment 134267 [details] [review]
Bug 13412: (QA follow-up) Fix alphabetic order in sysprefs.sql

TaxRates was not moved when renamed from gist, just moving it down
so things are tidy again.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2022-04-28 14:03:20 UTC
Created attachment 134268 [details] [review]
Bug 13412: (QA follow-up) Rephrase and link system preference descriptions

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2022-04-28 14:03:26 UTC
Created attachment 134269 [details] [review]
Bug 13142: (QA follow-up) Convert database update to current format
Comment 12 Fridolin Somers 2022-05-11 08:48:53 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄