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

(-)a/Koha/Plugin/Test_Newsletter.pm (-1 / +55 lines)
Line 0 Link Here
0
- 
1
package Koha::Plugin::Test_Newsletter;
2
3
#Implements patron_consent_type plugin.
4
5
use Modern::Perl;
6
use C4::Context;
7
8
use parent qw/Koha::Plugins::Base/;
9
10
use constant CONSENT_TYPE => 'NEWSLETTER';
11
12
our $VERSION  = 1.00;
13
our $metadata = { version => $VERSION };
14
15
my $consent_info = {
16
    title => {
17
        'en' => q|Newsletter|,
18
    },
19
    description => {
20
        'en' =>
21
            q|We would be happy to regularly send you a newsletter by email about our library services and activities.|,
22
    },
23
};
24
25
sub new {
26
    my ( $class, $params ) = @_;
27
    $params->{metadata} = $metadata;
28
    $params->{metadata}->{name} = $class;
29
    return $class->SUPER::new($params);
30
}
31
32
sub install {
33
    my ($self) = shift;
34
    C4::Context->dbh->do(
35
        "INSERT IGNORE INTO plugin_methods (plugin_class, plugin_method) VALUES (?,?)",
36
        undef,
37
        ref $self,
38
        'patron_consent_type'
39
    );
40
    return 1;
41
}
42
43
sub uninstall {
44
    my ($self) = @_;
45
    C4::Context->dbh->do( "DELETE FROM plugin_data WHERE plugin_class LIKE ?",    undef, ref $self );
46
    C4::Context->dbh->do( "DELETE FROM plugin_methods WHERE plugin_class LIKE ?", undef, ref $self );
47
    return 1;
48
}
49
50
sub patron_consent_type {
51
    my ($self) = @_;
52
    return [ CONSENT_TYPE, $consent_info ];
53
}
54
55
1;

Return to bug 31503