1 package Koha
::Authority
::MergeRequests
;
3 # Copyright Rijksmuseum 2017
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 use Koha
::Authority
::MergeRequest
;
29 use parent
qw(Koha::Objects);
33 Koha::Authority::MergeRequests - Koha::Objects class for need_merge_authorities
37 use Koha::Authority::MergeRequests;
49 Koha::Authority::MergeRequests->cron_cleanup({
50 reset_hours => 24, remove_days => 90,
53 Removes all entries with status "done" older than remove_days.
54 Set all entries with status "in progress" back to 0 when the timestamp
55 is older than reset_hours.
56 Defaults: reset_hours = 1, remove_days = 30.
61 my ( $class_or_self, $params ) = @_;
62 my $reset_hours = $params->{reset_hours
} || 1;
63 my $remove_days = $params->{remove_days
} || 30;
64 my $parser = Koha
::Database
->new->schema->storage->datetime_parser;
66 my $dt = dt_from_string
;
67 $dt->subtract( hours
=> $reset_hours );
68 $class_or_self->search({
70 timestamp
=> { '<' => $parser->format_datetime($dt) },
71 })->update({ done
=> 0 });
74 $dt->subtract( days
=> $remove_days );
75 $class_or_self->search({
77 timestamp
=> { '<' => $parser->format_datetime($dt) },
83 Returns name of corresponding DBIC resultset
88 return 'NeedMergeAuthority';
93 Returns name of corresponding Koha object class
98 return 'Koha::Authority::MergeRequest';
103 Marcel de Rooy (Rijksmuseum)
105 Koha Development Team