From: Moritz Bunkus Date: Tue, 3 Jun 2014 15:10:44 +0000 (+0200) Subject: RDBO BackgroundJob(History): Refactoring von Status-Strings X-Git-Tag: release-3.2.0beta~424 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=8e1151555c7383bdd4e9baca68e6fa29b48cbd29;p=kivitendo-erp.git RDBO BackgroundJob(History): Refactoring von Status-Strings --- diff --git a/SL/DB/BackgroundJob.pm b/SL/DB/BackgroundJob.pm index e8ae55bac..b567d364e 100644 --- a/SL/DB/BackgroundJob.pm +++ b/SL/DB/BackgroundJob.pm @@ -45,7 +45,7 @@ sub run { $history = SL::DB::BackgroundJobHistory ->new(package_name => $self->package_name, run_at => $run_at, - status => 'success', + status => SL::DB::BackgroundJobHistory::SUCCESS(), result => $result, data => $self->data); $history->save; @@ -58,7 +58,7 @@ sub run { $history = SL::DB::BackgroundJobHistory ->new(package_name => $self->package_name, run_at => $run_at, - status => 'failure', + status => SL::DB::BackgroundJobHistory::FAILURE(), error_col => $error, data => $self->data); $history->save; diff --git a/SL/DB/BackgroundJobHistory.pm b/SL/DB/BackgroundJobHistory.pm index 145548039..84b2cb771 100644 --- a/SL/DB/BackgroundJobHistory.pm +++ b/SL/DB/BackgroundJobHistory.pm @@ -1,6 +1,3 @@ -# This file has been auto-generated only because it didn't exist. -# Feel free to modify it at will; it will not be overwritten automatically. - package SL::DB::BackgroundJobHistory; use strict; @@ -10,4 +7,10 @@ use SL::DB::Manager::BackgroundJobHistory; __PACKAGE__->meta->initialize; +use constant SUCCESS => 'success'; +use constant FAILURE => 'failure'; + +sub has_succeeded { $_[0] && (($_[0]->status || '') eq SUCCESS()) } +sub has_failed { $_[0] && (($_[0]->status || '') eq FAILURE()) } + 1;