Forward port of Workflow Activity sequencing bug. create uses count, but
delete did not reorder the existing activities. This would allow duplicate sequenceNumbers in the db. The upgrade script will resequence and fix all activities in all workflows.
This commit is contained in:
parent
67b92500cc
commit
07582c34d6
3 changed files with 25 additions and 2 deletions
|
|
@ -52,6 +52,8 @@
|
|||
- fix: Fixed a typo in the Article with attachments template (perlDreamer Consulting, LLC)
|
||||
- fix: Uploaded File Sizes Wrong (perlDreamer Consulting, LLC)
|
||||
http://www.webgui.org/bugs/tracker/uploaded-file-sizes-wrong#8ao9yNQrxFyJNTUaU7ARPA
|
||||
- fix: Activity Sequence Numbers Incorrect when Editing Workflows (perlDreamer Consulting, LLC)
|
||||
http://www.webgui.org/bugs/tracker/activity-sequence-numbers-incorrect-when-editing-workflows#YRH7TYSWFkEUSPVDNN6zKQ
|
||||
|
||||
|
||||
7.3.18
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use strict;
|
|||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Workflow;
|
||||
|
||||
|
||||
my $toVersion = "7.3.19"; # make this match what version you're going to
|
||||
|
|
@ -23,6 +24,7 @@ my $session = start(); # this line required
|
|||
|
||||
# upgrade functions go here
|
||||
fixAssetSizes($session);
|
||||
resequenceWorkflowActivities($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -35,9 +37,25 @@ sub fixAssetSizes {
|
|||
foreach my $fileAsset ( @{ $root->getLineage(["self","descendants"],{returnObjects=>1,includeOnlyClasses=>['WebGUI::Asset::File','WebGUI::Asset::Image']}) } ) {
|
||||
$fileAsset->setSize();
|
||||
}
|
||||
# and here's our code
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub resequenceWorkflowActivities {
|
||||
my $session = shift;
|
||||
print "\tFix sequencing problems in Workflow Activities. This will take a while.\n" unless ($quiet);
|
||||
my $workflows = WebGUI::Workflow->getList($session);
|
||||
use Data::Dumper;
|
||||
$session->errorHandler->warn(Dumper $workflows);
|
||||
my ($workflowId, $title);
|
||||
while ( ($workflowId, $title) = each %{ $workflows } ) {
|
||||
$session->errorHandler->warn($workflowId . ':' . $title);
|
||||
my $workflow = WebGUI::Workflow->new($session, $workflowId);
|
||||
next unless defined $workflow;
|
||||
$workflow->reorderActivities;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE ----
|
||||
|
|
|
|||
|
|
@ -133,7 +133,10 @@ sub deleteActivity {
|
|||
my $self = shift;
|
||||
my $activityId = shift;
|
||||
my $activity = $self->getActivity($activityId);
|
||||
$activity->delete if ($activity);
|
||||
if ($activity) {
|
||||
$activity->delete;
|
||||
$self->reorderActivities;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue