Skip to content

Commit

Permalink
Merge branch 'next' into epic/FOUR-18042
Browse files Browse the repository at this point in the history
  • Loading branch information
agustinbusso committed Sep 9, 2024
2 parents f3054bf + b40c8f8 commit cbc76bf
Show file tree
Hide file tree
Showing 16 changed files with 316 additions and 33 deletions.
5 changes: 4 additions & 1 deletion ProcessMaker/Events/ProcessCompleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public function __construct(ProcessRequest $processRequest)
{
$this->payloadUrl = route('api.requests.show', ['request' => $processRequest->getKey()]);
$this->processRequest = $processRequest;
$this->endEventDestination = $processRequest->getElementDestination();

if ($processRequest->process->asset_type !== 'GUIDED_HELPER_PROCESS') {
$this->endEventDestination = $processRequest->getElementDestination();
}
}

/**
Expand Down
14 changes: 12 additions & 2 deletions ProcessMaker/Events/RedirectToEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,18 @@ public function broadcastAs()
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('ProcessMaker.Models.ProcessRequest.' . $this->processRequest->getKey()),
$channels = [
// Current request
new PrivateChannel('ProcessMaker.Models.ProcessRequest.' . $this->processRequest->getKey())
];
// include child requests if any
foreach($this->processRequest->childRequests()->pluck('id') as $childRequestId) {
$channels[] = new PrivateChannel('ProcessMaker.Models.ProcessRequest.' . $childRequestId);
}
// include parent request if any
if ($this->processRequest->parent_request_id) {
$channels[] = new PrivateChannel('ProcessMaker.Models.ProcessRequest.' . $this->processRequest->parent_request_id);
}
return $channels;
}
}
2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/Api/ScreenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public function duplicate(Screen $screen, Request $request)
$request->validate(Screen::rules());
$newScreen = new Screen();

$exclude = ['id', 'uuid', 'created_at', 'updated_at'];
$exclude = ['id', 'uuid', 'created_at', 'updated_at', 'key'];
foreach ($screen->getAttributes() as $attribute => $value) {
if (!in_array($attribute, $exclude)) {
$newScreen->{$attribute} = $screen->{$attribute};
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/ImportExport/Exporters/ProcessExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public function importElementDestination(): void
// Set the new attribute value at the specified XPath
Utils::setAttributeAtXPath(
$this->model, $path, self::PM_ELEMENT_DESTINATION,
htmlspecialchars($newElementDestination, ENT_QUOTES)
$newElementDestination
);
}
}
Expand Down
5 changes: 5 additions & 0 deletions ProcessMaker/ImportExport/Exporters/ScreenExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public function import() : bool
$this->associateCategories(ScreenCategory::class, 'screen_category_id');
$screen->watchers = $watchers;

// There should only be one default interstitial screen
if ($screen->key === 'interstitial') {
$screen->key = null;
}

$success = $screen->saveOrFail();

return $success;
Expand Down
5 changes: 5 additions & 0 deletions ProcessMaker/Jobs/SyncGuidedTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use Log;
Expand Down Expand Up @@ -208,6 +209,10 @@ private function importProcess($payload, $assetType)
'Collections', 'DataConnector', 'ProcessTemplates'])) {
$payload['export'][$key]['attributes']['asset_type'] = $assetType;
}

if (Arr::get($asset, 'type') === 'Screen' && Arr::get($asset, 'attributes.key') === 'interstitial') {
Arr::set($payload, "export.{$key}.attributes.key", null);
}
}

$options = new Options($postOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class HandleActivityAssignedInterstitialRedirect extends HandleRedirectListener
{

/**
* Handle the event.
*/
Expand All @@ -23,14 +22,16 @@ public function handle(ActivityAssigned $event): void
} else {
$payloadUrl = route('requests.show', [
'request' => $event->getProcessRequestToken()
->getAttribute('process_request_id')
->getAttribute('process_request_id'),
]);
}
$this->setRedirectTo($request,
'redirectToTask',
[
'payloadUrl' => $payloadUrl,
'tokenId' => $event->getProcessRequestToken()->id,
'nodeId' => $event->getProcessRequestToken()->element_id,
'userId' => $event->getProcessRequestToken()->user_id,
'allowInterstitial' => $event->getProcessRequestToken()->getInterstitial()['allow_interstitial'],
]
);
Expand Down
6 changes: 5 additions & 1 deletion ProcessMaker/Listeners/HandleEndEventRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ public function handle(ProcessCompleted $event): void
if (empty($request)) {
return;
}
// Do not redirect to child request summary if there is a previous redirect
if ($request->parent_request_id && self::$redirectionMethod !== '') {
return;
}

$userId = Auth::id();
$requestId = $event->getProcessRequest()->id;
$requestId = $request->id;
$this->setRedirectTo($request, 'processCompletedRedirect', $event, $userId, $requestId);
}
}
2 changes: 1 addition & 1 deletion ProcessMaker/Listeners/HandleRedirectListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class HandleRedirectListener
{
private static $processRequest = null;

private static $redirectionMethod = '';
protected static $redirectionMethod = '';

private static $redirectionParams = [];

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "processmaker/processmaker",
"version": "4.11.0-RC1",
"version": "4.11.1",
"description": "BPM PHP Software",
"keywords": [
"php bpm processmaker"
Expand Down Expand Up @@ -104,7 +104,7 @@
"Gmail"
],
"processmaker": {
"build": "bb755bdb",
"build": "e0f2413d",
"custom": {
"package-ellucian-ethos": "1.16.0",
"package-plaid": "1.6.0",
Expand Down Expand Up @@ -146,7 +146,7 @@
"package-ab-testing": "1.3.0",
"package-actions-by-email": "1.19.0",
"package-advanced-user-manager": "1.11.0",
"package-ai": "1.11.0",
"package-ai": "1.11.1",
"package-analytics-reporting": "1.9.0",
"package-auth": "1.21.0",
"package-cdata": "1.4.5",
Expand All @@ -173,7 +173,7 @@
"package-translations": "2.11.0",
"package-versions": "1.12.0",
"package-vocabularies": "2.16.0",
"package-webentry": "2.23.0",
"package-webentry": "2.24.0",
"package-api-testing": "1.0.1",
"packages": "^0"
},
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ export default {
}
ProcessMaker.apiClient
.get("screens", { params: { key: this.defaultKey } })
.get("screens", { params: {
key: this.defaultKey,
order_by: "id",
order_direction: "ASC",
per_page: 1,
}})
.then(({ data }) => {
this.content = data.data[0];
});
Expand Down
Loading

0 comments on commit cbc76bf

Please sign in to comment.