From 4e91f3d500e8dc975fe4466c32c5c78ed893adbc Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 17 Nov 2008 02:51:41 +0000 Subject: [PATCH] Trap trying to instance bad workflow activities. Remove the ProcessRecurringPayments activity from the user's config. --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.6.3-7.6.4.pl | 18 ++++++++++++++++++ lib/WebGUI/Operation/Workflow.pm | 7 ++++++- lib/WebGUI/i18n/English/Workflow.pm | 6 ++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 3b7f18718..5c64c9bd8 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -19,6 +19,7 @@ - fixed #8971: UserList shows accounts that have been self-deactivated (Bernd Kalbfuß-Zimmermann) - fixed #4199: Default values of user profile fields are not filled in correctly when shown by the UserList asset (Bernd Kalbfuß-Zimmerman) - fixed #9068: field.inTab + - fixed #8845: Workflows refusing to show edit screen 7.6.3 - improved performance of file uploads diff --git a/docs/upgrades/upgrade_7.6.3-7.6.4.pl b/docs/upgrades/upgrade_7.6.3-7.6.4.pl index 5be142581..f15a4f1a0 100644 --- a/docs/upgrades/upgrade_7.6.3-7.6.4.pl +++ b/docs/upgrades/upgrade_7.6.3-7.6.4.pl @@ -36,6 +36,7 @@ addVersionTagMode($session); addPosMode($session); fixFriendsGroups( $session ); upgradeAccount( $session ); +removeProcessRecurringPaymentsFromConfig( $session ); finish($session); # this line required @@ -58,6 +59,23 @@ sub addPosMode { print qq{Finished\n} if !$quiet; } +#---------------------------------------------------------------------------- +sub removeProcessRecurringPaymentsFromConfig { + my $session = shift; + + print qq{\tRemoving old ProcessRecurringPayments workflow activity from config...} if !$quiet; + + my $config = $session->config(); + my $workflowActivities = $config->get('workflowActivities'); + my @noObjects = (); + foreach my $activity (@{ $workflowActivities->{'None'}}) { + push @noObjects, $activity unless + $activity eq 'WebGUI::Workflow::Activity::ProcessRecurringPayments'; + } + $workflowActivities->{'None'} = [ @noObjects ]; + $config->set('workflowActivities', $workflowActivities); +} + #---------------------------------------------------------------------------- # This method add support for versionTagMode # diff --git a/lib/WebGUI/Operation/Workflow.pm b/lib/WebGUI/Operation/Workflow.pm index 197376dd7..73337283d 100644 --- a/lib/WebGUI/Operation/Workflow.pm +++ b/lib/WebGUI/Operation/Workflow.pm @@ -217,7 +217,12 @@ sub www_editWorkflow { foreach my $class (@{$workflowActivities->{$workflow->get("type")}}) { my $activity = WebGUI::Workflow::Activity->newByPropertyHashRef($session, {className=>$class}); next unless defined $activity; - $addmenu .= 'getId).'">'.$activity->getName."
\n"; + if ($activity->can('getName')) { + $addmenu .= 'getId).'">'.$activity->getName."
\n"; + } + else { + $addmenu .= sprintf $i18n->get('bad workflow activity code'), $class; + } } $addmenu .= ''; my $f = WebGUI::HTMLForm->new($session); diff --git a/lib/WebGUI/i18n/English/Workflow.pm b/lib/WebGUI/i18n/English/Workflow.pm index 1750ac620..57e7e544e 100644 --- a/lib/WebGUI/i18n/English/Workflow.pm +++ b/lib/WebGUI/i18n/English/Workflow.pm @@ -262,6 +262,12 @@ our $I18N = { lastUpdated => 0, }, + 'bad workflow activity code' => { + message => q|Syntax error found in %s, unable to edit this activity.|, + context => q|Error message in the edit workflow screen, when an activity cannot be instanciated.|, + lastUpdated => 1226814463, + }, + }; 1;