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
5 changes: 5 additions & 0 deletions ProcessMaker/Filters/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class Filter
{
const TYPE_PARTICIPANTS = 'Participants';

const TYPE_PARTICIPANTS_FULLNAME = 'ParticipantsFullName';

const TYPE_STATUS = 'Status';

const TYPE_FIELD = 'Field';
Expand Down Expand Up @@ -195,6 +197,9 @@ private function valueAliasMethod()
case self::TYPE_PARTICIPANTS:
$method = 'valueAliasParticipant';
break;
case self::TYPE_PARTICIPANTS_FULLNAME:
$method = 'valueAliasParticipantByFullName';
break;
case self::TYPE_STATUS:
$method = 'valueAliasStatus';
break;
Expand Down
20 changes: 20 additions & 0 deletions ProcessMaker/Models/ProcessRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,26 @@ public function valueAliasParticipant($value, $expression)
}
}

/**
* PMQL value alias for participant field by fullname.
* @param string $value
* @return callable
*/
public function valueAliasParticipantByFullName($value, $expression)
{
return function ($query) use ($value, $expression) {
$query->whereIn('id', function ($subquery) use ($value, $expression) {
$subquery->select('process_request_id')->from('process_request_tokens')
->whereIn('user_id', function ($subquery) use ($value, $expression) {
$subquery->select('id')
->from('users')
->whereRaw("CONCAT(firstname, ' ', lastname) " . $expression->operator . " ?", [$value]);
})
->whereIn('element_type', ['task', 'userTask', 'startEvent']);
});
};
}

/**
* Get the process version used by this request
*
Expand Down
13 changes: 5 additions & 8 deletions resources/js/common/PMColumnFilterPopoverCommonMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const PMColumnFilterCommonMixin = {
if (column.format) {
format = column.format;
}
if (column.field === "status" || column.field === "assignee" || column.field === "participants" || column.field === 'process') {
if (column.field === "status" || column.field === "assignee") {
format = "stringSelect";
}
return format;
Expand All @@ -136,17 +136,14 @@ const PMColumnFilterCommonMixin = {
if (column.field === "assignee") {
formatRange = this.viewAssignee;
}
if (column.field === "participants") {
formatRange = this.viewParticipants;
}
if (column.field === "process") {
formatRange = this.viewProcesses;
}
return formatRange;
},
getOperators(column) {
let operators = [];
if (column.field === "status" || column.field === "assignee" || column.field === "participants" || column.field === 'process') {
if (column.field === "case_title" || column.field === "name" || column.field === "process" || column.field === "task_name" || column.field === "participants") {
operators = ["=", "in", "contains", "regex"];
}
if (column.field === "status" || column.field === "assignee") {
operators = ["=", "in"];
}
return operators;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<div class="pm-filter-form">
<b-form @submit.prevent="handleSubmit">
<PMColumnFilterToggleAscDesc v-model="viewSort"
@onChange="onChangeSort">
@onChange="onChangeSort"
v-if="typeof hideSortingButtons === 'boolean' ? !hideSortingButtons : true">
</PMColumnFilterToggleAscDesc>

<div class="pm-filter-form-area" ref="pmFilterFormArea" data-cy="pmFilterFormArea">
Expand Down Expand Up @@ -90,7 +91,7 @@
components: {
...Components
},
props: ["type", "value", "format", "formatRange", "operators", "viewConfig", "sort"],
props: ["type", "value", "format", "formatRange", "operators", "viewConfig", "sort", "hideSortingButtons"],
data() {
return {
items: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
:operators="operators"
:viewConfig="viewConfig"
:sort="sort"
:hideSortingButtons="hideSortingButtons"
@onChangeSort="onChangeSort"
@onApply="onApply"
@onClear="onClear"
Expand All @@ -41,7 +42,7 @@
PMColumnFilterForm,
PMColumnFilterIconThreeDots
},
props: ["container", "boundary", "id", "type", "value", "format", "formatRange", "operators", "viewConfig", "sort"],
props: ["container", "boundary", "id", "type", "value", "format", "formatRange", "operators", "viewConfig", "sort", "hideSortingButtons"],
data() {
return {
popoverShow: false
Expand Down Expand Up @@ -103,4 +104,4 @@
.popover{
max-width: 375px;
}
</style>
</style>
4 changes: 3 additions & 1 deletion resources/js/requests/components/RequestsListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
:viewConfig="getViewConfigFilter()"
:container="''"
:boundary="'viewport'"
:hideSortingButtons="column.hideSortingButtons"
@onChangeSort="onChangeSort($event, column.field)"
@onApply="onApply($event, column.field)"
@onClear="onClear(column.field)"
Expand Down Expand Up @@ -266,6 +267,7 @@ export default {
default: true,
width: 160,
truncate: true,
hideSortingButtons: true,
},
{
label: this.$t("Status"),
Expand Down Expand Up @@ -527,7 +529,7 @@ export default {
type = "Task";
}
if (value === "participants") {
type = "Participants";
type = "ParticipantsFullName";
}
if (value === "status") {
type = "Status";
Expand Down