@@ -, +, @@ biblio save MARCOrgCode syspref is set to some value 003 to the value of MARCOrgCode --- 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 --- a/C4/Biblio.pm +++ a/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 --- a/installer/data/mysql/atomicupdate/auto-add-001-syspref.pl +++ a/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"; + }, +} --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/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'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/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 - ".
NOTE: 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 ' --