View | Details | Raw Unified | Return to bug 13223
Collapse All | Expand All

(-)a/Koha/Util/FrameworkPlugin.pm (+55 lines)
Line 0 Link Here
1
package Koha::Util::FrameworkPlugin;
2
3
# Module contains subroutines used in the framework plugins
4
#
5
# Copyright 2014 Koha Development Team
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 3 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
23
use Modern::Perl;
24
25
our ( @ISA, @EXPORT, @EXPORT_OK );
26
BEGIN {
27
    require Exporter;
28
    @ISA = qw( Exporter );
29
    @EXPORT = qw( );
30
    @EXPORT_OK = qw( wrapper );
31
}
32
33
=head1 NAME
34
35
Koha::Util::Plugin - utility class with routines for framework plugins
36
37
=head1 FUNCTIONS
38
39
=head2 wrapper
40
41
    wrapper returns a text for strings containing spaces, pipe chars, ...
42
    The wrapper subroutine is used in several UNIMARC plugins.
43
44
=cut
45
46
sub wrapper {
47
    my ( $str ) = @_;
48
    return "space" if $str eq " ";
49
    return "dblspace" if $str eq "  ";
50
    return "pipe" if $str eq "|";
51
    return "dblpipe" if $str eq "||";
52
    return $str;
53
}
54
55
1;
(-)a/cataloguing/value_builder/unimarc_field_100.pl (-7 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 67-79 sub plugin_javascript { Link Here
67
    return ( $field_number, $res );
69
    return ( $field_number, $res );
68
}
70
}
69
71
70
sub wrapper {
71
    my ($char) = @_;
72
    return "space" if $char eq " ";
73
    return "dblspace" if $char eq "  ";
74
    return "pipe" if $char eq "|";
75
    return $char;
76
}
77
72
78
sub plugin {
73
sub plugin {
79
    my ($input) = @_;
74
    my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_100_authorities.pl (-7 / +2 lines)
Lines 18-23 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
22
use Koha::Util::FrameworkPlugin qw(wrapper);
21
use C4::Auth;
23
use C4::Auth;
22
use CGI;
24
use CGI;
23
use C4::Context;
25
use C4::Context;
Lines 65-77 sub plugin_javascript { Link Here
65
    return ( $field_number, $res );
67
    return ( $field_number, $res );
66
}
68
}
67
69
68
sub wrapper {
69
    my ($char) = @_;
70
    return "space" if $char eq " ";
71
    return "dblspace" if $char eq "  ";
72
    return "pipe" if $char eq "|";
73
    return $char;
74
}
75
70
76
sub plugin {
71
sub plugin {
77
    my ($input) = @_;
72
    my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_105.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 63-74 sub plugin_javascript { Link Here
63
    return ($field_number,$res);
65
    return ($field_number,$res);
64
}
66
}
65
67
66
sub wrapper {
67
    my ($char) = @_;
68
    return "space" if $char eq " ";
69
    return "pipe" if $char eq "|";
70
    return $char;
71
}
72
68
73
sub plugin {
69
sub plugin {
74
    my ($input) = @_;
70
    my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_110.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 63-74 sub plugin_javascript { Link Here
63
    return ($field_number,$res);
65
    return ($field_number,$res);
64
}
66
}
65
67
66
sub wrapper {
67
    my ($char) = @_;
68
    return "space" if $char eq " ";
69
    return "pipe" if $char eq "|";
70
    return $char;
71
}
72
68
73
sub plugin {
69
sub plugin {
74
my ($input) = @_;
70
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_115a.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 69-80 sub plugin_javascript { Link Here
69
    return ( $field_number, $res );
71
    return ( $field_number, $res );
70
}
72
}
71
73
72
sub wrapper {
73
    my ($char) = @_;
74
    return "space" if $char eq " ";
75
    return "pipe" if $char eq "|";
76
    return $char;
77
}
78
74
79
sub plugin {
75
sub plugin {
80
    my ($input) = @_;
76
    my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_115b.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 63-74 function Clic$field_number() { Link Here
63
    return ( $field_number, $res );
65
    return ( $field_number, $res );
64
}
66
}
65
67
66
sub wrapper {
67
    my ($char) = @_;
68
    return "space" if $char eq " ";
69
    return "pipe" if $char eq "|";
70
    return $char;
71
}
72
68
73
sub plugin {
69
sub plugin {
74
    my ($input) = @_;
70
    my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_116.pl (-8 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 63-76 function Clic$field_number(i) { Link Here
63
    return ( $field_number, $res );
65
    return ( $field_number, $res );
64
}
66
}
65
67
66
sub wrapper {
67
    my ($char) = @_;
68
    return "space" if $char eq " ";
69
    return "dblspace" if $char eq "  ";
70
    return "pipe" if $char eq "|";
71
    return "dblpipe" if $char eq "||";
72
    return $char;
73
}
74
68
75
sub plugin {
69
sub plugin {
76
    my ($input) = @_;
70
    my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_117.pl (-8 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 63-76 function Clic$field_number(i) { Link Here
63
return ($field_number,$res);
65
return ($field_number,$res);
64
}
66
}
65
67
66
sub wrapper {
67
    my ($char) = @_;
68
    return "space" if $char eq " ";
69
    return "dblspace" if $char eq "  ";
70
    return "pipe" if $char eq "|";
71
    return "dblpipe" if $char eq "||";
72
    return $char;
73
}
74
68
75
sub plugin {
69
sub plugin {
76
my ($input) = @_;
70
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_120.pl (-7 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 64-76 function Clic$function_name(i) { Link Here
64
return ($function_name,$res);
66
return ($function_name,$res);
65
}
67
}
66
68
67
sub wrapper {
68
    my ($char) = @_;
69
    return "space" if $char eq " ";
70
    return "dblspace" if $char eq "  ";
71
    return "pipe" if $char eq "|";
72
    return $char;
73
}
74
69
75
sub plugin {
70
sub plugin {
76
my ($input) = @_;
71
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_121a.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 64-75 function Clic$function_name(i) { Link Here
64
return ($function_name,$res);
66
return ($function_name,$res);
65
}
67
}
66
68
67
sub wrapper {
68
    my ($char) = @_;
69
    return "space" if $char eq " ";
70
    return "pipe" if $char eq "|";
71
    return $char;
72
}
73
69
74
sub plugin {
70
sub plugin {
75
my ($input) = @_;
71
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_125b.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 61-72 function Clic$function_name(i) { Link Here
61
return ($function_name,$res);
63
return ($function_name,$res);
62
}
64
}
63
65
64
sub wrapper {
65
    my ($char) = @_;
66
    return "space" if $char eq " ";
67
    return "pipe" if $char eq "|";
68
    return $char;
69
}
70
66
71
sub plugin {
67
sub plugin {
72
my ($input) = @_;
68
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_126a.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 61-72 function Clic$function_name(i) { Link Here
61
return ($function_name,$res);
63
return ($function_name,$res);
62
}
64
}
63
65
64
sub wrapper {
65
    my ($char) = @_;
66
    return "space" if $char eq " ";
67
    return "pipe" if $char eq "|";
68
    return $char;
69
}
70
66
71
sub plugin {
67
sub plugin {
72
my ($input) = @_;
68
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_128b.pl (-5 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 61-71 function Clic$function_name(i) { Link Here
61
return ($function_name,$res);
63
return ($function_name,$res);
62
}
64
}
63
65
64
sub wrapper {
65
    my ($char) = @_;
66
    return "dblpipe" if $char eq "||";
67
    return $char;
68
}
69
66
70
sub plugin {
67
sub plugin {
71
my ($input) = @_;
68
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_130.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 62-73 function Clic$function_name(i) { Link Here
62
return ($function_name,$res);
64
return ($function_name,$res);
63
}
65
}
64
66
65
sub wrapper {
66
    my ($char) = @_;
67
    return "space" if $char eq " ";
68
    return "pipe" if $char eq "|";
69
    return $char;
70
}
71
67
72
sub plugin {
68
sub plugin {
73
my ($input) = @_;
69
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_135a.pl (-6 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 64-75 function Clic$function_name(i) { Link Here
64
return ($function_name,$res);
66
return ($function_name,$res);
65
}
67
}
66
68
67
sub wrapper {
68
    my ($char) = @_;
69
    return "space" if $char eq " ";
70
    return "pipe" if $char eq "|";
71
    return $char;
72
}
73
69
74
sub plugin {
70
sub plugin {
75
my ($input) = @_;
71
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_field_140.pl (-7 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 64-76 function Clic$function_name(i) { Link Here
64
return ($function_name,$res);
66
return ($function_name,$res);
65
}
67
}
66
68
67
sub wrapper {
68
    my ($char) = @_;
69
    return "space" if $char eq " ";
70
    return "dblspace" if $char eq "  ";
71
    return "pipe" if $char eq "|";
72
    return $char;
73
}
74
69
75
sub plugin {
70
sub plugin {
76
my ($input) = @_;
71
my ($input) = @_;
(-)a/cataloguing/value_builder/unimarc_leader.pl (-7 / +2 lines)
Lines 20-25 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
25
use C4::Auth;
24
use CGI;
26
use CGI;
25
use C4::Context;
27
use C4::Context;
Lines 68-79 function Clic$function_name(i) { Link Here
68
    return ( $function_name, $res );
70
    return ( $function_name, $res );
69
}
71
}
70
72
71
sub wrapper {
72
    my ($char) = @_;
73
    return "space" if $char eq " ";
74
    return "pipe" if $char eq "|";
75
    return $char;
76
}
77
73
78
sub plugin {
74
sub plugin {
79
    my ($input) = @_;
75
    my ($input) = @_;
80
- 

Return to bug 13223