Bug 7276 : Follow up, adding a sub to clear the cache
[koha.git] / cataloguing / value_builder / unimarc_field_700-4.pl
1 #!/usr/bin/perl
2
3 # written 10/5/2002 by Paul
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 under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
13 #
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License along
19 # with Koha; if not, write to the Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22 use strict;
23 #use warnings; FIXME - Bug 2505
24 use C4::Auth;
25 use CGI;
26 use C4::Context;
27
28 use C4::Search;
29 use C4::Output;
30
31 =head1 NAME
32
33 plugin unimarc_field_700-4
34
35 =head1 SYNOPSIS
36
37 This plug-in deals with unimarc field 700-4 (
38
39 =head1 DESCRIPTION
40
41 =head1 FUNCTIONS
42
43 =over 2
44
45 =cut
46
47 sub plugin_parameters {
48 my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
49 return "";
50 }
51
52 sub plugin_javascript {
53 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
54 my $function_name= $field_number;
55 my $res  = "
56 <script>
57 function Focus$function_name(index) {
58         return 1;
59 }
60
61 function Blur$function_name(subfield_managed) {
62         return 1;
63 }
64
65 function Clic$function_name(subfield_managed) {
66         defaultvalue=document.getElementById(\"$field_number\").value;
67         newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_700-4.pl&result=\"+defaultvalue+\"&index=$field_number\",\"value_builder\",'width=500,height=400,toolbar=false,scrollbars=yes');
68
69 }
70 </script>
71 ";
72
73 return ($function_name,$res);
74 }
75
76 sub plugin {
77 my ($input) = @_;
78         my $index= $input->param('index');
79         my $index2= $input->param('index2');
80         $index2=-1 unless($index2);
81         my $result= $input->param('result');
82
83
84         my $dbh = C4::Context->dbh;
85
86         my ($template, $loggedinuser, $cookie)
87         = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_700-4.tmpl",
88                                         query => $input,
89                                         type => "intranet",
90                                         authnotrequired => 0,
91                                         flagsrequired => {editcatalogue => '*'},
92                                         debug => 1,
93                                         });
94         $template->param(index => $index,
95                                                         index2 => $index2,
96                                                         "f1_$result" => "f1_".$result,
97                                                         );
98         output_html_with_http_headers $input, $cookie, $template->output;
99 }
100
101 1;