Lines 1-6
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
|
|
|
4 |
# Copyright 2000-2002 Katipo Communications |
3 |
# Copyright 2000-2002 Katipo Communications |
5 |
# |
4 |
# |
6 |
# This file is part of Koha. |
5 |
# This file is part of Koha. |
Lines 26-31
use C4::Context;
Link Here
|
26 |
|
25 |
|
27 |
use C4::Search; |
26 |
use C4::Search; |
28 |
use C4::Output; |
27 |
use C4::Output; |
|
|
28 |
use Koha::Util::FrameworkPlugin qw|date_entered|; |
29 |
|
29 |
|
30 |
use constant FIXLEN_DATA_ELTS => '|| aca||aabn | a|a d'; |
30 |
use constant FIXLEN_DATA_ELTS => '|| aca||aabn | a|a d'; |
31 |
use constant PREF_008 => 'MARCAuthorityControlField008'; |
31 |
use constant PREF_008 => 'MARCAuthorityControlField008'; |
Lines 36-51
plugin_parameters : other parameters added when the plugin is called by the dopo
Link Here
|
36 |
|
36 |
|
37 |
=cut |
37 |
=cut |
38 |
|
38 |
|
39 |
# find today's date |
|
|
40 |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); |
41 |
|
42 |
$year +=1900; $mon +=1; |
43 |
my $dateentered = substr($year,2,2).sprintf ("%0.2d", $mon).sprintf ("%0.2d",$mday); |
44 |
my $defaultval = Field008(); |
45 |
|
46 |
sub plugin_javascript { |
39 |
sub plugin_javascript { |
47 |
my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; |
40 |
my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; |
48 |
my $function_name= $field_number; |
41 |
my $function_name= $field_number; |
|
|
42 |
my $dateentered = date_entered(); |
43 |
my $defaultval = substr( C4::Context->preference(PREF_008) || FIXLEN_DATA_ELTS, 0, 34 ); |
49 |
my $res=" |
44 |
my $res=" |
50 |
<script type=\"text/javascript\"> |
45 |
<script type=\"text/javascript\"> |
51 |
//<![CDATA[ |
46 |
//<![CDATA[ |
Lines 79-84
sub plugin {
Link Here
|
79 |
my $index= $input->param('index'); |
74 |
my $index= $input->param('index'); |
80 |
my $result= $input->param('result'); |
75 |
my $result= $input->param('result'); |
81 |
my $authtype= $input->param('authtypecode')||''; |
76 |
my $authtype= $input->param('authtypecode')||''; |
|
|
77 |
|
78 |
my $defaultval = substr( C4::Context->preference(PREF_008) || FIXLEN_DATA_ELTS, 0, 34 ); |
82 |
substr($defaultval,14-6,1)='b' if $authtype=~ /TOPIC_TERM|GENRE.FORM|CHRON_TERM/; |
79 |
substr($defaultval,14-6,1)='b' if $authtype=~ /TOPIC_TERM|GENRE.FORM|CHRON_TERM/; |
83 |
|
80 |
|
84 |
my $dbh = C4::Context->dbh; |
81 |
my $dbh = C4::Context->dbh; |
Lines 91-96
sub plugin {
Link Here
|
91 |
flagsrequired => {editcatalogue => '*'}, |
88 |
flagsrequired => {editcatalogue => '*'}, |
92 |
debug => 1, |
89 |
debug => 1, |
93 |
}); |
90 |
}); |
|
|
91 |
my $dateentered = date_entered(); |
94 |
$result = "$dateentered$defaultval" unless $result; |
92 |
$result = "$dateentered$defaultval" unless $result; |
95 |
my @f; |
93 |
my @f; |
96 |
for(0,6..17,28,29,31..33,38,39) { |
94 |
for(0,6..17,28,29,31..33,38,39) { |
Lines 109-123
sub plugin {
Link Here
|
109 |
} |
107 |
} |
110 |
output_html_with_http_headers $input, $cookie, $template->output; |
108 |
output_html_with_http_headers $input, $cookie, $template->output; |
111 |
} |
109 |
} |
112 |
|
|
|
113 |
sub Field008 { |
114 |
my $pref= C4::Context->preference(PREF_008); |
115 |
if(!$pref) { |
116 |
return FIXLEN_DATA_ELTS; |
117 |
} |
118 |
elsif(length($pref)<34) { |
119 |
warn "marc21_field_008_authorities.pl: Syspref ".PREF_008." should be 34 characters long "; |
120 |
return FIXLEN_DATA_ELTS; |
121 |
} |
122 |
return substr($pref,0,34); #ignore remainder |
123 |
} |