From e4bbb4ac7a572396267be0397414e3a78cf76730 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 13 Aug 2021 09:07:25 -1000 Subject: [PATCH] v1.1 : add upgrade/install/unistall methods And move metadatas and VERSION for tools/koha/plugin.sh compatiblity --- Koha/Plugin/Com/BibLibre/AutoMarcDates.pm | 52 ++++++++++++++++++----- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/Koha/Plugin/Com/BibLibre/AutoMarcDates.pm b/Koha/Plugin/Com/BibLibre/AutoMarcDates.pm index 895cc84..139d95d 100644 --- a/Koha/Plugin/Com/BibLibre/AutoMarcDates.pm +++ b/Koha/Plugin/Com/BibLibre/AutoMarcDates.pm @@ -2,29 +2,59 @@ package Koha::Plugin::Com::BibLibre::AutoMarcDates; use Modern::Perl; -use POSIX qw(strftime); +use parent 'Koha::Plugins::Base'; +use POSIX qw(strftime); use C4::Context; -use parent 'Koha::Plugins::Base'; +our $VERSION = '1.1'; + +our $metadata = { + name => 'AutoMarcDates', + author => 'BibLibre', + description => 'Automatically set created/modified date in MARC (biblio and authority) upon creation/modification', + date_authored => '2021-04-21', + date_updated => '2021-08-13', + minimum_version => '18.11', + maximum_version => undef, + version => $VERSION, +}; sub new { my ($class, $args) = @_; - $args->{metadata} = { - name => 'AutoMarcDates', - version => '0.1.0', - author => 'BibLibre', - minimum_version => '18.11', - maximum_version => undef, - description => 'Automatically set created/modified date in MARC (biblio and authority) upon creation/modification', - }; + $args->{'metadata'} = $metadata; + $args->{'metadata'}->{'class'} = $class; + + my $self = $class->SUPER::new($args); + + return $self; +} - return $class->SUPER::new($args); +# Mandatory even if does nothing +sub install { + my ( $self, $args ) = @_; + + return 1; +} + +# Mandatory even if does nothing +sub upgrade { + my ( $self, $args ) = @_; + + return 1; +} + +# Mandatory even if does nothing +sub uninstall { + my ( $self, $args ) = @_; + + return 1; } sub configure { my ( $self, $args ) = @_; + my $cgi = $self->{'cgi'}; if ($cgi->request_method() eq 'POST') {