Add patch to let Thingy workflows know which Thing they are working on.

This commit is contained in:
Colin Kuskie 2009-08-09 23:03:33 +00:00
parent 2cc10d2953
commit d17399df41
2 changed files with 14 additions and 8 deletions

View file

@ -38,6 +38,7 @@
- fixed #10689: Version Tag Modes (Henry Tang, Long Term Results B.V.)
- fixed #10733: viewing pending version tags
- added Survey JSON performance warning for people with non-wre-standard JSON modules/versions (Patrick Donelan, SDH Consulting)
- rfe #10423: Provide a way to access the instance of the thing that was added, modified, or deleted via workflow. (Eric Kennedy)
7.7.16
- fixed #10590: Session::DateTime->secondsToInterval doesn't allow 7 weeks

View file

@ -473,14 +473,14 @@ sub deleteThingData {
return undef unless $self->canEditThingData($thingId, $thingDataId);;
$self->deleteCollateral("Thingy_".$thingId,"thingDataId",$thingDataId);
my ($onDeleteWorkflowId) = $db->quickArray("select onDeleteWorkflowId from Thingy_things where thingId=?"
,[$thingId]);
if ($onDeleteWorkflowId){
$self->triggerWorkflow($onDeleteWorkflowId);
$self->triggerWorkflow($onDeleteWorkflowId, $thingId,$thingDataId);
}
$self->deleteCollateral("Thingy_".$thingId,"thingDataId",$thingDataId);
return undef;
}
@ -598,13 +598,13 @@ sub editThingDataSave {
my ($onAddWorkflowId) = $session->db->quickArray("select onAddWorkflowId from Thingy_things where thingId=?"
,[$thingId]);
if ($onAddWorkflowId){
$self->triggerWorkflow($onAddWorkflowId);
$self->triggerWorkflow($onAddWorkflowId,$thingId,$newThingDataId);
}
}else{
my ($onEditWorkflowId) = $session->db->quickArray("select onEditWorkflowId from Thingy_things where thingId=?"
,[$thingId]);
if ($onEditWorkflowId){
$self->triggerWorkflow($onEditWorkflowId);
$self->triggerWorkflow($onEditWorkflowId,$thingId,$newThingDataId);
}
}
@ -1390,7 +1390,7 @@ sub purge {
#-------------------------------------------------------------------
=head2 triggerWorkflow ( workflowId )
=head2 triggerWorkflow ( workflowId, thingId, thingDataId )
Runs the specified workflow when this Thingy changes.
@ -1404,12 +1404,17 @@ sub triggerWorkflow {
my $self = shift;
my $workflowId = shift;
WebGUI::Workflow::Instance->create($self->session, {
my $thingId = shift ;
my $thingDataId = shift ;
my $workflowInstance = WebGUI::Workflow::Instance->create($self->session, {
workflowId=>$workflowId,
className=>"WebGUI::Asset::Wobject::Thingy",
methodName=>"new",
parameters=>$self->getId
})->start;
});
$workflowInstance->setScratch("thingId", $thingId);
$workflowInstance->setScratch("thingDataId",$thingDataId);
$workflowInstance->start;
return undef;
}