Bugzilla – Attachment 157126 Details for
Bug 31503
Allow several consent types on the consents tab of OPAC account page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31503: DO NOT PUSH - Add example plugin
Bug-31503-DO-NOT-PUSH---Add-example-plugin.patch (text/plain), 2.29 KB, created by
Marcel de Rooy
on 2023-10-13 15:37:27 UTC
(
hide
)
Description:
Bug 31503: DO NOT PUSH - Add example plugin
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-10-13 15:37:27 UTC
Size:
2.29 KB
patch
obsolete
>From b1e75575b45a2f9d69889d08f84563905df2cf1b Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 30 Aug 2023 16:49:58 +0200 >Subject: [PATCH] Bug 31503: DO NOT PUSH - Add example plugin >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run perl -MKoha::Plugin::Test_Newsletter -e"Koha::Plugin::Test_Newsletter->new->install" >Enable OPACCustomConsentTypes. >Test consenting and refusing consent on OPAC account page. >Run perl -MKoha::Plugin::Test_Newsletter -e"Koha::Plugin::Test_Newsletter->new->uninstall" > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Plugin/Test_Newsletter.pm | 55 ++++++++++++++++++++++++++++++++++ > 1 file changed, 55 insertions(+) > create mode 100644 Koha/Plugin/Test_Newsletter.pm > >diff --git a/Koha/Plugin/Test_Newsletter.pm b/Koha/Plugin/Test_Newsletter.pm >new file mode 100644 >index 0000000000..5030660e14 >--- /dev/null >+++ b/Koha/Plugin/Test_Newsletter.pm >@@ -0,0 +1,55 @@ >+package Koha::Plugin::Test_Newsletter; >+ >+#Implements patron_consent_type plugin. >+ >+use Modern::Perl; >+use C4::Context; >+ >+use parent qw/Koha::Plugins::Base/; >+ >+use constant CONSENT_TYPE => 'NEWSLETTER'; >+ >+our $VERSION = 1.00; >+our $metadata = { version => $VERSION }; >+ >+my $consent_info = { >+ title => { >+ 'en' => q|Newsletter|, >+ }, >+ description => { >+ 'en' => >+ q|We would be happy to regularly send you a newsletter by email about our library services and activities.|, >+ }, >+}; >+ >+sub new { >+ my ( $class, $params ) = @_; >+ $params->{metadata} = $metadata; >+ $params->{metadata}->{name} = $class; >+ return $class->SUPER::new($params); >+} >+ >+sub install { >+ my ($self) = shift; >+ C4::Context->dbh->do( >+ "INSERT IGNORE INTO plugin_methods (plugin_class, plugin_method) VALUES (?,?)", >+ undef, >+ ref $self, >+ 'patron_consent_type' >+ ); >+ return 1; >+} >+ >+sub uninstall { >+ my ($self) = @_; >+ C4::Context->dbh->do( "DELETE FROM plugin_data WHERE plugin_class LIKE ?", undef, ref $self ); >+ C4::Context->dbh->do( "DELETE FROM plugin_methods WHERE plugin_class LIKE ?", undef, ref $self ); >+ return 1; >+} >+ >+sub patron_consent_type { >+ my ($self) = @_; >+ return [ CONSENT_TYPE, $consent_info ]; >+} >+ >+1; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31503
:
140047
|
140048
|
140049
|
140050
|
140080
|
140081
|
140082
|
140083
|
140084
|
140085
|
140087
|
140088
|
140089
|
140090
|
140666
|
140667
|
140668
|
140669
|
140670
|
140671
|
140672
|
141216
|
141217
|
141218
|
141219
|
141220
|
141221
|
141222
|
141263
|
141264
|
141265
|
141266
|
141267
|
141268
|
141269
|
141302
|
141570
|
155000
|
155001
|
155002
|
155003
|
155177
|
155178
|
155179
|
155180
|
155189
|
155190
|
155191
|
155656
|
155657
|
155658
|
155659
|
155660
|
155661
|
155691
|
155694
|
155783
|
155784
|
155785
|
155786
|
155787
|
155788
|
155789
|
155790
|
155791
|
157117
|
157118
|
157119
|
157120
|
157121
|
157122
|
157123
|
157124
|
157125
|
157126
|
157773
|
157774
|
157775
|
157776
|
157777
|
157778
|
157779
|
157780
|
157781
|
157782
|
157783