Bugzilla – Attachment 128517 Details for
Bug 29694
Add preference for setting marc-record system control number and identifier when saving biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29694: Add preference for setting 001 and 003 fields on biblio save
Bug-29694-Add-preference-for-setting-001-and-003-f.patch (text/plain), 4.77 KB, created by
David Gustafsson
on 2021-12-14 16:32:57 UTC
(
hide
)
Description:
Bug 29694: Add preference for setting 001 and 003 fields on biblio save
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2021-12-14 16:32:57 UTC
Size:
4.77 KB
patch
obsolete
>From 2de07c48f2ea90a73a962f8124b96a33d65fc795 Mon Sep 17 00:00:00 2001 >From: Stefan Berndtsson <stefan.berndtsson@gmail.com> >Date: Tue, 13 Feb 2018 13:11:48 +0100 >Subject: [PATCH] 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 >--- > C4/Biblio.pm | 5 +++++ > .../data/mysql/atomicupdate/auto-add-001-syspref.pl | 12 ++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../en/modules/admin/preferences/cataloguing.pref | 6 ++++++ > 4 files changed, 24 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/auto-add-001-syspref.pl > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index ebebe415c8..f10def9ceb 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2637,6 +2637,11 @@ sub _koha_marc_update_bib_ids { > } else { > C4::Biblio::UpsertMarcSubfield($record, $biblioitem_tag, $biblioitem_subfield, $biblioitemnumber); > } >+ >+ if (C4::Context->preference('AutoAddSystemControlNumberAndMARCOrgCode')) { >+ C4::Biblio::UpsertMarcControlField($record, '001', $biblionumber); >+ C4::Biblio::UpsertMarcControlField($record, '003', C4::Context->preference('MARCOrgCode')); >+ } > } > > =head2 _koha_marc_update_biblioitem_cn_sort >diff --git a/installer/data/mysql/atomicupdate/auto-add-001-syspref.pl b/installer/data/mysql/atomicupdate/auto-add-001-syspref.pl >new file mode 100644 >index 0000000000..2a733e6db7 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/auto-add-001-syspref.pl >@@ -0,0 +1,12 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "29694", >+ description => "Add system preference", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('AutoAddSystemControlNumberAndMARCOrgCode', '0', NULL, 'Automatically add biblionumber to 001, and MARCOrgCode to 003', 'YesNo')}); >+ say $out "System preference AutoAddSystemControlNumberAndMARCOrgCode added"; >+ }, >+} >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 59db857ca6..0cd3182f63 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -73,6 +73,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'), > ('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'), > ('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'), >+('AutoAddSystemControlNumberAndMARCOrgCode', '0', NULL, 'Automatically add biblionumber to 001, and MARCOrgCode to 003', 'YesNo'), > ('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'), > ('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'), > ('AutoEmailOpacUser','0',NULL,'Sends notification emails containing new account details to patrons - when account is created.','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >index 5ffd9a22f3..b15bf62e5b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >@@ -158,6 +158,12 @@ Cataloging: > - and record's last modifier name in MARC subfield > - pref: MarcFieldForModifierName > - ". <br/><strong>NOTE:</strong> Use a dollar sign between field and subfield like 123$a." >+ - >+ - pref: AutoAddSystemControlNumberAndMARCOrgCode >+ choices: >+ 1: Add >+ 0: Do not add >+ - System-Control-Number (001) and Control-Number-Identifier (003) automatically from biblionumber and MARCOrgCode. > Display: > - > - 'Separate main entry and subdivisions with ' >-- >2.34.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29694
:
128517
|
128518
|
128519
|
128520