remove Do Nothing On Delete workflow and allow none to be selected for on delete etc workflow
remove remnants of realtime workflow selection code
This commit is contained in:
parent
5fc629993a
commit
778a32df19
8 changed files with 44 additions and 32 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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 = (
|
||||
|
|
|
|||
|
|
@ -235,7 +235,6 @@ sub www_editVersionTag {
|
|||
$f->workflow(
|
||||
value=>$workflowId,
|
||||
type=>"WebGUI::VersionTag",
|
||||
includeRealtime=>1,
|
||||
);
|
||||
$f->group(
|
||||
value=>[$groupId],
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue