Hi all,
I would like to check if any of you feel the following adjustment on the marc21
field 008 plugin, is interesting for the community.
>From bug report #4839:
Currently, the default for this marc field is hardcoded in the plugin code of
marc21_field_008_authorities.pl (two occurrences).
I suggest to move this value to a new system preference. If this pref should
not exist, the old hardcoded value could still be used.
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).
Finally, a small bug should be resolved on the line:
my $f32 = substr($result,32,2);
this field is only one character, so should be:
my $f32 = substr($result,32,1);
Preview of patch: see below.
Regards,
Marcel
---
.../value_builder/marc21_field_008_authorities.pl | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/cataloguing/value_builder/marc21_field_008_authorities.pl
b/cataloguing/value_builder/marc21_field_008_authorities.pl
index 1aae045..d05bea0 100755
--- a/cataloguing/value_builder/marc21_field_008_authorities.pl
+++ b/cataloguing/value_builder/marc21_field_008_authorities.pl
@@ -37,6 +37,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 = C4::Context->preference('AuthorityField008Default') || '||
aca||aabn | a|a d';
+
sub plugin_parameters {
my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
return "";
@@ -51,7 +53,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;
}
@@ -61,8 +68,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,\"unimarc
field 100\",'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,\"unimarc
field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
}
//]]>
@@ -75,7 +83,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;
@@ -87,7 +96,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);
@@ -104,7 +113,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);
--
1.6.0.6
_______________________________________________
Koha-devel mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel