Bug 36815: (follow-up) Use correct language for default
[koha.git] / cataloguing / value_builder / marc21_field_005.pl
1 #!/usr/bin/perl
2
3 # Converted to new plugin style (Bug 13437)
4
5 # Copyright 2000-2002 Katipo Communications
6 #
7 # This file is part of Koha.
8 #
9 # Koha is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # Koha is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21
22 use Modern::Perl;
23
24 use CGI qw ( -utf8 );
25 use C4::Auth qw( check_cookie_auth );
26 my $input = CGI->new;
27 my ($auth_status) =
28     check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => 1 } );
29 if ( $auth_status ne "ok" ) {
30     print $input->header( -type => 'text/plain', -status => '403 Forbidden' );
31     exit 0;
32 }
33
34 my $builder = sub {
35     my ( $params ) = @_;
36     my $function_name = $params->{id};
37
38     # find today's date
39     my @a= (localtime) [5,4,3,2,1,0]; $a[0]+=1900; $a[1]++;
40     my $date = sprintf("%4d%02d%02d%02d%02d%04.1f",@a);
41
42     my $res  = "
43 <script>
44
45 function Focus$function_name(event) {
46     document.getElementById(event.data.id).value='$date';
47 }
48
49 </script>
50 ";
51     return $res;
52 };
53
54 return { builder => $builder };