started adding new workflow based approval process

This commit is contained in:
JT Smith 2006-03-15 20:15:55 +00:00
parent 9ff3308126
commit eb6a7a9416
14 changed files with 676 additions and 89 deletions

View file

@ -81,6 +81,7 @@ Removes this instance.
sub delete {
my $self = shift;
$self->session->db->write("delete from WorkflowInstanceScratch where instanceId=?",[$self->getId]);
$self->session->db->deleteRow("WorkflowInstance","instanceId",$self->getId);
WebGUI::Workflow::Spectre->new($self->session)->notify("workflow/deleteJob",$self->getId);
undef $self;
@ -88,6 +89,25 @@ sub delete {
#-------------------------------------------------------------------
=head2 deleteScratch ( name )
Removes a scratch variable that's assigned to this instance.
=head3 name
The name of the variable to remove.
=cut
sub deleteScratch {
my $self = shift;
my $name = shift;
delete $self->{_scratch}{$name};
$self->session->db->write("delete from WorkflowInstanceScratch where instanceId=?", [$self->getId]);
}
#-------------------------------------------------------------------
=head2 DESTROY ( )
Deconstructor.
@ -116,6 +136,23 @@ sub get {
#-------------------------------------------------------------------
=head2 getScratch ( name )
Returns the value for a given scratch variable.
=cut
sub get {
my $self = shift;
my $name = shift;
unless (exists $self->{_scratch}) {
$self->{_scratch} = $self->session->db->buildHashRef("select name,value from WorkflowInstanceScratch where instanceId=?", [ $self->getId ]);
}
return $self->{_scratch}{$name};
}
#-------------------------------------------------------------------
=head2 getId ( )
Returns the ID of this instance.
@ -188,7 +225,7 @@ sub run {
return "error";
}
}
$activity->execute($object);
$activity->execute($object, $self);
}
@ -257,6 +294,30 @@ sub set {
$spectre->notify("workflow/addJob",$self->session->config->getFilename, $self->{_data});
}
#-------------------------------------------------------------------
=head2 setScratch (name, value)
Attaches a scratch variable to this workflow instance.
=head3 name
A scalar representing the name of the variable.
=head3 value
A scalar value to assign to the variable.
=cut
sub setScratch {
my $self = shift;
my $name = shift;
my $value = shift;
delete $self->{_scratch};
$self->session->write("replace into WorkflowInstanceScratch (instanceId, name, value) values (?,?,?)", [$self->getId, $name, $value]);
}
1;