solve conflicts
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model factory for a process
|
* Model factory for a process
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
$factory->define(\ProcessMaker\Model\Process::class, function (Faker $faker) {
|
$factory->define(\ProcessMaker\Model\Process::class, function (Faker $faker) {
|
||||||
@@ -27,6 +29,7 @@ $factory->define(\ProcessMaker\Model\Process::class, function(Faker $faker) {
|
|||||||
'PRO_CATEGORY' => function () {
|
'PRO_CATEGORY' => function () {
|
||||||
return factory(\ProcessMaker\Model\ProcessCategory::class)->create()->CATEGORY_UID;
|
return factory(\ProcessMaker\Model\ProcessCategory::class)->create()->CATEGORY_UID;
|
||||||
},
|
},
|
||||||
|
'CATEGORY_ID' => 0
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -628,6 +628,11 @@ class RBAC
|
|||||||
'PER_UID' => '00000000000000000000000000000069',
|
'PER_UID' => '00000000000000000000000000000069',
|
||||||
'PER_CODE' => 'PM_TASK_SCHEDULER_ADMIN',
|
'PER_CODE' => 'PM_TASK_SCHEDULER_ADMIN',
|
||||||
'PER_NAME' => 'View Task Scheduler'
|
'PER_NAME' => 'View Task Scheduler'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'PER_UID' => '00000000000000000000000000000070',
|
||||||
|
'PER_CODE' => 'TASK_METRICS_VIEW',
|
||||||
|
'PER_NAME' => 'Task Metrics View'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ INSERT INTO `RBAC_PERMISSIONS` VALUES
|
|||||||
('00000000000000000000000000000066','PM_GUEST_CASE','2017-03-27 00:00:00','2017-03-27 00:00:00',1,'00000000000000000000000000000002'),
|
('00000000000000000000000000000066','PM_GUEST_CASE','2017-03-27 00:00:00','2017-03-27 00:00:00',1,'00000000000000000000000000000002'),
|
||||||
('00000000000000000000000000000067','PM_SETUP_LOG_FILES','2018-02-06 00:00:00','2018-02-06 00:00:00',1,'00000000000000000000000000000002'),
|
('00000000000000000000000000000067','PM_SETUP_LOG_FILES','2018-02-06 00:00:00','2018-02-06 00:00:00',1,'00000000000000000000000000000002'),
|
||||||
('00000000000000000000000000000068','PM_FOLDERS_OWNER','2020-01-29 00:00:00','2020-01-29 00:00:00',1,'00000000000000000000000000000002');
|
('00000000000000000000000000000068','PM_FOLDERS_OWNER','2020-01-29 00:00:00','2020-01-29 00:00:00',1,'00000000000000000000000000000002');
|
||||||
|
('00000000000000000000000000000070','TASK_METRICS_VIEW','2021-07-14 00:00:00','2021-07-14 00:00:00',1,'00000000000000000000000000000002');
|
||||||
|
|
||||||
INSERT INTO `RBAC_PERMISSIONS` VALUES
|
INSERT INTO `RBAC_PERMISSIONS` VALUES
|
||||||
('00000000000000000000000000000069','PM_TASK_SCHEDULER_ADMIN','2020-01-29 00:00:00','2020-01-29 00:00:00',1,'00000000000000000000000000000002');
|
('00000000000000000000000000000069','PM_TASK_SCHEDULER_ADMIN','2020-01-29 00:00:00','2020-01-29 00:00:00',1,'00000000000000000000000000000002');
|
||||||
@@ -148,6 +149,7 @@ INSERT INTO `RBAC_ROLES_PERMISSIONS` VALUES
|
|||||||
('00000000000000000000000000000002','00000000000000000000000000000067'),
|
('00000000000000000000000000000002','00000000000000000000000000000067'),
|
||||||
('00000000000000000000000000000002','00000000000000000000000000000068'),
|
('00000000000000000000000000000002','00000000000000000000000000000068'),
|
||||||
('00000000000000000000000000000002','00000000000000000000000000000069'),
|
('00000000000000000000000000000002','00000000000000000000000000000069'),
|
||||||
|
('00000000000000000000000000000002','00000000000000000000000000000070'),
|
||||||
('00000000000000000000000000000003','00000000000000000000000000000001'),
|
('00000000000000000000000000000003','00000000000000000000000000000001'),
|
||||||
('00000000000000000000000000000003','00000000000000000000000000000005'),
|
('00000000000000000000000000000003','00000000000000000000000000000005'),
|
||||||
('00000000000000000000000000000003','00000000000000000000000000000040'),
|
('00000000000000000000000000000003','00000000000000000000000000000040'),
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
@onRemoveFilter="onRemoveFilter"
|
@onRemoveFilter="onRemoveFilter"
|
||||||
@onUpdateFilters="onUpdateFilters"
|
@onUpdateFilters="onUpdateFilters"
|
||||||
/>
|
/>
|
||||||
|
<multiview-header :data="dataMultiviewHeader" />
|
||||||
<v-server-table
|
<v-server-table
|
||||||
|
v-if="typeView === 'GRID'"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:options="options"
|
:options="options"
|
||||||
@@ -39,21 +41,139 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-server-table>
|
</v-server-table>
|
||||||
|
<VueCardView
|
||||||
|
v-if="typeView === 'CARD'"
|
||||||
|
:options="optionsVueCardView"
|
||||||
|
ref="vueCardView"
|
||||||
|
>
|
||||||
|
<div slot="detail" slot-scope="props">
|
||||||
|
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
|
||||||
|
<i class="fas fa-info-circle"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div slot="case_number" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-highlight"
|
||||||
|
>{{ props["headings"][props.column] }} : {{ props["item"]["CASE_NUMBER"] }}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div slot="case_title" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light"
|
||||||
|
>{{ props["item"]["CASE_TITLE"] }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div slot="process_name" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light"
|
||||||
|
>{{ props["item"]["PROCESS_NAME"] }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div slot="due_date" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light"
|
||||||
|
>{{ props["item"]["DUE_DATE"] }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div slot="delegation_date" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light"
|
||||||
|
>{{ props["item"]["DELEGATION_DATE"] }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div slot="task" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light">
|
||||||
|
<TaskCell :data="props.item.TASK" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</VueCardView>
|
||||||
|
<VueListView
|
||||||
|
v-if="typeView === 'LIST'"
|
||||||
|
:options="optionsVueCardView"
|
||||||
|
ref="vueListView"
|
||||||
|
>
|
||||||
|
<div slot="detail" slot-scope="props">
|
||||||
|
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
|
||||||
|
<i class="fas fa-info-circle"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div slot="case_number" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-highlight"
|
||||||
|
>{{ props["headings"][props.column] }} : {{ props["item"]["CASE_NUMBER"] }}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div slot="case_title" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light"
|
||||||
|
>{{ props["item"]["CASE_TITLE"] }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div slot="process_name" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light"
|
||||||
|
>{{ props["item"]["PROCESS_NAME"] }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div slot="due_date" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light"
|
||||||
|
>{{ props["item"]["DUE_DATE"] }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div slot="delegation_date" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light"
|
||||||
|
>{{ props["item"]["DELEGATION_DATE"] }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div slot="task" slot-scope="props" class="v-card-text">
|
||||||
|
<span class="v-card-text-dark"
|
||||||
|
>{{ props["headings"][props.column] }} :</span
|
||||||
|
>
|
||||||
|
<span class="v-card-text-light">
|
||||||
|
<TaskCell :data="props.item.TASK" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</VueListView>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HeaderCounter from "../components/home/HeaderCounter.vue";
|
import HeaderCounter from "../../components/home/HeaderCounter.vue";
|
||||||
import ButtonFleft from "../components/home/ButtonFleft.vue";
|
import ButtonFleft from "../../components/home/ButtonFleft.vue";
|
||||||
import ModalNewRequest from "./ModalNewRequest.vue";
|
import ModalNewRequest from "../ModalNewRequest.vue";
|
||||||
import CasesFilter from "../components/search/CasesFilter";
|
import CasesFilter from "../../components/search/CasesFilter";
|
||||||
import TaskCell from "../components/vuetable/TaskCell.vue";
|
import TaskCell from "../../components/vuetable/TaskCell.vue";
|
||||||
import api from "./../api/index";
|
import api from "../../api/index";
|
||||||
import utils from "./../utils/utils";
|
import utils from "../../utils/utils";
|
||||||
import Ellipsis from '../components/utils/ellipsis.vue';
|
import MultiviewHeader from "../../components/headers/MultiviewHeader.vue";
|
||||||
|
import VueCardView from "../../components/dataViews/vueCardView/VueCardView.vue";
|
||||||
|
import VueListView from "../../components/dataViews/vueListView/VueListView.vue";
|
||||||
|
import defaultMixins from "./defaultMixins";
|
||||||
|
import Ellipsis from '../../components/utils/ellipsis.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Draft",
|
name: "Draft",
|
||||||
|
mixins: [defaultMixins],
|
||||||
components: {
|
components: {
|
||||||
HeaderCounter,
|
HeaderCounter,
|
||||||
ButtonFleft,
|
ButtonFleft,
|
||||||
@@ -61,6 +181,9 @@ export default {
|
|||||||
TaskCell,
|
TaskCell,
|
||||||
CasesFilter,
|
CasesFilter,
|
||||||
Ellipsis,
|
Ellipsis,
|
||||||
|
MultiviewHeader,
|
||||||
|
VueCardView,
|
||||||
|
VueListView
|
||||||
},
|
},
|
||||||
props: ["defaultOption", "filters"],
|
props: ["defaultOption", "filters"],
|
||||||
data() {
|
data() {
|
||||||
@@ -322,7 +445,15 @@ export default {
|
|||||||
this.$emit("onUpdateFilters", data.params);
|
this.$emit("onUpdateFilters", data.params);
|
||||||
if (data.refresh) {
|
if (data.refresh) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
if (this.typeView === "GRID") {
|
||||||
this.$refs["vueTable"].getData();
|
this.$refs["vueTable"].getData();
|
||||||
|
}
|
||||||
|
if (this.typeView === "CARD") {
|
||||||
|
this.$refs["vueCardView"].getData();
|
||||||
|
}
|
||||||
|
if (this.typeView === "LIST") {
|
||||||
|
this.$refs["vueListView"].getData();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -365,4 +496,5 @@ export default {
|
|||||||
padding-left: 50px;
|
padding-left: 50px;
|
||||||
padding-right: 50px;
|
padding-right: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
140
resources/assets/js/home/Draft/defaultMixins.js
Normal file
140
resources/assets/js/home/Draft/defaultMixins.js
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
import api from "../../api/index";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
let that = this;
|
||||||
|
return {
|
||||||
|
typeView: "GRID",
|
||||||
|
dataMultiviewHeader: {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
id: "view-grid",
|
||||||
|
title: "Grid",
|
||||||
|
onClick(action) {
|
||||||
|
that.typeView = "GRID";
|
||||||
|
},
|
||||||
|
icon: "fas fa-table",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "view-list",
|
||||||
|
title: "List",
|
||||||
|
onClick(action) {
|
||||||
|
that.typeView = "LIST";
|
||||||
|
},
|
||||||
|
icon: "fas fa-list",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "view-card",
|
||||||
|
title: "Card",
|
||||||
|
onClick(action) {
|
||||||
|
that.typeView = "CARD";
|
||||||
|
},
|
||||||
|
icon: "fas fa-th",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
optionsVueCardView: {
|
||||||
|
limit: 10,
|
||||||
|
headings: {
|
||||||
|
detail: "",
|
||||||
|
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
|
||||||
|
case_title: this.$i18n.t("ID_CASE_TITLE"),
|
||||||
|
process_name: this.$i18n.t("ID_PROCESS_NAME"),
|
||||||
|
task: this.$i18n.t("ID_TASK"),
|
||||||
|
current_user: this.$i18n.t("ID_CURRENT_USER"),
|
||||||
|
due_date: this.$i18n.t("ID_DUE_DATE"),
|
||||||
|
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
|
||||||
|
priority: this.$i18n.t("ID_PRIORITY")
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
"detail",
|
||||||
|
"case_number",
|
||||||
|
"case_title",
|
||||||
|
"process_name",
|
||||||
|
"due_date",
|
||||||
|
"delegation_date",
|
||||||
|
"priority",
|
||||||
|
"task"
|
||||||
|
],
|
||||||
|
requestFunction(data) {
|
||||||
|
return that.getCasesVueList(data);
|
||||||
|
},
|
||||||
|
requestFunctionViewMore(data) {
|
||||||
|
return that.getCasesVueListViewMore(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* Get cases for Vue Card View
|
||||||
|
*/
|
||||||
|
getCasesVueList(data) {
|
||||||
|
let that = this,
|
||||||
|
dt,
|
||||||
|
start = 0,
|
||||||
|
limit = data.limit,
|
||||||
|
filters = {};
|
||||||
|
filters = {
|
||||||
|
paged: "0," + limit,
|
||||||
|
};
|
||||||
|
|
||||||
|
_.forIn(this.filters, function (item, key) {
|
||||||
|
if (item.value && item.value != "") {
|
||||||
|
filters[item.filterVar] = item.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return new Promise((resolutionFunc, rejectionFunc) => {
|
||||||
|
api.cases
|
||||||
|
.draft(filters)
|
||||||
|
.then((response) => {
|
||||||
|
dt = that.formatDataResponse(response.data.data);
|
||||||
|
resolutionFunc({
|
||||||
|
data: dt,
|
||||||
|
count: response.data.total,
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
rejectionFunc(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Get cases for Vue Card View
|
||||||
|
*/
|
||||||
|
getCasesVueListViewMore(data) {
|
||||||
|
let that = this,
|
||||||
|
dt,
|
||||||
|
paged,
|
||||||
|
limit = data.limit,
|
||||||
|
start = data.page === 1 ? 0 : limit * (data.page - 1),
|
||||||
|
filters = {};
|
||||||
|
paged = start + "," + limit;
|
||||||
|
|
||||||
|
filters = {
|
||||||
|
paged: paged,
|
||||||
|
};
|
||||||
|
_.forIn(this.filters, function (item, key) {
|
||||||
|
if (item.value && item.value != "") {
|
||||||
|
filters[item.filterVar] = item.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return new Promise((resolutionFunc, rejectionFunc) => {
|
||||||
|
api.cases
|
||||||
|
.draft(filters)
|
||||||
|
.then((response) => {
|
||||||
|
dt = that.formatDataResponse(response.data.data);
|
||||||
|
resolutionFunc({
|
||||||
|
data: dt,
|
||||||
|
count: response.data.total,
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
rejectionFunc(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,8 +41,8 @@ import CustomSidebar from "./../components/menu/CustomSidebar";
|
|||||||
import MyCases from "./MyCases";
|
import MyCases from "./MyCases";
|
||||||
import MyDocuments from "./MyDocuments";
|
import MyDocuments from "./MyDocuments";
|
||||||
import Todo from "./Inbox/Todo.vue";
|
import Todo from "./Inbox/Todo.vue";
|
||||||
import Draft from "./Draft";
|
|
||||||
import Paused from "./Paused/Paused.vue";
|
import Paused from "./Paused/Paused.vue";
|
||||||
|
import Draft from "./Draft/Draft.vue";
|
||||||
import Unassigned from "./Unassigned";
|
import Unassigned from "./Unassigned";
|
||||||
import BatchRouting from "./BatchRouting";
|
import BatchRouting from "./BatchRouting";
|
||||||
import CaseDetail from "./CaseDetail";
|
import CaseDetail from "./CaseDetail";
|
||||||
|
|||||||
@@ -1,399 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div id="v-todo" ref="v-todo" class="v-container-todo">
|
|
||||||
<button-fleft :data="newCase"></button-fleft>
|
|
||||||
<modal-new-request ref="newRequest"></modal-new-request>
|
|
||||||
<CasesFilter
|
|
||||||
:filters="filters"
|
|
||||||
:title="$t('ID_CASES_STATUS_TO_DO')"
|
|
||||||
@onRemoveFilter="onRemoveFilter"
|
|
||||||
@onUpdateFilters="onUpdateFilters"
|
|
||||||
/>
|
|
||||||
<v-server-table
|
|
||||||
:data="tableData"
|
|
||||||
:columns="columns"
|
|
||||||
:options="options"
|
|
||||||
ref="vueTable"
|
|
||||||
@row-click="onRowClick"
|
|
||||||
>
|
|
||||||
<div slot="detail" slot-scope="props">
|
|
||||||
<div class="btn-default" @click="openCaseDetail(props.row)">
|
|
||||||
<i class="fas fa-info-circle"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div slot="case_number" slot-scope="props">
|
|
||||||
{{ props.row.CASE_NUMBER }}
|
|
||||||
</div>
|
|
||||||
<div slot="case_title" slot-scope="props">
|
|
||||||
{{ props.row.CASE_TITLE }}
|
|
||||||
</div>
|
|
||||||
<div slot="process_name" slot-scope="props">
|
|
||||||
{{ props.row.PROCESS_NAME }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div slot="task" slot-scope="props">
|
|
||||||
<TaskCell :data="props.row.TASK" />
|
|
||||||
</div>
|
|
||||||
<div slot="current_user" slot-scope="props">
|
|
||||||
{{ props.row.USERNAME_DISPLAY_FORMAT}}
|
|
||||||
</div>
|
|
||||||
<div slot="due_date" slot-scope="props">
|
|
||||||
{{ props.row.DUE_DATE }}
|
|
||||||
</div>
|
|
||||||
<div slot="delegation_date" slot-scope="props">
|
|
||||||
{{ props.row.DELEGATION_DATE }}
|
|
||||||
</div>
|
|
||||||
<div slot="priority" slot-scope="props">{{ props.row.PRIORITY }}</div>
|
|
||||||
<div slot="actions" slot-scope="props">
|
|
||||||
<div @click="updateDataEllipsis(props.row)">
|
|
||||||
<ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</v-server-table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import HeaderCounter from "../components/home/HeaderCounter.vue";
|
|
||||||
import ButtonFleft from "../components/home/ButtonFleft.vue";
|
|
||||||
import ModalNewRequest from "./ModalNewRequest.vue";
|
|
||||||
import TaskCell from "../components/vuetable/TaskCell.vue";
|
|
||||||
import CasesFilter from "../components/search/CasesFilter";
|
|
||||||
import api from "./../api/index";
|
|
||||||
import utils from "./../utils/utils";
|
|
||||||
import Ellipsis from '../components/utils/ellipsis.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Todo",
|
|
||||||
components: {
|
|
||||||
HeaderCounter,
|
|
||||||
ButtonFleft,
|
|
||||||
ModalNewRequest,
|
|
||||||
TaskCell,
|
|
||||||
CasesFilter,
|
|
||||||
Ellipsis,
|
|
||||||
},
|
|
||||||
props: ["defaultOption", "filters"],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
newCase: {
|
|
||||||
title: this.$i18n.t("ID_NEW_CASE"),
|
|
||||||
class: "btn-success",
|
|
||||||
onClick: () => {
|
|
||||||
this.$refs["newRequest"].show();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
"detail",
|
|
||||||
"case_number",
|
|
||||||
"case_title",
|
|
||||||
"process_name",
|
|
||||||
"task",
|
|
||||||
"due_date",
|
|
||||||
"delegation_date",
|
|
||||||
"priority",
|
|
||||||
"actions",
|
|
||||||
],
|
|
||||||
tableData: [],
|
|
||||||
options: {
|
|
||||||
filterable: false,
|
|
||||||
headings: {
|
|
||||||
detail: "",
|
|
||||||
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
|
|
||||||
case_title: this.$i18n.t("ID_CASE_TITLE"),
|
|
||||||
process_name: this.$i18n.t("ID_PROCESS_NAME"),
|
|
||||||
task: this.$i18n.t("ID_TASK"),
|
|
||||||
current_user: this.$i18n.t("ID_CURRENT_USER"),
|
|
||||||
due_date: this.$i18n.t("ID_DUE_DATE"),
|
|
||||||
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
|
|
||||||
priority: this.$i18n.t("ID_PRIORITY"),
|
|
||||||
actions: "",
|
|
||||||
},
|
|
||||||
texts: {
|
|
||||||
count:this.$i18n.t("ID_SHOWING_FROM_RECORDS_COUNT"),
|
|
||||||
first: this.$i18n.t("ID_FIRST"),
|
|
||||||
last: this.$i18n.t("ID_LAST"),
|
|
||||||
filter: this.$i18n.t("ID_FILTER") + ":",
|
|
||||||
limit: this.$i18n.t("ID_RECORDS") + ":",
|
|
||||||
page: this.$i18n.t("ID_PAGE") + ":",
|
|
||||||
noResults: this.$i18n.t("ID_NO_MATCHING_RECORDS")
|
|
||||||
},
|
|
||||||
selectable: {
|
|
||||||
mode: "single",
|
|
||||||
only: function (row) {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
selectAllMode: "page",
|
|
||||||
programmatic: false,
|
|
||||||
},
|
|
||||||
requestFunction(data) {
|
|
||||||
return this.$parent.$parent.getCasesForVueTable(data);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
pmDateFormat: "Y-m-d H:i:s",
|
|
||||||
clickCount: 0,
|
|
||||||
singleClickTimer: null,
|
|
||||||
statusTitle: {
|
|
||||||
"ON_TIME": this.$i18n.t("ID_IN_PROGRESS"),
|
|
||||||
"OVERDUE": this.$i18n.t("ID_TASK_OVERDUE"),
|
|
||||||
"DRAFT": this.$i18n.t("ID_IN_DRAFT"),
|
|
||||||
"PAUSED": this.$i18n.t("ID_PAUSED"),
|
|
||||||
"UNASSIGNED": this.$i18n.t("ID_UNASSIGNED")
|
|
||||||
},
|
|
||||||
dataEllipsis: {
|
|
||||||
buttons: {}
|
|
||||||
},
|
|
||||||
showEllipsis: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.initFilters();
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
// force to open case
|
|
||||||
this.openDefaultCase();
|
|
||||||
},
|
|
||||||
watch: {},
|
|
||||||
computed: {
|
|
||||||
/**
|
|
||||||
* Build our ProcessMaker apiClient
|
|
||||||
*/
|
|
||||||
ProcessMaker() {
|
|
||||||
return window.ProcessMaker;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
updated() {},
|
|
||||||
beforeCreate() {},
|
|
||||||
methods: {
|
|
||||||
/**
|
|
||||||
* Initialize filters
|
|
||||||
*/
|
|
||||||
initFilters() {
|
|
||||||
let params;
|
|
||||||
if(this.defaultOption) {
|
|
||||||
params = utils.getAllUrlParams(this.defaultOption);
|
|
||||||
if (params && params.openapplicationuid) {
|
|
||||||
this.$emit("onUpdateFilters", [
|
|
||||||
{
|
|
||||||
fieldId: "caseNumber",
|
|
||||||
filterVar: "caseNumber",
|
|
||||||
label: "",
|
|
||||||
options:[],
|
|
||||||
value: params.openapplicationuid,
|
|
||||||
autoShow: false
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Open a case when the component was mounted
|
|
||||||
*/
|
|
||||||
openDefaultCase() {
|
|
||||||
let params;
|
|
||||||
if(this.defaultOption) {
|
|
||||||
params = utils.getAllUrlParams(this.defaultOption);
|
|
||||||
if (params && params.app_uid && params.del_index) {
|
|
||||||
this.openCase({
|
|
||||||
APP_UID: params.app_uid,
|
|
||||||
DEL_INDEX: params.del_index
|
|
||||||
});
|
|
||||||
this.$emit("cleanDefaultOption");
|
|
||||||
}
|
|
||||||
//force to search in the parallel tasks
|
|
||||||
if (params && params.openapplicationuid) {
|
|
||||||
this.onUpdateFilters({
|
|
||||||
params: [
|
|
||||||
{
|
|
||||||
fieldId: "caseNumber",
|
|
||||||
filterVar: "caseNumber",
|
|
||||||
label: "",
|
|
||||||
options:[],
|
|
||||||
value: params.openapplicationuid,
|
|
||||||
autoShow: false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
refresh: false
|
|
||||||
});
|
|
||||||
this.$emit("cleanDefaultOption");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* On row click event handler
|
|
||||||
* @param {object} event
|
|
||||||
*/
|
|
||||||
onRowClick(event) {
|
|
||||||
let self = this;
|
|
||||||
self.clickCount += 1;
|
|
||||||
if (self.clickCount === 1) {
|
|
||||||
self.singleClickTimer = setTimeout(function() {
|
|
||||||
self.clickCount = 0;
|
|
||||||
}, 400);
|
|
||||||
} else if (self.clickCount === 2) {
|
|
||||||
clearTimeout(self.singleClickTimer);
|
|
||||||
self.clickCount = 0;
|
|
||||||
self.openCase(event.row);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Get cases todo data
|
|
||||||
*/
|
|
||||||
getCasesForVueTable(data) {
|
|
||||||
let that = this,
|
|
||||||
dt,
|
|
||||||
paged,
|
|
||||||
limit = data.limit,
|
|
||||||
start = data.page === 1 ? 0 : limit * (data.page - 1),
|
|
||||||
filters = {};
|
|
||||||
paged = start + "," + limit;
|
|
||||||
|
|
||||||
filters = {
|
|
||||||
paged: paged,
|
|
||||||
};
|
|
||||||
|
|
||||||
_.forIn(this.filters, function (item, key) {
|
|
||||||
filters[item.filterVar] = item.value;
|
|
||||||
});
|
|
||||||
return new Promise((resolutionFunc, rejectionFunc) => {
|
|
||||||
api.cases
|
|
||||||
.todo(filters)
|
|
||||||
.then((response) => {
|
|
||||||
dt = that.formatDataResponse(response.data.data);
|
|
||||||
resolutionFunc({
|
|
||||||
data: dt,
|
|
||||||
count: response.data.total,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
rejectionFunc(e);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Format Response API TODO to grid todo and columns
|
|
||||||
*/
|
|
||||||
formatDataResponse(response) {
|
|
||||||
let data = [];
|
|
||||||
_.forEach(response, (v) => {
|
|
||||||
data.push({
|
|
||||||
CASE_NUMBER: v.APP_NUMBER,
|
|
||||||
CASE_TITLE: v.DEL_TITLE,
|
|
||||||
PROCESS_NAME: v.PRO_TITLE,
|
|
||||||
TASK: [{
|
|
||||||
TITLE: v.TAS_TITLE,
|
|
||||||
CODE_COLOR: v.TAS_COLOR,
|
|
||||||
COLOR: v.TAS_COLOR_LABEL,
|
|
||||||
DELAYED_TITLE: v.TAS_STATUS === "OVERDUE" ?
|
|
||||||
this.$i18n.t("ID_DELAYED") + ":" : this.statusTitle[v.TAS_STATUS],
|
|
||||||
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : ""
|
|
||||||
}],
|
|
||||||
USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({
|
|
||||||
userName: v.USR_LASTNAME,
|
|
||||||
firstName: v.USR_LASTNAME,
|
|
||||||
lastName: v.USR_LASTNAME,
|
|
||||||
format: window.config.FORMATS.format || null
|
|
||||||
}),
|
|
||||||
DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL,
|
|
||||||
DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL,
|
|
||||||
PRIORITY: v.DEL_PRIORITY_LABEL,
|
|
||||||
DEL_INDEX: v.DEL_INDEX,
|
|
||||||
APP_UID: v.APP_UID,
|
|
||||||
PRO_UID: v.PRO_UID,
|
|
||||||
TAS_UID: v.TAS_UID,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Open selected cases in the inbox
|
|
||||||
*
|
|
||||||
* @param {object} item
|
|
||||||
*/
|
|
||||||
openCase(item) {
|
|
||||||
this.$emit("onUpdateDataCase", {
|
|
||||||
APP_UID: item.APP_UID,
|
|
||||||
DEL_INDEX: item.DEL_INDEX,
|
|
||||||
PRO_UID: item.PRO_UID,
|
|
||||||
TAS_UID: item.TAS_UID,
|
|
||||||
ACTION: "todo"
|
|
||||||
});
|
|
||||||
this.$emit("onUpdatePage", "XCase");
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Open case detail
|
|
||||||
*
|
|
||||||
* @param {object} item
|
|
||||||
*/
|
|
||||||
openCaseDetail(item) {
|
|
||||||
let that = this;
|
|
||||||
api.cases.open(_.extend({ ACTION: "todo" }, item)).then(() => {
|
|
||||||
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
|
|
||||||
that.$emit("onUpdateDataCase", {
|
|
||||||
APP_UID: item.APP_UID,
|
|
||||||
DEL_INDEX: item.DEL_INDEX,
|
|
||||||
PRO_UID: item.PRO_UID,
|
|
||||||
TAS_UID: item.TAS_UID,
|
|
||||||
APP_NUMBER: item.CASE_NUMBER,
|
|
||||||
ACTION: "todo"
|
|
||||||
});
|
|
||||||
that.$emit("onUpdatePage", "case-detail");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onRemoveFilter(data) {},
|
|
||||||
onUpdateFilters(data) {
|
|
||||||
this.$emit("onUpdateFilters", data.params);
|
|
||||||
if (data.refresh) {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs["vueTable"].getData();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* update view in component
|
|
||||||
*/
|
|
||||||
updateView(){
|
|
||||||
this.$refs["vueTable"].getData();
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Show options in the ellipsis
|
|
||||||
*/
|
|
||||||
updateDataEllipsis(data) {
|
|
||||||
let that = this;
|
|
||||||
this.showEllipsis = !this.showEllipsis;
|
|
||||||
if (this.showEllipsis) {
|
|
||||||
this.dataEllipsis = {
|
|
||||||
buttons: {
|
|
||||||
open: {
|
|
||||||
name: "open",
|
|
||||||
icon: "far fa-edit",
|
|
||||||
fn: function() {console.log(data.APP_UID);}
|
|
||||||
},
|
|
||||||
note: {
|
|
||||||
name: "case note",
|
|
||||||
icon: "far fa-comments",
|
|
||||||
fn: function() {console.log("comments");}
|
|
||||||
},
|
|
||||||
pause: {
|
|
||||||
name: "pause case",
|
|
||||||
icon: "far fa-pause-circle",
|
|
||||||
fn: function() {console.log("pause case");}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
.v-container-todo {
|
|
||||||
padding-top: 20px;
|
|
||||||
padding-bottom: 20px;
|
|
||||||
padding-left: 50px;
|
|
||||||
padding-right: 50px;
|
|
||||||
}
|
|
||||||
.VueTables__limit {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use ProcessMaker\BusinessModel\Cases\Draft;
|
use ProcessMaker\BusinessModel\Cases\Draft;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
use ProcessMaker\Model\User;
|
use ProcessMaker\Model\User;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
@@ -305,4 +306,339 @@ class DraftTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals(1, $res);
|
$this->assertEquals(1, $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method without filters
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_no_filter()
|
||||||
|
{
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$process2 = factory(Process::class)->create();
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$application1 = factory(Application::class)->states('draft')->create([
|
||||||
|
'APP_INIT_USER' => $user->USR_UID,
|
||||||
|
'APP_CUR_USER' => $user->USR_UID,
|
||||||
|
]);
|
||||||
|
$application2 = factory(Application::class)->states('draft')->create([
|
||||||
|
'APP_INIT_USER' => $user->USR_UID,
|
||||||
|
'APP_CUR_USER' => $user->USR_UID,
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application1->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application1->APP_UID,
|
||||||
|
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application2->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application2->APP_UID,
|
||||||
|
'APP_NUMBER' => $application2->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
$draft = new Draft();
|
||||||
|
$draft->setUserId($user->USR_ID);
|
||||||
|
$draft->setUserUid($user->USR_ID);
|
||||||
|
$res = $draft->getCountersByProcesses();
|
||||||
|
$this->assertCount(2, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the category filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_category()
|
||||||
|
{
|
||||||
|
$process = factory(Process::class)->create([
|
||||||
|
'CATEGORY_ID' => 1
|
||||||
|
]);
|
||||||
|
$process2 = factory(Process::class)->create([
|
||||||
|
'CATEGORY_ID' => 2
|
||||||
|
]);
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$application = factory(Application::class, 5)->states('draft')->create([
|
||||||
|
'APP_INIT_USER' => $user->USR_UID,
|
||||||
|
'APP_CUR_USER' => $user->USR_UID,
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[0]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[0]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[0]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[1]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[1]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[1]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[2]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[2]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[2]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[3]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[3]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[3]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[4]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[4]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[4]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
$draft = new Draft();
|
||||||
|
$draft->setUserId($user->USR_ID);
|
||||||
|
$draft->setUserUid($user->USR_ID);
|
||||||
|
$res = $draft->getCountersByProcesses(2);
|
||||||
|
$this->assertCount(1, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the top ten filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_top_ten()
|
||||||
|
{
|
||||||
|
$process1 = factory(Process::class)->create();
|
||||||
|
$process2 = factory(Process::class)->create();
|
||||||
|
$process3 = factory(Process::class)->create();
|
||||||
|
$process4 = factory(Process::class)->create();
|
||||||
|
$process5 = factory(Process::class)->create();
|
||||||
|
$process6 = factory(Process::class)->create();
|
||||||
|
$process7 = factory(Process::class)->create();
|
||||||
|
$process8 = factory(Process::class)->create();
|
||||||
|
$process9 = factory(Process::class)->create();
|
||||||
|
$process10 = factory(Process::class)->create();
|
||||||
|
$process11 = factory(Process::class)->create();
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$application = factory(Application::class, 14)->states('draft')->create([
|
||||||
|
'APP_INIT_USER' => $user->USR_UID,
|
||||||
|
'APP_CUR_USER' => $user->USR_UID,
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[0]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[0]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[0]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[1]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[1]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[1]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[2]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[2]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[2]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[3]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[3]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[3]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[4]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[4]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[4]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[5]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[5]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[5]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process3->PRO_ID,
|
||||||
|
'PRO_UID' => $process3->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[6]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[6]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[6]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process4->PRO_ID,
|
||||||
|
'PRO_UID' => $process4->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[7]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[7]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[7]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process5->PRO_ID,
|
||||||
|
'PRO_UID' => $process5->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[8]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[8]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[8]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process6->PRO_ID,
|
||||||
|
'PRO_UID' => $process6->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[9]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[9]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[9]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process7->PRO_ID,
|
||||||
|
'PRO_UID' => $process7->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[10]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[10]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[10]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process8->PRO_ID,
|
||||||
|
'PRO_UID' => $process8->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[11]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[11]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[11]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process9->PRO_ID,
|
||||||
|
'PRO_UID' => $process9->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[12]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[12]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[12]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process10->PRO_ID,
|
||||||
|
'PRO_UID' => $process10->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[13]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[13]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[13]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process11->PRO_ID,
|
||||||
|
'PRO_UID' => $process11->PRO_UID
|
||||||
|
]);
|
||||||
|
$draft = new Draft();
|
||||||
|
$draft->setUserId($user->USR_ID);
|
||||||
|
$draft->setUserUid($user->USR_ID);
|
||||||
|
$res = $draft->getCountersByProcesses(null, true);
|
||||||
|
$this->assertCount(10, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the processes filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_processes()
|
||||||
|
{
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$process2 = factory(Process::class)->create();
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$application = factory(Application::class, 14)->states('draft')->create([
|
||||||
|
'APP_INIT_USER' => $user->USR_UID,
|
||||||
|
'APP_CUR_USER' => $user->USR_UID,
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[0]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[0]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[0]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application[1]->APP_INIT_USER,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'APP_UID' => $application[1]->APP_UID,
|
||||||
|
'APP_NUMBER' => $application[1]->APP_NUMBER,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
$draft = new Draft();
|
||||||
|
$draft->setUserId($user->USR_ID);
|
||||||
|
$draft->setUserUid($user->USR_ID);
|
||||||
|
$res = $draft->getCountersByProcesses(null, false, [$process->PRO_ID]);
|
||||||
|
$this->assertCount(1, $res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ class InboxTest extends TestCase
|
|||||||
$inbox->setTaskId($cases->TAS_ID);
|
$inbox->setTaskId($cases->TAS_ID);
|
||||||
$res = $inbox->getData();
|
$res = $inbox->getData();
|
||||||
$this->assertNotEmpty($res);
|
$this->assertNotEmpty($res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -298,4 +297,273 @@ class InboxTest extends TestCase
|
|||||||
$res = $inbox->getPagingCounters();
|
$res = $inbox->getPagingCounters();
|
||||||
$this->assertEquals(1, $res);
|
$this->assertEquals(1, $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method without filters
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_no_filter()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$process2 = factory(Process::class)->create();
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
$inbox = new Inbox();
|
||||||
|
$inbox->setUserId($user->USR_ID);
|
||||||
|
$inbox->setUserUid($user->USR_UID);
|
||||||
|
$res = $inbox->getCountersByProcesses();
|
||||||
|
$this->assertCount(2, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the category filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_category()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process = factory(Process::class)->create([
|
||||||
|
'CATEGORY_ID' => 1
|
||||||
|
]);
|
||||||
|
$process2 = factory(Process::class)->create([
|
||||||
|
'CATEGORY_ID' => 2
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
$inbox = new Inbox();
|
||||||
|
$inbox->setUserId($user->USR_ID);
|
||||||
|
$inbox->setUserUid($user->USR_UID);
|
||||||
|
$res = $inbox->getCountersByProcesses(2);
|
||||||
|
$this->assertCount(1, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the top ten filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_top_ten()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process1 = factory(Process::class)->create();
|
||||||
|
$process2 = factory(Process::class)->create();
|
||||||
|
$process3 = factory(Process::class)->create();
|
||||||
|
$process4 = factory(Process::class)->create();
|
||||||
|
$process5 = factory(Process::class)->create();
|
||||||
|
$process6 = factory(Process::class)->create();
|
||||||
|
$process7 = factory(Process::class)->create();
|
||||||
|
$process8 = factory(Process::class)->create();
|
||||||
|
$process9 = factory(Process::class)->create();
|
||||||
|
$process10 = factory(Process::class)->create();
|
||||||
|
$process11 = factory(Process::class)->create();
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process3->PRO_ID,
|
||||||
|
'PRO_UID' => $process3->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process4->PRO_ID,
|
||||||
|
'PRO_UID' => $process4->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process5->PRO_ID,
|
||||||
|
'PRO_UID' => $process5->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process6->PRO_ID,
|
||||||
|
'PRO_UID' => $process6->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process7->PRO_ID,
|
||||||
|
'PRO_UID' => $process7->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process8->PRO_ID,
|
||||||
|
'PRO_UID' => $process8->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process9->PRO_ID,
|
||||||
|
'PRO_UID' => $process9->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process10->PRO_ID,
|
||||||
|
'PRO_UID' => $process10->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process11->PRO_ID,
|
||||||
|
'PRO_UID' => $process11->PRO_UID
|
||||||
|
]);
|
||||||
|
$inbox = new Inbox();
|
||||||
|
$inbox->setUserId($user->USR_ID);
|
||||||
|
$inbox->setUserUid($user->USR_UID);
|
||||||
|
$res = $inbox->getCountersByProcesses(null, true);
|
||||||
|
$this->assertCount(10, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the processes filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_processes()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$process2 = factory(Process::class)->create();
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID
|
||||||
|
]);
|
||||||
|
$inbox = new Inbox();
|
||||||
|
$inbox->setUserId($user->USR_ID);
|
||||||
|
$inbox->setUserUid($user->USR_UID);
|
||||||
|
$res = $inbox->getCountersByProcesses(null, false, [$process->PRO_ID]);
|
||||||
|
$this->assertCount(1, $res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -136,13 +136,15 @@ class PausedTest extends TestCase
|
|||||||
* @param int
|
* @param int
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function createMultiplePaused($cases)
|
public function createMultiplePaused($cases, $category = 1, $user = null)
|
||||||
{
|
{
|
||||||
$user = factory(\ProcessMaker\Model\User::class)->create();
|
if (is_null($user)) {
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $cases; $i = $i + 1) {
|
for ($i = 0; $i < $cases; $i = $i + 1) {
|
||||||
$process1 = factory(Process::class)->create(
|
$process1 = factory(Process::class)->create(
|
||||||
['PRO_CATEGORY' => '1']
|
['PRO_CATEGORY' => 1, 'CATEGORY_ID' => $category]
|
||||||
);
|
);
|
||||||
|
|
||||||
$task = factory(Task::class)->create([
|
$task = factory(Task::class)->create([
|
||||||
@@ -386,4 +388,116 @@ class PausedTest extends TestCase
|
|||||||
$res = $paused->getPagingCounters();
|
$res = $paused->getPagingCounters();
|
||||||
$this->assertEquals(1, $res);
|
$this->assertEquals(1, $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method without filters
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_no_filter()
|
||||||
|
{
|
||||||
|
$cases = $this->createMultiplePaused(2);
|
||||||
|
$paused = new Paused();
|
||||||
|
$paused->setUserId($cases->USR_ID);
|
||||||
|
$paused->setUserUid($cases->USR_ID);
|
||||||
|
$res = $paused->getCountersByProcesses();
|
||||||
|
$this->assertCount(2, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the category filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_category()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$this->createMultiplePaused(3, 2, $user);
|
||||||
|
$this->createMultiplePaused(2, 3, $user);
|
||||||
|
$paused = new Paused();
|
||||||
|
$paused->setUserId($user->USR_ID);
|
||||||
|
$paused->setUserUid($user->USR_ID);
|
||||||
|
$res = $paused->getCountersByProcesses(2);
|
||||||
|
$this->assertCount(3, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the top ten filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_top_ten()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$this->createMultiplePaused(20, 2, $user);
|
||||||
|
$paused = new Paused();
|
||||||
|
$paused->setUserId($user->USR_ID);
|
||||||
|
$paused->setUserUid($user->USR_UID);
|
||||||
|
$res = $paused->getCountersByProcesses(null, true);
|
||||||
|
$this->assertCount(10, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the processes filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_processes_filter()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process1 = factory(Process::class)->create();
|
||||||
|
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => '',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'TAS_TYPE' => 'NORMAL'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$application1 = factory(Application::class)->create();
|
||||||
|
|
||||||
|
factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application1->APP_UID,
|
||||||
|
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'DEL_PREVIOUS' => 0,
|
||||||
|
'DEL_INDEX' => 1
|
||||||
|
]);
|
||||||
|
$delegation1 = factory(Delegation::class)->create([
|
||||||
|
'APP_UID' => $application1->APP_UID,
|
||||||
|
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'DEL_PREVIOUS' => 1,
|
||||||
|
'DEL_INDEX' => 2
|
||||||
|
]);
|
||||||
|
|
||||||
|
factory(AppDelay::class)->create([
|
||||||
|
'APP_DELEGATION_USER' => $user->USR_UID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'APP_NUMBER' => $delegation1->APP_NUMBER,
|
||||||
|
'APP_DEL_INDEX' => $delegation1->DEL_INDEX,
|
||||||
|
'APP_DISABLE_ACTION_USER' => 0,
|
||||||
|
'APP_TYPE' => 'PAUSE'
|
||||||
|
]);
|
||||||
|
$this->createMultiplePaused(3, 2, $user);
|
||||||
|
$paused = new Paused();
|
||||||
|
$paused->setUserId($user->USR_ID);
|
||||||
|
$paused->setUserUid($user->USR_UID);
|
||||||
|
$res = $paused->getCountersByProcesses(null, false, [$process1->PRO_ID]);
|
||||||
|
$this->assertCount(1, $res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ class UnassignedTest extends TestCase
|
|||||||
'taskUser' => $taskUser,
|
'taskUser' => $taskUser,
|
||||||
'delegation' => $delegation
|
'delegation' => $delegation
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -418,4 +417,166 @@ class UnassignedTest extends TestCase
|
|||||||
$res = $unassigned->getPagingCounters();
|
$res = $unassigned->getPagingCounters();
|
||||||
$this->assertNotEmpty($res);
|
$this->assertNotEmpty($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method without filters
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_no_filter()
|
||||||
|
{
|
||||||
|
$cases = $this->createMultipleUnassigned(3);
|
||||||
|
$unassigned = new Unassigned();
|
||||||
|
$unassigned->setUserId($cases->USR_ID);
|
||||||
|
$unassigned->setUserUid($cases->USR_UID);
|
||||||
|
$res = $unassigned->getCountersByProcesses();
|
||||||
|
$this->assertCount(3, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the category filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_category()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process1 = factory(Process::class)->create([
|
||||||
|
'CATEGORY_ID' => 2
|
||||||
|
]);
|
||||||
|
$process2 = factory(Process::class)->create([
|
||||||
|
'CATEGORY_ID' => 3
|
||||||
|
]);
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'APP_STATUS_ID' => 2
|
||||||
|
]);
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
]);
|
||||||
|
factory(TaskUser::class)->create([
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'TU_RELATION' => 1,
|
||||||
|
'TU_TYPE' => 1
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_ID' => 0,
|
||||||
|
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("-1 year"))
|
||||||
|
]);
|
||||||
|
$task2 = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process2->PRO_UID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
]);
|
||||||
|
factory(TaskUser::class)->create([
|
||||||
|
'TAS_UID' => $task2->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'TU_RELATION' => 1,
|
||||||
|
'TU_TYPE' => 1
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task2->TAS_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_ID' => 0,
|
||||||
|
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("-2 year"))
|
||||||
|
]);
|
||||||
|
$unassigned = new Unassigned();
|
||||||
|
$unassigned->setUserId($user->USR_ID);
|
||||||
|
$unassigned->setUserUid($user->USR_UID);
|
||||||
|
$res = $unassigned->getCountersByProcesses(2);
|
||||||
|
$this->assertCount(1, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the top ten filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_top_ten()
|
||||||
|
{
|
||||||
|
$cases = $this->createMultipleUnassigned(20);
|
||||||
|
$unassigned = new Unassigned();
|
||||||
|
$unassigned->setUserId($cases->USR_ID);
|
||||||
|
$unassigned->setUserUid($cases->USR_UID);
|
||||||
|
$res = $unassigned->getCountersByProcesses(null, true);
|
||||||
|
$this->assertCount(10, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It tests the getCountersByProcesses() method with the processes filter
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCountersByProcesses()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_counters_by_processes_method_processes()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process1 = factory(Process::class)->create([
|
||||||
|
'CATEGORY_ID' => 2
|
||||||
|
]);
|
||||||
|
$process2 = factory(Process::class)->create([
|
||||||
|
'CATEGORY_ID' => 3
|
||||||
|
]);
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'APP_STATUS_ID' => 2
|
||||||
|
]);
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
]);
|
||||||
|
factory(TaskUser::class)->create([
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'TU_RELATION' => 1,
|
||||||
|
'TU_TYPE' => 1
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_ID' => 0,
|
||||||
|
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("-1 year"))
|
||||||
|
]);
|
||||||
|
$task2 = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process2->PRO_UID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
]);
|
||||||
|
factory(TaskUser::class)->create([
|
||||||
|
'TAS_UID' => $task2->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'TU_RELATION' => 1,
|
||||||
|
'TU_TYPE' => 1
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task2->TAS_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_ID' => 0,
|
||||||
|
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("-2 year"))
|
||||||
|
]);
|
||||||
|
$unassigned = new Unassigned();
|
||||||
|
$unassigned->setUserId($user->USR_ID);
|
||||||
|
$unassigned->setUserUid($user->USR_UID);
|
||||||
|
$res = $unassigned->getCountersByProcesses(null, false, [$process1->PRO_ID]);
|
||||||
|
$this->assertCount(1, $res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,7 @@ $aRequiredPermissions = array('PM_LOGIN',
|
|||||||
'PM_EDITPERSONALINFO',
|
'PM_EDITPERSONALINFO',
|
||||||
'PM_FOLDERS_VIEW',
|
'PM_FOLDERS_VIEW',
|
||||||
'PM_FOLDERS_ADD_FOLDER',
|
'PM_FOLDERS_ADD_FOLDER',
|
||||||
'PM_FOLDERS_ADD_FILE'
|
'PM_FOLDERS_ADD_FILE',
|
||||||
|
'TASK_METRICS_VIEW'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1431,4 +1431,47 @@ class AbstractCases implements CasesInterface
|
|||||||
{
|
{
|
||||||
throw new Exception("Method '" . __FUNCTION__ . "' should be implemented in the extended class '" . get_class($this) . "'.");
|
throw new Exception("Method '" . __FUNCTION__ . "' should be implemented in the extended class '" . get_class($this) . "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count how many cases has each process
|
||||||
|
*
|
||||||
|
* @param string $list
|
||||||
|
* @param int $category
|
||||||
|
* @param bool $topTen
|
||||||
|
* @param array $processes
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getCountersByProcesses($category = null, $topTen = false, $processes = [])
|
||||||
|
{
|
||||||
|
$query = Delegation::selectRaw('count(APP_DELEGATION.DELEGATION_ID) as TOTAL, APP_DELEGATION.PRO_ID, PROCESS.PRO_TITLE')
|
||||||
|
->groupBy('APP_DELEGATION.PRO_UID');
|
||||||
|
$listArray = explode("\\", get_class($this));
|
||||||
|
$list = end($listArray);
|
||||||
|
switch ($list) {
|
||||||
|
case 'Inbox':
|
||||||
|
$query->inbox($this->getUserId());
|
||||||
|
break;
|
||||||
|
case 'Draft':
|
||||||
|
$query->draft($this->getUserId());
|
||||||
|
break;
|
||||||
|
case 'Paused':
|
||||||
|
$query->paused($this->getUserId());
|
||||||
|
break;
|
||||||
|
case 'Unassigned':
|
||||||
|
$query->selfService($this->getUserUid());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$query->joinProcess();
|
||||||
|
if (!is_null($category)) {
|
||||||
|
$query->categoryId($category);
|
||||||
|
}
|
||||||
|
if ($topTen) {
|
||||||
|
$query->topTen('TOTAL', 'DESC');
|
||||||
|
}
|
||||||
|
if (!empty($processes)) {
|
||||||
|
$query->inProcesses($processes);
|
||||||
|
}
|
||||||
|
return $query->get()->values()->toArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1015,6 +1015,49 @@ class Delegation extends Model
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope process category id
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @param int $category
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeCategoryId($query, $category)
|
||||||
|
{
|
||||||
|
$query->where('PROCESS.CATEGORY_ID', $category);
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope top ten
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @param string $column
|
||||||
|
* @param string $order
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeTopTen($query, $column, $order)
|
||||||
|
{
|
||||||
|
$query->orderBy($column, $order)->limit(10);
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope where in processes
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @param array $processes
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeInProcesses($query, $processes)
|
||||||
|
{
|
||||||
|
$query->whereIn('PROCESS.PRO_ID', $processes);
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get specific cases unassigned that the user can view
|
* Get specific cases unassigned that the user can view
|
||||||
*
|
*
|
||||||
|
|||||||
69
workflow/engine/src/ProcessMaker/Services/Api/Metrics.php
Normal file
69
workflow/engine/src/ProcessMaker/Services/Api/Metrics.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\Services\Api;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Draft;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Inbox;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Paused;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Unassigned;
|
||||||
|
use ProcessMaker\Services\Api;
|
||||||
|
use RBAC;
|
||||||
|
|
||||||
|
class Metrics extends Api
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor of the class
|
||||||
|
* Defines the $RBAC definition
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
global $RBAC;
|
||||||
|
if (!isset($RBAC)) {
|
||||||
|
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
|
||||||
|
$RBAC->sSystem = 'PROCESSMAKER';
|
||||||
|
$RBAC->initRBAC();
|
||||||
|
$RBAC->loadUserRolePermission($RBAC->sSystem, $this->getUserId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get total cases per process
|
||||||
|
*
|
||||||
|
* @url /process-total-cases
|
||||||
|
*
|
||||||
|
* @param string $caseList
|
||||||
|
* @param int $category
|
||||||
|
* @param bool $topTen
|
||||||
|
* @param array $processes
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*
|
||||||
|
* @class AccessControl {@permission TASK_METRICS_VIEW}
|
||||||
|
*/
|
||||||
|
public function getProcessTotalCases($caseList, $category = null, $topTen = false, $processes = [])
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
switch ($caseList) {
|
||||||
|
case 'inbox':
|
||||||
|
$list = new Inbox();
|
||||||
|
break;
|
||||||
|
case 'draft':
|
||||||
|
$list = new Draft();
|
||||||
|
break;
|
||||||
|
case 'paused':
|
||||||
|
$list = new Paused();
|
||||||
|
break;
|
||||||
|
case 'unassigned':
|
||||||
|
$list = new Unassigned();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$result = $list->getCountersByProcesses($category, $topTen, $processes);
|
||||||
|
return $result;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user