Bug 7276 : Follow up, adding a sub to clear the cache
[koha.git] / cataloguing / value_builder / unimarc_field_210c_bis.pl
1 #!/usr/bin/perl
2
3 # Copyright 2000-2002 Katipo Communications
4 #
5 # This file is part of Koha.
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 =head1 SYNOPSIS
21
22 This plugin is used to map isbn/editor with collection.
23 It need :
24   in thesaurus, a category named EDITORS
25   in this category, datas must be entered like following :
26   isbn separator editor separator collection.
27   for example :
28   2204 -- Cerf -- Cogitatio fidei
29   2204 -- Cerf -- Le Magistere de l'Eglise
30   2204 -- Cerf -- Lectio divina
31   2204 -- Cerf -- Lire la Bible
32   2204 -- Cerf -- Pour lire
33   2204 -- Cerf -- Sources chretiennes
34
35   when the user clic on ... on 225a line, the popup shows the list of collections from the selected editor
36   if the biblio has no isbn, then the search if done on editor only
37   If the biblio ha an isbn, the search is done on isbn and editor. It's faster.
38
39 =over 2
40
41 =cut
42
43 use strict;
44
45 #use warnings; FIXME - Bug 2505
46 use C4::Auth;
47 use CGI;
48 use C4::Context;
49
50 use C4::AuthoritiesMarc;
51 use C4::Output;
52
53 =head1
54
55 plugin_parameters : other parameters added when the plugin is called by the dopop function
56
57 =cut
58
59 sub plugin_parameters {
60     my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
61     return "";
62 }
63
64 sub plugin_javascript {
65     my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
66     my $function_name = $field_number;
67     my $res           = "
68     <script type=\"text/javascript\">
69         function Focus$function_name(subfield_managed) {
70             return 1;
71         }
72     
73         function Blur$function_name(subfield_managed) {
74             return 1;
75         }
76     
77         function Clic$function_name(index) {
78             window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c_bis.pl&index=\"+index,\"unimarc210c\",'width=500,height=400,toolbar=false,scrollbars=no');
79         }
80     </script>
81 ";
82
83     return ( $function_name, $res );
84 }
85
86 sub plugin {
87     my ($input)      = @_;
88     my $index        = $input->param('index');
89     my $result       = $input->param('result');
90     my $editor_found = $input->param('editor_found');
91     my $authoritysep = C4::Context->preference("authoritysep");
92     warn Data::Dumper::Dumper $index;
93
94     my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
95         {   template_name   => "cataloguing/value_builder/unimarc_field_210c_bis.tmpl",
96             query           => $input,
97             type            => "intranet",
98             authnotrequired => 0,
99             flagsrequired   => { editcatalogue => '*' },
100             debug           => 1,
101         }
102     );
103
104    $template->param(
105         index      => $index,
106     );
107     output_html_with_http_headers $input, $cookie, $template->output;
108 }
109
110 1;