Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Database\QueryException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\QueryException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
Expand Down
20 changes: 13 additions & 7 deletions ProcessMaker/ImportExport/Exporters/ExporterBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,14 @@ protected function duplicateExists($attribute, $value) : bool
public function handleDuplicateAttributes() : array
{
$handlers = [];
foreach ($this->handleDuplicatesByIncrementing as $attr) {
$handlers[$attr] = fn ($name) => $this->incrementString($name);
foreach ($this->handleDuplicatesByIncrementing as $index => $attr) {
if (is_array($this->incrementStringSeparator)) {
$seperator = $this->incrementStringSeparator[$index];
$handlers[$attr] = fn ($name) => $this->incrementString($name, $seperator);
} else {
$seperator = $this->incrementStringSeparator;
$handlers[$attr] = fn ($name) => $this->incrementString($name, $seperator);
}
}

return $handlers;
Expand All @@ -433,20 +439,20 @@ public function log($key, $value)
$this->log[$key] = $value;
}

protected function incrementString(string $string)
protected function incrementString(string $string, $seperator = ' ')
{
if (preg_match('/' . $this->incrementStringSeparator . '(\d+)$/', $string, $matches)) {
if (preg_match('/' . $seperator . '(\d+)$/', $string, $matches)) {
$num = (int) $matches[1];
$new = $num + 1;

return preg_replace(
'/' . $this->incrementStringSeparator . '\d+$/',
$this->incrementStringSeparator . (string) $new,
'/' . $seperator . '\d+$/',
$seperator . (string) $new,
$string
);
}

return $string . $this->incrementStringSeparator . '2';
return $string . $seperator . '2';
}

protected function exportCategories()
Expand Down
3 changes: 2 additions & 1 deletion ProcessMaker/Models/EnvironmentVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public function getValueAttribute()
try {
return decrypt($this->attributes['value']);
} catch (\Exception $e) {
Log::error('EnvironmentVariable: ' . $this->attributes['value']. "\n" . $e->getMessage());
Log::error('EnvironmentVariable: ' . $this->attributes['value'] . "\n" . $e->getMessage());
Log::error($e->getTraceAsString());

return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Nayra/Managers/WorkflowManagerDefault.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function throwSignalEventRequest(ProcessRequest $request, $signalRef, arr
$signalRef
);
}

/**
* Catch a signal event.
*
Expand Down
6 changes: 5 additions & 1 deletion ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
use ProcessMaker\Managers\DataManager;
use ProcessMaker\Managers\SignalManager;
use ProcessMaker\Models\EnvironmentVariable;
use ProcessMaker\Models\Process as Definitions;
use ProcessMaker\Models\Process;
use ProcessMaker\Models\Process as Definitions;
use ProcessMaker\Models\ProcessCollaboration;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Models\Script;
Expand All @@ -30,13 +30,17 @@
class WorkflowManagerRabbitMq extends WorkflowManagerDefault implements WorkflowManagerInterface
{
const ACTION_START_PROCESS = 'START_PROCESS';

const ACTION_COMPLETE_TASK = 'COMPLETE_TASK';

const ACTION_TRIGGER_INTERMEDIATE_EVENT = 'TRIGGER_INTERMEDIATE_EVENT';

const ACTION_RUN_SCRIPT = 'RUN_SCRIPT';

const ACTION_TRIGGER_BOUNDARY_EVENT = 'TRIGGER_BOUNDARY_EVENT';

const ACTION_TRIGGER_MESSAGE_EVENT = 'TRIGGER_MESSAGE_EVENT';

const ACTION_TRIGGER_SIGNAL_EVENT = 'TRIGGER_SIGNAL_EVENT';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
trait PersistenceRequestTrait
{
protected ExecutionInstanceRepository $instanceRepository;

protected Deserializer $deserializer;

/**
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/SanitizeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private static function getRichTextElements($items, $parent = null)
$elements = array_merge($elements, self::getRichTextElements($item['items'], ($parent ? $parent . '.' . $item['config']['name'] : $item['config']['name'])));
} elseif (isset($item['component']) && $item['component'] === 'FormTextArea' && isset($item['config']['richtext']) && $item['config']['richtext'] === true) {
$elements[] = ($parent ? $parent . '.' . $item['config']['name'] : $item['config']['name']);
// Inside a table ..
// Inside a table ..
} elseif ($item['component'] == 'FormMultiColumn') {
foreach ($item['items'] as $cell) {
if (
Expand Down
6 changes: 5 additions & 1 deletion ProcessMaker/Traits/HideSystemResources.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ public function scopeNonSystem($query)
} elseif (static::class === Screen::class) {
$systemCategory = ScreenCategory::where('is_system', true)->pluck('id');

return $query->whereNotIn('screen_category_id', $systemCategory)->where('is_template', false);
return $query->whereNotIn('screen_category_id', $systemCategory)
->where('is_template', false)
->when(Schema::hasColumn('screens', 'asset_type'), function ($query) {
return $query->whereNull('asset_type');
});
} elseif (static::class == ProcessRequest::class) {
// ProcessRequests must be filtered this way since
// they could be in a separate database
Expand Down
5 changes: 3 additions & 2 deletions ProcessMaker/Traits/ProcessMapTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private function getCompletedSequenceFlow(SimpleXMLElement $xml, string $complet
{
$inProgressAndCompletedNodes = $completedNodesStr . ' ' . $inProgressNodesStr;
$query = '//bpmn:sequenceFlow[contains("' . $completedNodesStr . '", @sourceRef) and contains("' . $inProgressAndCompletedNodes . '", @targetRef)]/@id';
$query = $query. ' | //bpmn:sequenceFlow[contains("' . $completedInProgressNode . '", @sourceRef) and contains("' . $inProgressAndCompletedNodes . '", @targetRef)]/@id';
$query = $query . ' | //bpmn:sequenceFlow[contains("' . $completedInProgressNode . '", @sourceRef) and contains("' . $inProgressAndCompletedNodes . '", @targetRef)]/@id';

return $this->filterXML($xml, $query);
}
Expand All @@ -98,10 +98,11 @@ private function getRefNodes(SimpleXMLElement $xml, string $sequenceFlowId): Col
'sourceRef' => (string) $sequenceFlowNode[0]['sourceRef'],
]);
}

/**
* Validates if the sourceRef token is in progress when the repeat count is the same as the targetRef
*/
private function getCountFlag(int $sourceCount, int $targetCount,string $sourceRef, ProcessRequest $request) :bool
private function getCountFlag(int $sourceCount, int $targetCount, string $sourceRef, ProcessRequest $request) :bool
{
$maxToken = $request->tokens()->find($this->getMaxTokenId($request, $sourceRef));

Expand Down
2 changes: 1 addition & 1 deletion config/rabbitmq.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$_port = env('RABBITMQ_PORT', 5672);
if (preg_match('/\d+$/', $_port, $_match)) {
$_port = intval($_match[0]) ?: 5672;
$_port = intval($_match[0]) ?: 5672;
}

return [
Expand Down
6 changes: 3 additions & 3 deletions resources/js/components/pm-blocks/CreatePmBlockModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
:description="formDescription('Choose an icon for this PM Block.', 'icon', errors)"
>
<icon-selector
v-model="meta.icon"
v-model="meta"
name="icon"
@error="fileError"
@input="clearFileError"
Expand Down Expand Up @@ -210,7 +210,7 @@ export default {
},
savePmBlock() {
let formData = new FormData();
formData.append("editing_process_id", this.assetId);
formData.append("asset_id", this.assetId);
formData.append("name", this.name);
formData.append("description", this.description);
formData.append("user_id", this.currentUserId);
Expand All @@ -221,7 +221,7 @@ export default {
ProcessMaker.alert(this.$t("PM Block successfully created"), "success");
window.setTimeout(() => {
window.location.href = `/designer/pm-blocks/${response.data.id}/edit/`;
}, 3000)
}, 1000)
this.close();
}).catch(error => {
this.errors = error.response?.data;
Expand Down
2 changes: 2 additions & 0 deletions resources/js/components/shared/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ColumnConfig from "./ColumnConfig";
import DataFormatSelector from "./DataFormatSelector";
import DataLoadingBasic from "./DataLoadingBasic";
import DataMaskSelector from "./DataMaskSelector";
import DraggableFileUpload from "./DraggableFileUpload";
import EllipsisMenu from "./EllipsisMenu";
import FileUploadButton from "./FileUploadButton";
import FormErrorsMixin from "./FormErrorsMixin";
Expand All @@ -30,6 +31,7 @@ export {
DataFormatSelector,
DataLoadingBasic,
DataMaskSelector,
DraggableFileUpload,
EllipsisMenu,
FileUploadButton,
FormErrorsMixin,
Expand Down
8 changes: 3 additions & 5 deletions tests/Feature/Api/ProcessRequestsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ public function testGetProcessRequestListAndPermissions()
$this->assertEquals(20, $response->json()['meta']['total']);
}


public function testGetRequestToken()
{
$expectedResponse = [
Expand Down Expand Up @@ -865,7 +864,7 @@ public function testGetRequestToken()
$token = ProcessRequestToken::factory()->create([
'process_request_id' => $request->id,
'user_id' => $this->user,
]);
]);

// Validate the status is correct
$response = $this->apiCall('GET', self::API_TEST_URL . '/' . $request->id . '/tokens?element_id=' . $token->element_id);
Expand All @@ -878,20 +877,19 @@ public function testGetRequestToken()
$nonExistentElementId = 999;

$response = $this->apiCall('GET', self::API_TEST_URL . '/' . $request->id . '/tokens?element_id=' . $nonExistentElementId);
$response->assertStatus(404);
$response->assertStatus(404);

// Verify with other user without permissions
$this->user = $otherUser;

$response = $this->apiCall('GET', self::API_TEST_URL . '/' . $request->id . '/tokens?element_id=' . $token->element_id);
$response->assertStatus(403);

$this->user->giveDirectPermission('view-all_requests');
$this->user->refresh();

// Verify with other user with permissions
$response = $this->apiCall('GET', self::API_TEST_URL . '/' . $request->id . '/tokens?element_id=' . $token->element_id);
$response->assertStatus(200);

}
}