Bugzilla – Attachment 3337 Details for
Bug 4839
Adjust default values for MARC21 authority Fixed-Length Data Elements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for functionality
patch.txt (text/plain), 5.72 KB, created by
Marcel de Rooy
on 2011-03-17 11:56:55 UTC
(
hide
)
Description:
Patch for functionality
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2011-03-17 11:56:55 UTC
Size:
5.72 KB
patch
obsolete
>From c458e672ea75c530ef0bb9e24f0e23eaf7be8886 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 29 Nov 2010 14:29:34 +0100 >Subject: [PATCH] [UPDATED] Bug 4839: Adjust default values for MARC21 authority Fixed-Length Data Elements >Content-Type: text/plain; charset="utf-8" > >Currently, the default for this MARC control field is hardcoded in the plugin code of marc21_field_008_authorities.pl (two occurrences). >This patch moves it into a new syspref. If this pref should not exist, the old hardcoded value is used. Authorities preference file is updated too. >A warning is generated if the length of the field is not correct. > >Furthermore, the default for position 14 (heading use: main or added entry) >should be dependent on the authority type. For CHRON_TERM, GENRE/FORM and >TOPIC_TERM, it should be b (not appropriate) instead of a (appropriate). > >Rebased on March 17. Follow-up patch added for installation pref. >--- > .../value_builder/marc21_field_008_authorities.pl | 34 +++++++++++++++++--- > .../en/modules/admin/preferences/authorities.pref | 6 +++ > 2 files changed, 35 insertions(+), 5 deletions(-) > >diff --git a/cataloguing/value_builder/marc21_field_008_authorities.pl b/cataloguing/value_builder/marc21_field_008_authorities.pl >index b887806..a7a671e 100755 >--- a/cataloguing/value_builder/marc21_field_008_authorities.pl >+++ b/cataloguing/value_builder/marc21_field_008_authorities.pl >@@ -27,6 +27,9 @@ use C4::Context; > use C4::Search; > use C4::Output; > >+use constant FIXLEN_DATA_ELTS => '|| aca||aabn | a|a d'; >+use constant PREF_008 => 'MARCAuthorityControlField008'; >+ > =head1 DESCRIPTION > > plugin_parameters : other parameters added when the plugin is called by the dopop function >@@ -38,6 +41,8 @@ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); > > $year +=1900; $mon +=1; > my $dateentered = substr($year,2,2).sprintf ("%0.2d", $mon).sprintf ("%0.2d",$mday); >+my $defaultval = Field008(); >+ > sub plugin_parameters { > my ($dbh,$record,$tagslib,$i,$tabloop) = @_; > return ""; >@@ -52,7 +57,12 @@ sub plugin_javascript { > > function Focus$function_name(subfield_managed) { > if (!document.getElementById(\"$field_number\").value) { >- document.getElementById(\"$field_number\").value='$dateentered' + '|| aca||aabn | a|a d'; >+ var authtype=document.forms['f'].elements['authtypecode'].value; >+ var fieldval='$dateentered$defaultval'; >+ if(authtype && (authtype == 'TOPIC_TERM' || authtype == 'GENRE/FORM' || authtype == 'CHRON_TERM')) { >+ fieldval= fieldval.substr(0,14)+'b'+fieldval.substr(15); >+ } >+ document.getElementById(\"$field_number\").value=fieldval; > } > return 1; > } >@@ -62,8 +72,9 @@ function Blur$function_name(subfield_managed) { > } > > function Clic$function_name(i) { >+ var authtype=document.forms['f'].elements['authtypecode'].value; > defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_authorities.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_authorities.pl&index=$field_number&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> >@@ -76,7 +87,8 @@ sub plugin { > my ($input) = @_; > my $index= $input->param('index'); > my $result= $input->param('result'); >- >+ my $authtype= $input->param('authtypecode')||''; >+ substr($defaultval,14-6,1)='b' if $authtype=~ /TOPIC_TERM|GENRE.FORM|CHRON_TERM/; > > my $dbh = C4::Context->dbh; > >@@ -88,7 +100,7 @@ sub plugin { > flagsrequired => {editcatalogue => '*'}, > debug => 1, > }); >- $result = "$dateentered".'|| aca||aabn | a|a d' unless $result; >+ $result = "$dateentered$defaultval" unless $result; > my $f1 = substr($result,0,6); > my $f6 = substr($result,6,1); > my $f7 = substr($result,7,1); >@@ -105,7 +117,7 @@ sub plugin { > my $f28 = substr($result,28,1); > my $f29 = substr($result,29,1); > my $f31 = substr($result,31,1); >- my $f32 = substr($result,32,2); >+ my $f32 = substr($result,32,1); > my $f33 = substr($result,33,1); > my $f38 = substr($result,38,1); > my $f39 = substr($result,39,1); >@@ -158,4 +170,16 @@ if ((!$f1) ||($f1 =~ m/ /)){ > output_html_with_http_headers $input, $cookie, $template->output; > } > >+sub Field008 { >+ my $pref= C4::Context->preference(PREF_008); >+ if(!$pref) { >+ return FIXLEN_DATA_ELTS; >+ } >+ elsif(length($pref)<34) { >+ warn "marc21_field_008_authorities.pl: Syspref ".PREF_008." should be 34 characters long "; >+ return FIXLEN_DATA_ELTS; >+ } >+ return substr($pref,0,34); #ignore remainder >+} >+ > 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >index 3d19af8..6cf91d3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >@@ -15,6 +15,12 @@ Authorities: > no: Do > - automatically update attached biblios when changing an authority record. If this is off, please ask your administrator to enable the merge_authorities.pl cronjob. > - >+ - Use the following text for the contents of MARC authority control field 008 position 06-39 (fixed length data elements). Do NOT include the date (position 00-05). >+ - pref: MARCAuthorityControlField008 >+ default: "|| aca||aabn | a|a d" >+ type: textarea >+ class: code >+ - > - pref: UseAuthoritiesForTracings > default: yes > choices: >-- >1.6.0.6 >
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 4839
:
2729
|
2889
|
3337
|
3338
|
4298
|
4328