1 package Koha::Plugin::Test;
3 ## It's good practice to use Modern::Perl
6 use Koha::Exceptions::Exception;
7 use Mojo::JSON qw(decode_json);
9 ## Required for all plugins
10 use base qw(Koha::Plugins::Base);
14 name => 'Test Plugin',
15 author => 'Kyle M Hall',
16 description => 'Test plugin',
17 date_authored => '2013-01-14',
18 date_updated => '2013-01-14',
19 minimum_version => '3.11',
20 maximum_version => undef,
22 my_example_tag => 'find_me',
25 ## This is the minimum code required for a plugin's 'new' method
26 ## More can be added, but none should be removed
28 my ( $class, $args ) = @_;
29 $args->{'metadata'} = $metadata;
30 my $self = $class->SUPER::new($args);
35 my ( $self, $args ) = @_;
36 return "Koha::Plugin::Test::report";
40 my ( $self, $args ) = @_;
41 return "Koha::Plugin::Test::tool";
45 my ( $self, $args ) = @_;
46 return "Koha::Plugin::Test::to_marc";
49 sub intranet_catalog_biblio_enhancements_toolbar_button {
50 my ( $self, $args ) = @_;
51 return "Koha::Plugin::Test::intranet_catalog_biblio_enhancements_toolbar_button";
54 sub intranet_catalog_biblio_enhancements {
55 my ( $self, $args ) = @_;
56 return "Koha::Plugin::Test::intranet_catalog_biblio_enhancements";
59 sub opac_online_payment {
60 my ( $self, $args ) = @_;
61 return "Koha::Plugin::Test::opac_online_payment";
64 sub opac_online_payment_begin {
65 my ( $self, $args ) = @_;
66 return "Koha::Plugin::Test::opac_online_payment_begin";
69 sub opac_online_payment_end {
70 my ( $self, $args ) = @_;
71 return "Koha::Plugin::Test::opac_online_payment_end";
75 my ( $self, $args ) = @_;
76 return "Koha::Plugin::Test::opac_head";
80 my ( $self, $args ) = @_;
81 return "Koha::Plugin::Test::opac_js";
85 my ( $self, $args ) = @_;
86 return "Koha::Plugin::Test::intranet_head";
90 my ( $self, $args ) = @_;
91 return "Koha::Plugin::Test::intranet_js";
95 my ( $self, $args ) = @_;
96 return "Koha::Plugin::Test::configure";;
100 my ( $self, $args ) = @_;
101 return "Koha::Plugin::Test::install";
105 my ( $self, $args ) = @_;
106 return "Koha::Plugin::Test::upgrade";
110 my ( $self, $args ) = @_;
111 return "Koha::Plugin::Test::uninstall";
116 $self->output( '¡Hola output!', 'json' );
119 sub test_output_html {
121 $self->output_html( '¡Hola output_html!' );
128 sub after_biblio_action {
129 my ( $self, $params ) = @_;
130 my $action = $params->{action} // '';
131 my $biblio = $params->{biblio};
132 my $biblio_id = $params->{biblio_id};
134 if ( $action ne 'delete' ) {
135 Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action, ref: " . ref($biblio) );
138 Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action") if $biblio_id;
143 sub after_item_action {
144 my ( $self, $params ) = @_;
145 my $action = $params->{action} // '';
146 my $item = $params->{item};
147 my $item_id = $params->{item_id};
149 if ( $action ne 'delete' ) {
150 Koha::Exceptions::Exception->throw("after_item_action called with action: $action, ref: " . ref($item) );
153 Koha::Exceptions::Exception->throw("after_item_action called with action: $action" ) if $item_id;
158 my ( $self, $args ) = @_;
162 "/patrons/{patron_id}/bother": {
164 "x-mojo-to": "Koha::Plugin::Test#bother",
165 "operationId": "BotherPatron",
170 "description": "Internal patron identifier",
179 "description": "A bothered patron",
184 "description": "If the patron has been bothered",
191 "description": "An error occurred",
196 "description": "An explanation for the error",
203 "x-koha-authorization": {
213 return decode_json($spec);