Skip to content

Commit c89b08d

Browse files
committed
FOUR-15859: On Process End - Start a request for another selected process
1 parent 0d8262a commit c89b08d

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

ProcessMaker/Models/ProcessRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,9 @@ public function getProcessVersionAlternativeAttribute(): string | null
10571057
/**
10581058
* Retrieves the destination of the first closed end event.
10591059
*
1060-
* @return ?string Returns a string value representing the element destination of the first closed end event.
1060+
* @return ?array Returns a string value representing the element destination of the first closed end event.
10611061
*/
1062-
public function getElementDestination(): ?string
1062+
public function getElementDestination(): ?array
10631063
{
10641064
$endEvents = $this->tokens()
10651065
->where('element_type', 'end_event')

ProcessMaker/Models/ProcessRequestToken.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class ProcessRequestToken extends ProcessMakerModel implements TokenInterface
136136
*/
137137
protected $appends = [
138138
'advanceStatus',
139-
'elementDestination'
139+
'elementDestination',
140140
];
141141

142142
/**
@@ -1196,13 +1196,14 @@ public function reassign($toUserId, User $requestingUser)
11961196
* @param elementDestinationType Used to determine the type of destination for an element.
11971197
* @param elementDestinationProp Used to determine the properties of the destination for an element.
11981198
*
1199-
* @return string|null Returns the destination URL.
1199+
* @return array|null Returns the destination URL.
12001200
*/
1201-
private function getElementDestination($elementDestinationType, $elementDestinationProp): ?string
1201+
private function getElementDestination($elementDestinationType, $elementDestinationProp): ?array
12021202
{
12031203
$elementDestination = null;
12041204

12051205
switch ($elementDestinationType) {
1206+
case 'anotherProcess':
12061207
case 'customDashboard':
12071208
case 'externalURL':
12081209
if (array_key_exists('value', $elementDestinationProp)) {
@@ -1227,7 +1228,7 @@ private function getElementDestination($elementDestinationType, $elementDestinat
12271228
case 'processLaunchpad':
12281229
$elementDestination = route('process.browser.index', [
12291230
'process' => $this->process_id,
1230-
'categorySelected' => -1
1231+
'categorySelected' => -1,
12311232
]);
12321233
break;
12331234
case 'taskSource':
@@ -1236,18 +1237,20 @@ private function getElementDestination($elementDestinationType, $elementDestinat
12361237
default:
12371238
$elementDestination = null;
12381239
break;
1239-
12401240
}
12411241

1242-
return $elementDestination;
1242+
return [
1243+
'type' => $elementDestinationType,
1244+
'value' => $elementDestination,
1245+
];
12431246
}
12441247

12451248
/**
12461249
* Determines the destination URL based on the element destination type specified in the definition.
12471250
*
1248-
* @return string|null
1251+
* @return array|null
12491252
*/
1250-
public function getElementDestinationAttribute(): ?string
1253+
public function getElementDestinationAttribute(): ?array
12511254
{
12521255
$definition = $this->getDefinition();
12531256
$elementDestinationProp = $definition['elementDestination'] ?? null;

0 commit comments

Comments
 (0)