Bug 17117: Patron personal details not displayed unless branch update request is...
[koha.git] / cataloguing / value_builder / unimarc_field_225a_bis.pl
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18 =head1 SYNOPSIS
19
20 This plugin is used to fill 225$a with a value already existing in
21 biblioitems.collectiontitle
22
23 =cut
24
25 use Modern::Perl;
26
27 use C4::Auth;
28 use CGI qw( -utf8 );
29 use C4::Context;
30
31 use C4::Output;
32
33 sub plugin_javascript {
34     my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
35     my $function_name = $field_number;
36     my $res           = "
37     <script type=\"text/javascript\">
38         function Clic$function_name(index) {
39             window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_225a_bis.pl&index=\"+index,\"unimarc225a\",'width=500,height=400,toolbar=false,scrollbars=no');
40         }
41     </script>
42 ";
43
44     return ( $function_name, $res );
45 }
46
47 sub plugin {
48     my ($input) = @_;
49     my $index   = $input->param('index');
50
51     my ($template, $loggedinuser, $cookie) = get_template_and_user({
52         template_name   => "cataloguing/value_builder/unimarc_field_225a_bis.tt",
53         query           => $input,
54         type            => "intranet",
55         authnotrequired => 0,
56         flagsrequired   => { editcatalogue => '*' },
57         debug           => 1,
58     });
59
60     $template->param(index => $index);
61
62     output_html_with_http_headers $input, $cookie, $template->output;
63 }