make mode and enabled sticky in the Workflow

This commit is contained in:
Colin Kuskie 2008-11-24 16:33:51 +00:00
parent b6cfd088c7
commit e86b9a7a6f
3 changed files with 18 additions and 5 deletions

View file

@ -60,6 +60,7 @@
- fixed: DataForm times out when exporting large data sets
- fixed: DataForm entry data field is too small
- fixed #4213: Can see "edit" tab even tho i am not logged in
- fixed #9139: Updating a workflow property causes workflow to be disabled
7.6.3
- improved performance of file uploads

View file

@ -517,11 +517,11 @@ sub set {
$properties->{mode} = "singleton";
}
$self->{_data}{mode} = $properties->{mode} || "parallel";
$self->{_data}{enabled} = ($properties->{enabled} == 1) ? 1 : 0;
$self->{_data}{title} = $properties->{title} || $self->{_data}{title} || "Untitled";
$self->{_data}{mode} = $properties->{mode} || $self->{_data}{mode} || "parallel";
$self->{_data}{enabled} = exists $properties->{enabled} ? $properties->{enabled} : $self->{_data}{enabled};
$self->{_data}{title} = $properties->{title} || $self->{_data}{title} || "Untitled";
$self->{_data}{description} = (exists $properties->{description}) ? $properties->{description} : $self->{_data}{description};
$self->{_data}{type} = $properties->{type} || $self->{_data}{type} || "None";
$self->{_data}{type} = $properties->{type} || $self->{_data}{type} || "None";
$self->session->db->setRow("Workflow","workflowId",$self->{_data});
}

View file

@ -16,7 +16,7 @@ use WebGUI::Session;
use WebGUI::Workflow;
use WebGUI::Workflow::Cron;
use WebGUI::Utility qw/isIn/;
use Test::More tests => 64; # increment this value for each test you create
use Test::More tests => 67; # increment this value for each test you create
use Test::Deep;
my $session = WebGUI::Test->session;
@ -58,6 +58,14 @@ ok(!$wf->get('enabled'), 'workflow is disabled again');
is(scalar keys %{WebGUI::Workflow->getList($session, 'WebGUI::User')}, 1, 'There is only 1 WebGUI::User based workflow that ships with WebGUI');
##Throwing in another test here to test how enabled works. It should be sticky
$wf->set({enabled => 1});
ok($wf->get('enabled'), 'Enable workflow again');
$wf->set({description => 'Better stay enabled'});
ok($wf->get('enabled'), 'Workflow is enabled after setting the description');
$wf->set({enabled => 0});
##################################################
#
# Mode tests
@ -78,6 +86,10 @@ is(join('', $wf->isSingleton, $wf->isSerial, $wf->isParallel), '010', 'Is checks
$wf->set({'isSingleton' => 1});
is(join('', $wf->isSingleton, $wf->isSerial, $wf->isParallel), '100', 'Is checks after setting mode to singleton');
##Checking sticky mode settings
$wf->set({description => 'better stay singleton'});
ok($wf->isSingleton, 'After setting description, workflow is still singleton');
$wf->delete;
ok(!defined WebGUI::Workflow->new($session, $wfId), 'deleted workflow cannot be retrieved');