6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA 02111-1307 USA
33 plugin_parameters : other parameters added when the plugin is called by the dopop function
37 sub plugin_parameters {
38 my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
42 sub plugin_javascript {
43 my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
44 my $function_name = "100" . ( int( rand(100000) ) + 1 );
47 function Focus$function_name(subfield_managed) {
51 function Blur$function_name(subfield_managed) {
55 function Clic$function_name(i) {
56 defaultvalue=document.forms['f'].field_value[i].value;
57 newin=window.open(\"plugin_launcher.pl?plugin_name=unimarc_field_100.pl&index=\"+i+\"&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
63 return ( $function_name, $res );
68 my $index = $input->param('index');
69 my $result = $input->param('result');
71 my $dbh = C4::Context->dbh;
73 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
75 template_name => "cataloguing/value_builder/unimarc_field_100.tmpl",
79 flagsrequired => { editcatalogue => 1 },
83 $result = ' d u y0frey50 ba' unless $result;
84 my $f1 = substr( $result, 0, 8 );
86 my @today = Date::Calc::Today();
87 $f1 = $today[0] . sprintf('%02s',$today[1]) . sprintf('%02s',$today[2]);
89 my $f2 = substr( $result, 8, 1 );
90 my $f3 = substr( $result, 9, 4 );
91 $f3='' if $f3 eq ' '; # empty publication year if only spaces, otherwise it's hard to fill the field
92 my $f4 = substr( $result, 13, 4 );
94 my $f5 = substr( $result, 17, 1 );
95 my $f6 = substr( $result, 18, 1 );
96 my $f7 = substr( $result, 19, 1 );
97 my $f8 = substr( $result, 20, 1 );
98 my $f9 = substr( $result, 21, 1 );
99 my $f10 = substr( $result, 22, 3 );
100 my $f11 = substr( $result, 25, 1 );
101 my $f12 = substr( $result, 26, 2 );
102 my $f13 = substr( $result, 28, 2 );
103 my $f14 = substr( $result, 30, 4 );
104 my $f15 = substr( $result, 34, 2 );
124 print $input->header( -cookie => $cookie ), $template->output;