X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=cataloguing%2Fvalue_builder%2Fcallnumber-KU.pl;h=37b7e16d0065595a138f9d291518a9e1df436758;hb=7eced5a05475f2372cfcf9a8aaf702246f7dd0dd;hp=4a0dd773c139a5bf21bfa3ecbe555f58f285ae09;hpb=e20270fec4f6d34f01050bea4c5765d5b3c4ed33;p=srvgit diff --git a/cataloguing/value_builder/callnumber-KU.pl b/cataloguing/value_builder/callnumber-KU.pl index 4a0dd773c1..37b7e16d00 100755 --- a/cataloguing/value_builder/callnumber-KU.pl +++ b/cataloguing/value_builder/callnumber-KU.pl @@ -1,27 +1,30 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2012 CatalystIT Ltd # # This file is part of Koha. # -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. # -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along -# with Koha; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . -use strict; -use warnings; -use C4::Auth; +use Modern::Perl; use CGI qw ( -utf8 ); + +use C4::Auth qw( get_template_and_user ); use C4::Context; +use C4::Output qw( output_html_with_http_headers ); =head1 DESCRIPTION @@ -39,23 +42,12 @@ CCC QW - returns first unused number CCC QWxx starting with CCC QW01 =cut -sub plugin_parameters { -} - -sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; +my $builder = sub { + my ( $params ) = @_; my $res=" - "; + return $res; +}; - return ($field_number,$res); -} - -my $BASE_CALLNUMBER_RE = qr/^(\w+) (\w+)$/; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $code = $input->param('code'); my ($template, $loggedinuser, $cookie) = get_template_and_user({ template_name => "cataloguing/value_builder/ajax.tt", query => $input, type => "intranet", - authnotrequired => 0, flagsrequired => {editcatalogue => '*'}, - debug => 1, }); + my $BASE_CALLNUMBER_RE = qr/^(\w+) (\w+)$/; my $ret; my ($alpha, $num) = ($code =~ $BASE_CALLNUMBER_RE); if (defined $num) { # otherwise no point @@ -127,6 +117,6 @@ sub plugin { return => $ret || $code ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; -1; +return { builder => $builder, launcher => $launcher };