3 # Copyright 2009 Magnus Enger Libriotech
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
29 my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
33 my $dateentered = substr($year, 2, 2) . sprintf("%0.2d", $mon) . sprintf("%0.2d", $mday);
35 sub plugin_javascript
{
36 my $lang = C4
::Context
->preference('DefaultLanguageField008' );
37 $lang = "eng" unless $lang;
38 $lang = pack("A3", $lang);
39 my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_;
40 my $function_name = $field_number;
42 <script type=\"text/javascript\">
45 function Focus$function_name(subfield_managed) {
47 if ( document.getElementById(\"$field_number\").value ) {
50 document.getElementById(\"$field_number\").value='$dateentered' + 't no ||||| |||| 00| 0 $lang d';
55 function Clic$function_name(i) {
56 defaultvalue=document.getElementById(\"$field_number\").value;
57 defaultvalue=defaultvalue.replace(/ /g, \"+\");
58 newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=normarc_field_008.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
65 return ($function_name, $res);
69 my $lang = C4
::Context
->preference('DefaultLanguageField008' );
70 $lang = "eng" unless $lang;
71 $lang = pack("A3", $lang);
73 my $index = $input->param('index');
74 my $result = $input->param('result');
76 my $dbh = C4
::Context
->dbh;
78 my ($template, $loggedinuser, $cookie) = get_template_and_user
(
79 { template_name
=> "cataloguing/value_builder/normarc_field_008.tt",
83 flagsrequired
=> { editcatalogue
=> 1 },
88 # $result = " t xxu 00 0 eng d" unless $result;
89 $result = "$dateentered" . "t no ||||| |||| 00| 0 $lang d" unless $result;
90 my $f1 = substr($result, 0, 6);
91 my $f6 = substr($result, 6, 1);
92 my $f710 = substr($result, 7, 4);
93 my $f1114 = substr($result, 11, 4);
94 my $f1517 = substr($result, 15, 3);
95 my $f18 = substr($result, 18, 1);
96 my $f19 = substr($result, 19, 1);
97 my $f20 = substr($result, 20, 1);
98 my $f21 = substr($result, 21, 1);
99 my $f22 = substr($result, 22, 1);
100 my $f23 = substr($result, 23, 1);
101 my $f24 = substr($result, 24, 1);
102 my $f25 = substr($result, 25, 1);
103 my $f26 = substr($result, 26, 1);
104 my $f27 = substr($result, 27, 1);
105 my $f28 = substr($result, 28, 1);
106 my $f29 = substr($result, 29, 1);
107 my $f30 = substr($result, 30, 1);
108 my $f31 = substr($result, 31, 1);
109 my $f32 = substr($result, 32, 1);
110 my $f33 = substr($result, 33, 1);
111 my $f34 = substr($result, 34, 1);
112 my $f3537 = substr($result, 35, 3);
113 my $f38 = substr($result, 38, 1);
114 my $f39 = substr($result, 39, 1);
117 $f710 = "" if ($f710 =~ /^\s*$/);
118 $f1114 = "" if ($f1114 =~ /^\s*$/);
120 if ((!$f1) || ($f1 =~ m/ /)) {
172 output_html_with_http_headers
$input, $cookie, $template->output;