From 419b0dfccf713268236d3ad1dc2878e6c16ac3bf Mon Sep 17 00:00:00 2001 From: Marc Veron Date: Fri, 8 Jun 2012 17:39:39 +0200 Subject: [PATCH] Bug 7601 - Preference for default language for field 008 Range 35-37 (instead of hard coded "eng") When a new marc record is added, the language code in field 008 Range 35-37 defaults to Englih ("eng"). This makes cataloguing inefficient and error-prone for librarians if most of the bibliographic data is e.g. in German or in French. Test: - Apply patch - Edit preference DefaultLanguageField008, fill in e.g. 'ger' - Go to Cataloguing, Add marc Record - Click in field 008. Language code should read 'ger' (instead of 'eng') Signed-off-by: Chris Cormack --- cataloguing/value_builder/marc21_field_008.pl | 13 ++++++++++--- cataloguing/value_builder/normarc_field_008.pl | 10 ++++++++-- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../en/modules/admin/preferences/cataloguing.pref | 4 ++++ 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl index bb7e7eec02..e6e9af1418 100755 --- a/cataloguing/value_builder/marc21_field_008.pl +++ b/cataloguing/value_builder/marc21_field_008.pl @@ -47,6 +47,10 @@ sub plugin_parameters { } sub plugin_javascript { + my $lang = C4::Context->preference('DefaultLanguageField008' ); + $lang = "eng" unless $lang; + $lang = pack("A3", $lang); + my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; my $function_name = $field_number; my $res = " @@ -54,11 +58,10 @@ sub plugin_javascript { //preference('DefaultLanguageField008' ); + $lang = "eng" unless $lang; + $lang = pack("A3", $lang); + my ($input) = @_; my $index = $input->param('index'); my $result = $input->param('result'); @@ -96,7 +103,7 @@ sub plugin { } ); - $result = "$dateentered" . "b xxu||||| |||| 00| 0 eng d" unless $result; + $result = "$dateentered" . "b xxu||||| |||| 00| 0 $lang d" unless $result; my $errorXml = ''; # Check if the xml, xsd exists and is validated my $dir = C4::Context->config('intrahtdocs') . '/prog/' . $template->{lang} . '/modules/cataloguing/value_builder/'; diff --git a/cataloguing/value_builder/normarc_field_008.pl b/cataloguing/value_builder/normarc_field_008.pl index 4fc8919ef6..5efe9a8ee7 100755 --- a/cataloguing/value_builder/normarc_field_008.pl +++ b/cataloguing/value_builder/normarc_field_008.pl @@ -44,6 +44,9 @@ sub plugin_parameters { } sub plugin_javascript { + my $lang = C4::Context->preference('DefaultLanguageField008' ); + $lang = "eng" unless $lang; + $lang = pack("A3", $lang); my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; my $function_name = $field_number; my $res = " @@ -55,7 +58,7 @@ function Focus$function_name(subfield_managed) { if ( document.getElementById(\"$field_number\").value ) { } else { - document.getElementById(\"$field_number\").value='$dateentered' + 't xxu||||| |||| 00| 0 eng d'; + document.getElementById(\"$field_number\").value='$dateentered' + 't xxu||||| |||| 00| 0 $lang d'; } return 1; } @@ -78,6 +81,9 @@ function Clic$function_name(i) { } sub plugin { + my $lang = C4::Context->preference('DefaultLanguageField008' ); + $lang = "eng" unless $lang; + $lang = pack("A3", $lang); my ($input) = @_; my $index = $input->param('index'); my $result = $input->param('result'); @@ -95,7 +101,7 @@ sub plugin { ); # $result = " t xxu 00 0 eng d" unless $result; - $result = "$dateentered" . "t xxu||||| |||| 00| 0 eng d" unless $result; + $result = "$dateentered" . "t xxu||||| |||| 00| 0 $lang d" unless $result; my $f1 = substr($result, 0, 6); my $f6 = substr($result, 6, 1); my $f710 = substr($result, 7, 4); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 241348a057..c4060fe346 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -368,3 +368,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IssueLostItem', 'alert', 'alert|confirm|nothing', 'Defines what should be done when an attempt is made to issue an item that has been marked as lost.', 'Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsIntranet', '1', NULL , 'Allow holds to be suspended from the intranet.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('DefaultLanguageField008','','Fill in the default language for field 008 Range 35-37 (e.g. eng, nor, ger, see MARC Code List for Languages)','','Free'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9cd4b14a78..62b437202d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5336,6 +5336,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion ="3.09.00.013"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('DefaultLanguageField008','','Fill in the default language for field 008 Range 35-37 (e.g. eng, nor, ger, see www.loc.gov/marc/languages/language_code.html)','','Free');"); + print "Upgrade to $DBversion done (Add system preference DefaultLanguageField008))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 10e1d13455..fe5fd05fc5 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 @@ -39,6 +39,10 @@ Cataloging: - buttons on the bib details page to print item spine labels. - Record Structure: + - + - Fill in the default language for field 008 Range 35-37 (e.g. eng, nor, ger, see MARC Code List for Languages) + - pref: DefaultLanguageField008 + - " Empty defaults to eng." - - Interpret and store MARC records in the - pref: marcflavour -- 2.39.5