diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index bfb26b142..bce54b347 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,6 @@ 7.6.0 + - remove Do Nothing On Delete workflow and allow none to be selected for on delete etc workflow + - remove remnants of realtime workflow selection code 7.5.22 - fixed: Layout template now gets prepared correctly diff --git a/docs/upgrades/upgrade_7.5.21-7.6.0.pl b/docs/upgrades/upgrade_7.5.21-7.6.0.pl index cad4c79cf..1d9542c16 100644 --- a/docs/upgrades/upgrade_7.5.21-7.6.0.pl +++ b/docs/upgrades/upgrade_7.5.21-7.6.0.pl @@ -28,11 +28,32 @@ my $quiet; # this line required my $session = start(); # this line required -# upgrade functions go here +removeDoNothingOnDelete( $session ); finish($session); # this line required +#---------------------------------------------------------------------------- +sub removeDoNothingOnDelete { + my $session = shift; + print "\tRemoving 'Do Nothing On Delete workflow if not customized... " unless $quiet; + my $workflow = WebGUI::Workflow->new($session, 'DPWwf20061030000000001'); + if ($workflow) { + my $activities = $workflow->getActivities; + if (@$activities == 0) { + # safe to delete. + for my $setting (qw(trashWorkflow purgeWorkflow changeUrlWorkflow)) { + my $setValue = $session->setting->get($setting); + if ($setValue eq 'DPWwf20061030000000001') { + $session->setting->set($setting, undef); + } + } + $workflow->delete; + } + } + print "Done.\n" unless $quiet; +} + #---------------------------------------------------------------------------- # Describe what our function does #sub exampleFunction { diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm index 9ec58e2a3..ff4c540cc 100644 --- a/lib/WebGUI/Asset/Wobject/Thingy.pm +++ b/lib/WebGUI/Asset/Wobject/Thingy.pm @@ -1458,7 +1458,6 @@ sub www_editThing { -type=>"WebGUI::Asset::Wobject::Thingy", -label=>$i18n->get('on add workflow label'), -none=>1, - -includeRealtime=>1, -hoverHelp=>$i18n->get('on add workflow description'), ); @@ -1468,7 +1467,6 @@ sub www_editThing { -type=>"WebGUI::Asset::Wobject::Thingy", -label=>$i18n->get('on edit workflow label'), -none=>1, - -includeRealtime=>1, -hoverHelp=>$i18n->get('on edit workflow description'), ); @@ -1478,7 +1476,6 @@ sub www_editThing { -type=>"WebGUI::Asset::Wobject::Thingy", -label=>$i18n->get('on delete workflow label'), -none=>1, - -includeRealtime=>1, -hoverHelp=>$i18n->get('on delete workflow description'), ); diff --git a/lib/WebGUI/AssetTrash.pm b/lib/WebGUI/AssetTrash.pm index ecc15381b..abebc380b 100644 --- a/lib/WebGUI/AssetTrash.pm +++ b/lib/WebGUI/AssetTrash.pm @@ -247,11 +247,18 @@ sub _invokeWorkflowOnExportedFiles { my $workflowId = shift; my $clearExportedAs = shift; - my ($lastExportedAs) = $self->get("lastExportedAs"); - my $wfInstance = WebGUI::Workflow::Instance->create($self->session, { workflowId => $self->session->setting->get('trashWorkflow') }); - $wfInstance->setScratch(WebGUI::Workflow::Activity::DeleteExportedFiles::DELETE_FILES_SCRATCH(), Storable::freeze([defined($lastExportedAs)? ($lastExportedAs) : ()])); - $clearExportedAs and $self->session->db->write("UPDATE asset SET lastExportedAs = NULL WHERE assetId = ?", [$self->getId]); - $wfInstance->start(1); + if ($clearExportedAs) { + $self->session->db->write("UPDATE asset SET lastExportedAs = NULL WHERE assetId = ?", [$self->getId]); + } + if ($workflowId) { + my ($lastExportedAs) = $self->get("lastExportedAs"); + my $wfInstance = WebGUI::Workflow::Instance->create($self->session, { workflowId => $workflowId }); + $wfInstance->setScratch( + WebGUI::Workflow::Activity::DeleteExportedFiles::DELETE_FILES_SCRATCH() => + Storable::freeze([ defined($lastExportedAs) ? ($lastExportedAs) : () ]) + ); + $wfInstance->start(1); + } } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/Workflow.pm b/lib/WebGUI/Form/Workflow.pm index fa50987db..c07380dc9 100644 --- a/lib/WebGUI/Form/Workflow.pm +++ b/lib/WebGUI/Form/Workflow.pm @@ -75,11 +75,6 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t If set to 1 then a "None" option will appear in the list of workflows, which will store a null value in the field. Defaults to 0. -=head4 includeRealtime - -Most workflow triggers can't handle realtime workflows, so we leave out realtime workflows unless they should -specifically be included. - =cut sub definition { @@ -103,9 +98,6 @@ sub definition { noneLabel => { defaultValue => $i18n->get("form control none label"), }, - includeRealtime => { - defaultValue => 0 - }, }); return $class->SUPER::definition($session, $definition); } @@ -157,7 +149,7 @@ Renders a template picker control. sub toHtml { my $self = shift; - my $workflowList = WebGUI::Workflow->getList($self->session, $self->get("type"), $self->get("includeRealtime")); + my $workflowList = WebGUI::Workflow->getList($self->session, $self->get("type")); if ( $self->get("none") ) { my $noneLabel = $self->get("noneLabel"); diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm index d1f5b3319..68cd1496d 100644 --- a/lib/WebGUI/Operation/Settings.pm +++ b/lib/WebGUI/Operation/Settings.pm @@ -79,7 +79,6 @@ sub definition { type=>"WebGUI::VersionTag", label=>$i18n->get("default version tag workflow"), hoverHelp=>$i18n->get('default version tag workflow help'), - includeRealtime=>1, }); push(@fields, { tab=>"content", @@ -104,7 +103,8 @@ sub definition { defaultValue=>$setting->get("trashWorkflow"), type=>"None", label=>$i18n->get("trash workflow"), - hoverHelp=>$i18n->get('trash workflow help') + hoverHelp=>$i18n->get('trash workflow help'), + none => 1, }); push(@fields, { tab=>"content", @@ -113,7 +113,8 @@ sub definition { defaultValue=>$setting->get("purgeWorkflow"), type=>"None", label=>$i18n->get("purge workflow"), - hoverHelp=>$i18n->get('purge workflow help') + hoverHelp=>$i18n->get('purge workflow help'), + none => 1, }); push(@fields, { tab=>"content", @@ -122,7 +123,8 @@ sub definition { defaultValue=>$setting->get("changeUrlWorkflow"), type=>"None", label=>$i18n->get("changeUrl workflow"), - hoverHelp=>$i18n->get('changeUrl workflow help') + hoverHelp=>$i18n->get('changeUrl workflow help'), + none => 1, }); my %htmlFilter = ( diff --git a/lib/WebGUI/Operation/VersionTag.pm b/lib/WebGUI/Operation/VersionTag.pm index 7ccae568a..0c50b889f 100644 --- a/lib/WebGUI/Operation/VersionTag.pm +++ b/lib/WebGUI/Operation/VersionTag.pm @@ -235,7 +235,6 @@ sub www_editVersionTag { $f->workflow( value=>$workflowId, type=>"WebGUI::VersionTag", - includeRealtime=>1, ); $f->group( value=>[$groupId], diff --git a/lib/WebGUI/Workflow.pm b/lib/WebGUI/Workflow.pm index e1dc8c384..891ed99fd 100644 --- a/lib/WebGUI/Workflow.pm +++ b/lib/WebGUI/Workflow.pm @@ -282,7 +282,7 @@ sub getId { #------------------------------------------------------------------- -=head2 getList ( session, [ type, includeRealtime ] ) +=head2 getList ( session, [ type ] ) Returns a hash reference of workflowId/title pairs of all enabled workflows. This is a class method. @@ -294,26 +294,18 @@ A reference to the current session. If specified this will limit the list to a certain type of workflow based upon the object type that the workflow is set up to handle. -=head3 includeRealtime - -If set to 1 the list returned will include workflows with a mode of "realtime", otherwise it won't. - =cut sub getList { my $class = shift; my $session = shift; my $type = shift; - my $includeRealtime = shift; my $sql = "select workflowId, title from Workflow where enabled=1"; my @params; if ($type) { $sql .= " and type=?"; push(@params, $type); } - unless ($includeRealtime) { - $sql .= " and mode<>'realtime'"; - } return $session->db->buildHashRef($sql, \@params); }