From: Moritz Bunkus Date: Tue, 28 Aug 2012 12:09:14 +0000 (+0200) Subject: BackgroundJob: next_run_at vor Speichern berechnen, falls nicht gesetzt X-Git-Tag: release-3.0.0beta1~269^2~2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=572adb38daf24b2a8adf0521e8f4920a7d1991ea;p=kivitendo-erp.git BackgroundJob: next_run_at vor Speichern berechnen, falls nicht gesetzt --- diff --git a/SL/DB/BackgroundJob.pm b/SL/DB/BackgroundJob.pm index 18f8e428f..ce1c3991d 100644 --- a/SL/DB/BackgroundJob.pm +++ b/SL/DB/BackgroundJob.pm @@ -13,6 +13,15 @@ use SL::DB::BackgroundJobHistory; use SL::BackgroundJob::Test; use SL::System::Process; +__PACKAGE__->before_save('_before_save_set_next_run_at'); + +sub _before_save_set_next_run_at { + my ($self) = @_; + + $self->update_next_run_at if !$self->next_run_at; + return 1; +} + sub update_next_run_at { my $self = shift;