Bug 29694

Summary: Add preference for setting marc-record system control number and identifier when saving biblio
Product: Koha Reporter: David Gustafsson <glasklas>
Component: Architecture, internals, and plumbingAssignee: David Gustafsson <glasklas>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 29694: Add preference for setting 001 and 003 fields on biblio save
Bug 29694: Add tests
Bug 29694: Add preference for setting 001 and 003 fields on biblio save
Bug 29694: Add tests

Description David Gustafsson 2021-12-14 15:42:15 UTC
Add a syspref, "AutoAddSystemControlNumberAndMARCOrgCode". If enabled, when a new biblio is saved, the 001 and 003 fields of the marc record will be set to the koha biblionumber and value of the "MARCOrgCode" syspref respectively.

According to the MARC21 standard the old values of 001 and 003 may also be moved to field 035, 010 or 016 as appropriate, but it since this step is more complicated it's perhaps better left to the user to implement some custom solution for this (for example as a to-marc-plugin).
Comment 1 David Gustafsson 2021-12-14 16:32:57 UTC
Created attachment 128517 [details] [review]
Bug 29694: Add preference for setting 001 and 003 fields on biblio save

Add a syspref, "AutoAddSystemControlNumberAndMARCOrgCode". If enabled the
001 and 003 fields of the marc record will be set to the koha biblionumber
and value of the "MARCOrgCode" syspref respectively before when saving
biblios.

To test:
1) Add a new biblio
2) Verify that 001 field is empty
3) Enable AutoAddSystemControlNumberAndMARCOrgCode syspref and make sure
   MARCOrgCode syspref is set to some value
4) Save biblio again
5) Verify that 001 has been set to the Koha biblio and
   003 to the value of MARCOrgCode
6) Run tests in t/db_dependent/Biblio.t
Comment 2 David Gustafsson 2021-12-14 16:33:02 UTC
Created attachment 128518 [details] [review]
Bug 29694: Add tests
Comment 3 David Gustafsson 2021-12-14 16:36:13 UTC
Created attachment 128519 [details] [review]
Bug 29694: Add preference for setting 001 and 003 fields on biblio save

Add a syspref, "AutoAddSystemControlNumberAndMARCOrgCode". If enabled the
001 and 003 fields of the marc record will be set to the koha biblionumber
and value of the "MARCOrgCode" syspref respectively before when saving
biblios.

To test:
1) Add a new biblio
2) Verify that 001 field is empty
3) Enable AutoAddSystemControlNumberAndMARCOrgCode syspref and make sure
   MARCOrgCode syspref is set to some value
4) Save biblio again
5) Verify that 001 has been set to the Koha biblionumber and
   003 to the value of MARCOrgCode
6) Run tests in t/db_dependent/Biblio.t

Sponsored-by: Gothenburg University Library
Comment 4 David Gustafsson 2021-12-14 16:36:17 UTC
Created attachment 128520 [details] [review]
Bug 29694: Add tests
Comment 5 Katrin Fischer 2022-10-24 21:06:04 UTC
Hi David, 

I feel like this is at least a partial duplicate to bug 27981, that was pushed for 22.11. 

003 is set for me to the MarcOrgCode system preference value or to the logged in library's MARCOrgCode on saving. So this seems to work as well.

*** This bug has been marked as a duplicate of bug 27981 ***