|
Lines 27-32
use C4::Context;
Link Here
|
| 27 |
use C4::Search; |
27 |
use C4::Search; |
| 28 |
use C4::Output; |
28 |
use C4::Output; |
| 29 |
|
29 |
|
|
|
30 |
use constant FIXLEN_DATA_ELTS => '|| aca||aabn | a|a d'; |
| 31 |
use constant PREF_008 => 'MARCAuthorityControlField008'; |
| 32 |
|
| 30 |
=head1 DESCRIPTION |
33 |
=head1 DESCRIPTION |
| 31 |
|
34 |
|
| 32 |
plugin_parameters : other parameters added when the plugin is called by the dopop function |
35 |
plugin_parameters : other parameters added when the plugin is called by the dopop function |
|
Lines 38-43
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
Link Here
|
| 38 |
|
41 |
|
| 39 |
$year +=1900; $mon +=1; |
42 |
$year +=1900; $mon +=1; |
| 40 |
my $dateentered = substr($year,2,2).sprintf ("%0.2d", $mon).sprintf ("%0.2d",$mday); |
43 |
my $dateentered = substr($year,2,2).sprintf ("%0.2d", $mon).sprintf ("%0.2d",$mday); |
|
|
44 |
my $defaultval = Field008(); |
| 45 |
|
| 41 |
sub plugin_parameters { |
46 |
sub plugin_parameters { |
| 42 |
my ($dbh,$record,$tagslib,$i,$tabloop) = @_; |
47 |
my ($dbh,$record,$tagslib,$i,$tabloop) = @_; |
| 43 |
return ""; |
48 |
return ""; |
|
Lines 52-58
sub plugin_javascript {
Link Here
|
| 52 |
|
57 |
|
| 53 |
function Focus$function_name(subfield_managed) { |
58 |
function Focus$function_name(subfield_managed) { |
| 54 |
if (!document.getElementById(\"$field_number\").value) { |
59 |
if (!document.getElementById(\"$field_number\").value) { |
| 55 |
document.getElementById(\"$field_number\").value='$dateentered' + '|| aca||aabn | a|a d'; |
60 |
var authtype=document.forms['f'].elements['authtypecode'].value; |
|
|
61 |
var fieldval='$dateentered$defaultval'; |
| 62 |
if(authtype && (authtype == 'TOPIC_TERM' || authtype == 'GENRE/FORM' || authtype == 'CHRON_TERM')) { |
| 63 |
fieldval= fieldval.substr(0,14)+'b'+fieldval.substr(15); |
| 64 |
} |
| 65 |
document.getElementById(\"$field_number\").value=fieldval; |
| 56 |
} |
66 |
} |
| 57 |
return 1; |
67 |
return 1; |
| 58 |
} |
68 |
} |
|
Lines 62-69
function Blur$function_name(subfield_managed) {
Link Here
|
| 62 |
} |
72 |
} |
| 63 |
|
73 |
|
| 64 |
function Clic$function_name(i) { |
74 |
function Clic$function_name(i) { |
|
|
75 |
var authtype=document.forms['f'].elements['authtypecode'].value; |
| 65 |
defaultvalue=document.getElementById(\"$field_number\").value; |
76 |
defaultvalue=document.getElementById(\"$field_number\").value; |
| 66 |
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'); |
77 |
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'); |
| 67 |
|
78 |
|
| 68 |
} |
79 |
} |
| 69 |
//]]> |
80 |
//]]> |
|
Lines 76-82
sub plugin {
Link Here
|
| 76 |
my ($input) = @_; |
87 |
my ($input) = @_; |
| 77 |
my $index= $input->param('index'); |
88 |
my $index= $input->param('index'); |
| 78 |
my $result= $input->param('result'); |
89 |
my $result= $input->param('result'); |
| 79 |
|
90 |
my $authtype= $input->param('authtypecode')||''; |
|
|
91 |
substr($defaultval,14-6,1)='b' if $authtype=~ /TOPIC_TERM|GENRE.FORM|CHRON_TERM/; |
| 80 |
|
92 |
|
| 81 |
my $dbh = C4::Context->dbh; |
93 |
my $dbh = C4::Context->dbh; |
| 82 |
|
94 |
|
|
Lines 88-94
sub plugin {
Link Here
|
| 88 |
flagsrequired => {editcatalogue => '*'}, |
100 |
flagsrequired => {editcatalogue => '*'}, |
| 89 |
debug => 1, |
101 |
debug => 1, |
| 90 |
}); |
102 |
}); |
| 91 |
$result = "$dateentered".'|| aca||aabn | a|a d' unless $result; |
103 |
$result = "$dateentered$defaultval" unless $result; |
| 92 |
my $f1 = substr($result,0,6); |
104 |
my $f1 = substr($result,0,6); |
| 93 |
my $f6 = substr($result,6,1); |
105 |
my $f6 = substr($result,6,1); |
| 94 |
my $f7 = substr($result,7,1); |
106 |
my $f7 = substr($result,7,1); |
|
Lines 105-111
sub plugin {
Link Here
|
| 105 |
my $f28 = substr($result,28,1); |
117 |
my $f28 = substr($result,28,1); |
| 106 |
my $f29 = substr($result,29,1); |
118 |
my $f29 = substr($result,29,1); |
| 107 |
my $f31 = substr($result,31,1); |
119 |
my $f31 = substr($result,31,1); |
| 108 |
my $f32 = substr($result,32,2); |
120 |
my $f32 = substr($result,32,1); |
| 109 |
my $f33 = substr($result,33,1); |
121 |
my $f33 = substr($result,33,1); |
| 110 |
my $f38 = substr($result,38,1); |
122 |
my $f38 = substr($result,38,1); |
| 111 |
my $f39 = substr($result,39,1); |
123 |
my $f39 = substr($result,39,1); |
|
Lines 158-161
if ((!$f1) ||($f1 =~ m/ /)){
Link Here
|
| 158 |
output_html_with_http_headers $input, $cookie, $template->output; |
170 |
output_html_with_http_headers $input, $cookie, $template->output; |
| 159 |
} |
171 |
} |
| 160 |
|
172 |
|
|
|
173 |
sub Field008 { |
| 174 |
my $pref= C4::Context->preference(PREF_008); |
| 175 |
if(!$pref) { |
| 176 |
return FIXLEN_DATA_ELTS; |
| 177 |
} |
| 178 |
elsif(length($pref)<34) { |
| 179 |
warn "marc21_field_008_authorities.pl: Syspref ".PREF_008." should be 34 characters long "; |
| 180 |
return FIXLEN_DATA_ELTS; |
| 181 |
} |
| 182 |
return substr($pref,0,34); #ignore remainder |
| 183 |
} |
| 184 |
|
| 161 |
1; |
185 |
1; |