Skip to content

Commit

Permalink
Workflow 2.0 (#8138)
Browse files Browse the repository at this point in the history
* Make LedgerSMB Workflow 2.0 compatible

* List Workflow::Condition dependency
  • Loading branch information
ehuelsmann committed Apr 10, 2024
1 parent 38c86dc commit f751e00
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ requires 'Text::Markdown';
requires 'URI';
requires 'URI::Escape';
requires 'Workflow', '1.59';
requires 'Workflow::Condition', '1.59';
requires 'Workflow::Context', '1.59';
requires 'Workflow::Exception', '1.59';
requires 'Workflow::Factory', '1.59';
Expand Down
2 changes: 1 addition & 1 deletion lib/LedgerSMB/Workflow/Condition/ACL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use parent qw( Workflow::Condition );
use LedgerSMB::Setting;

use Log::Any qw($log);
use Workflow::Exception qw( configuration_error condition_error );
use Workflow::Exception qw( configuration_error );


=head2 init
Expand Down
4 changes: 1 addition & 3 deletions lib/LedgerSMB/Workflow/Condition/PeriodClosed.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ use parent qw( Workflow::Condition );
use LedgerSMB::Setting;

use Log::Any qw($log);
use Workflow::Exception qw( condition_error );

my @PROPS = qw( offset workflow_parameter );
__PACKAGE__->mk_accessors(@PROPS);
Expand Down Expand Up @@ -97,8 +96,7 @@ sub evaluate {
die $dbh->errstr if $dbh->err;
}

condition_error 'Period open' if $opened;
return 1;
return not $opened;
}


Expand Down
5 changes: 1 addition & 4 deletions lib/LedgerSMB/Workflow/Condition/SeparateDuties.pm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use parent qw( Workflow::Condition );
use LedgerSMB::Setting;

use Log::Any qw($log);
use Workflow::Exception qw( condition_error );


=head2 evaluate( $wf )
Expand All @@ -47,10 +46,8 @@ sub evaluate {

my $separate_duties = LedgerSMB::Setting->new(dbh => $dbh)->get('separate_duties');
$log->info("separate duties: $separate_duties");
condition_error 'Separation of Duties disabled'
if not $separate_duties;

return 1;
return $separate_duties;
}


Expand Down
3 changes: 3 additions & 0 deletions lib/LedgerSMB/Workflow/Loader.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ our $VERSION = '0.0.1';
use File::Find::Rule;
use File::Spec;
use Workflow::Factory;
use Workflow::Condition;

$Workflow::Condition::STRICT_BOOLEANS = 0;

=head1 CLASS METHODS
Expand Down

0 comments on commit f751e00

Please sign in to comment.