- Added a switch to allow the use of non-WebGUI objects with the Workflow

engine.
This commit is contained in:
JT Smith 2009-02-08 21:20:32 +00:00
parent d32137b5db
commit be42bb0856
3 changed files with 20 additions and 9 deletions

View file

@ -1,4 +1,6 @@
7.6.11 7.6.11
- Added a switch to allow the use of non-WebGUI objects with the Workflow
engine.
- fixed #9579: initialize keyword field because get fills it in now due to a recent code change - fixed #9579: initialize keyword field because get fills it in now due to a recent code change
- fixed #9596: caching now takes into account the correct parameter for pagination - fixed #9596: caching now takes into account the correct parameter for pagination
- fixed #9596: Articles now use a semi-unique pagination variable based on asset id - fixed #9596: Articles now use a semi-unique pagination variable based on asset id

View file

@ -34,19 +34,19 @@ hideGalleryAlbums($session);
removeBrokenWorkflowInstances($session); removeBrokenWorkflowInstances($session);
undotBinaryExtensions($session); undotBinaryExtensions($session);
removeProcessRecurringPaymentsFromConfig($session); removeProcessRecurringPaymentsFromConfig($session);
noSessionSwitch($session);
fixDottedAssetIds($session); ##This one should run last fixDottedAssetIds($session); ##This one should run last
finish($session); # this line required finish($session); # this line required
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Describe what our function does sub noSessionSwitch {
#sub exampleFunction { my $session = shift;
# my $session = shift; print "\tAdding noSession switch to Workflow Instances..." unless $quiet;
# print "\tWe're doing some stuff here that you should know about... " unless $quiet; $session->db->write("alter table WorkflowInstance add column noSession boolean not null default 0");
# # and here's our code print "DONE!\n" unless $quiet;
# print "DONE!\n" unless $quiet; }
#}
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
sub removeProcessRecurringPaymentsFromConfig { sub removeProcessRecurringPaymentsFromConfig {

View file

@ -343,11 +343,15 @@ sub run {
$self->session->errorHandler->info("Running workflow activity ".$activity->getId.", which is a ".(ref $activity).", for instance ".$self->getId."."); $self->session->errorHandler->info("Running workflow activity ".$activity->getId.", which is a ".(ref $activity).", for instance ".$self->getId.".");
my $class = $self->get("className"); my $class = $self->get("className");
my $method = $self->get("methodName"); my $method = $self->get("methodName");
my $params = $self->get("parameters");
my $status = ""; my $status = "";
my $object = undef; my $object = undef;
my @params;
unless ($self->get('noSession')) {
push @params, $self->session;
}
push @params, $self->get("parameters");
if ($class && $method) { if ($class && $method) {
$object = eval { WebGUI::Pluggable::instanciate($class, $method, [$self->session, $params]) }; $object = eval { WebGUI::Pluggable::instanciate($class, $method, \@params) };
if ($@) { if ($@) {
$self->session->errorHandler->error( $self->session->errorHandler->error(
q{Error on workflow instance '} . $self->getId . q{': }. $@ q{Error on workflow instance '} . $self->getId . q{': }. $@
@ -434,6 +438,10 @@ be constructed unless both className and methodName are true.
A hashref of parameters to be passed into the constructor for className. Note that the system will always pass in the session as the first argument. A hashref of parameters to be passed into the constructor for className. Note that the system will always pass in the session as the first argument.
=head4 noSession
Normally a reference to the session is the first property passed into methodName(), and then the parameters are passed in. If you're using an object that doesn't need/want a WebGUI::Session object then set noSession to 1. Defaults to 0.
=head4 currentActivityId =head4 currentActivityId
The unique id of the activity in the workflow that needs to be executed next. If blank, it will execute the first activity in the workflow. The unique id of the activity in the workflow that needs to be executed next. If blank, it will execute the first activity in the workflow.
@ -451,6 +459,7 @@ A boolean, that if set to 1 will not inform Spectre of the change in settings.
sub set { sub set {
my ($self, $properties, $skipNotify) = @_; my ($self, $properties, $skipNotify) = @_;
$self->{_data}{lastUpdate} = time(); $self->{_data}{lastUpdate} = time();
$self->{_data}{noSession} = (exists $properties->{noSession}) ? $properties->{noSession} : $self->{_data}{noSession};
$self->{_data}{priority} = $properties->{priority} || $self->{_data}{priority} || 2; $self->{_data}{priority} = $properties->{priority} || $self->{_data}{priority} || 2;
$self->{_data}{lastStatus} = $properties->{lastStatus} || $self->{_data}{lastStatus}; $self->{_data}{lastStatus} = $properties->{lastStatus} || $self->{_data}{lastStatus};
$self->{_data}{workflowId} = $properties->{workflowId} || $self->{_data}{workflowId}; $self->{_data}{workflowId} = $properties->{workflowId} || $self->{_data}{workflowId};