diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 839ba5a11..0fef4518d 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -14,6 +14,7 @@ - refixed #10260: WebGUI::Asset::Wobject::Gallery.pm default search date misfunction - fixed #9953: Matrix 2.0 - Not enough tests - fixed #10121: Q and A template doesn't work with default Forum Rich Editor + - rfe #10423: Provide a way to access the instance of the thing that was added, modified, or deleted via workflow. (Eric Kennedy) 7.7.9 - fixed #10266: Public Profile overrides Able to be friend diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm index 27ed66a27..26bbaab53 100644 --- a/lib/WebGUI/Asset/Wobject/Thingy.pm +++ b/lib/WebGUI/Asset/Wobject/Thingy.pm @@ -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; }