This commit is contained in:
Henry Jordan
2021-08-04 16:28:12 +00:00
38 changed files with 1242 additions and 356 deletions

View File

@@ -9,8 +9,8 @@ $factory->define(\ProcessMaker\Model\AppDelay::class, function (Faker $faker) {
'PRO_UID' => G::generateUniqueID(),
'APP_UID' => G::generateUniqueID(),
'APP_NUMBER' => $faker->unique()->numberBetween(1000),
'APP_THREAD_INDEX' => 1,
'APP_DEL_INDEX' => $faker->unique()->numberBetween(10),
'APP_THREAD_INDEX' => $faker->unique()->numberBetween(100),
'APP_DEL_INDEX' => $faker->unique()->numberBetween(100),
'APP_TYPE' => $faker->randomElement($actions),
'APP_STATUS' => 'TO_DO',
'APP_NEXT_TASK' => 0,
@@ -28,56 +28,33 @@ $factory->define(\ProcessMaker\Model\AppDelay::class, function (Faker $faker) {
// Create a delegation with the foreign keys
$factory->state(\ProcessMaker\Model\AppDelay::class, 'paused_foreign_keys', function (Faker $faker) {
// Create values in the foreign key relations
$user = factory(\ProcessMaker\Model\User::class)->create();
$process = factory(\ProcessMaker\Model\Process::class)->create();
$task = factory(\ProcessMaker\Model\Task::class)->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID
]);
$application = factory(\ProcessMaker\Model\Application::class)->create([
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID
]);
$delegation1 = factory(\ProcessMaker\Model\Delegation::class)->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID,
'TAS_UID' => $task->TAS_UID,
'TAS_ID' => $task->TAS_ID,
'APP_NUMBER' => $application->APP_NUMBER,
'APP_UID' => $application->APP_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'DEL_PREVIOUS' => 0,
'DEL_INDEX' => 1
]);
$delegation = factory(\ProcessMaker\Model\Delegation::class)->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID,
'TAS_UID' => $task->TAS_UID,
'TAS_ID' => $task->TAS_ID,
'APP_NUMBER' => $application->APP_NUMBER,
'APP_UID' => $application->APP_UID,
$delegation1 = factory(\ProcessMaker\Model\Delegation::class)->states('closed')->create();
$delegation2 = factory(\ProcessMaker\Model\Delegation::class)->states('foreign_keys')->create([
'PRO_UID' => $delegation1->PRO_UID,
'PRO_ID' => $delegation1->PRO_ID,
'TAS_UID' => $delegation1->TAS_UID,
'TAS_ID' => $delegation1->TAS_ID,
'APP_NUMBER' => $delegation1->APP_NUMBER,
'APP_UID' => $delegation1->APP_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'USR_UID' => $delegation1->USR_UID,
'USR_ID' => $delegation1->USR_ID,
'DEL_PREVIOUS' => $delegation1->DEL_INDEX,
'DEL_INDEX' => $delegation1->DEL_INDEX++
'DEL_INDEX' => $faker->unique()->numberBetween(2000),
]);
// Return with default values
return [
'APP_DELAY_UID' => G::generateUniqueID(),
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID,
'APP_UID' => $application->APP_UID,
'APP_NUMBER' => $application->APP_NUMBER,
'APP_DEL_INDEX' => $delegation->DEL_INDEX,
'PRO_UID' => $delegation2->PRO_UID,
'PRO_ID' => $delegation2->PRO_ID,
'APP_UID' => $delegation2->APP_UID,
'APP_NUMBER' => $delegation2->APP_NUMBER,
'APP_DEL_INDEX' => $delegation2->DEL_INDEX,
'APP_TYPE' => 'PAUSE',
'APP_STATUS' => $application->APP_STATUS,
'APP_DELEGATION_USER' => $user->USR_UID,
'APP_DELEGATION_USER_ID' => $user->USR_ID,
'APP_STATUS' => 'TO_DO',
'APP_DELEGATION_USER' => $delegation2->USR_UID,
'APP_DELEGATION_USER_ID' => $delegation2->USR_ID,
'APP_ENABLE_ACTION_USER' => G::generateUniqueID(),
'APP_ENABLE_ACTION_DATE' => $faker->dateTime(),
'APP_DISABLE_ACTION_USER' => 0,

View File

@@ -0,0 +1,26 @@
<?php
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\CaseList::class, function (Faker $faker) {
return [
'CAL_ID' => $faker->unique()->numberBetween(1, 2000),
'CAL_TYPE' => 'inbox',
'CAL_NAME' => $faker->title,
'CAL_DESCRIPTION' => $faker->text,
'ADD_TAB_UID' => function () {
$table = factory(\ProcessMaker\Model\AdditionalTables::class)->create();
return $table->ADD_TAB_UID;
},
'CAL_COLUMNS' => '[]',
'USR_ID' => function () {
$user = factory(\ProcessMaker\Model\User::class)->create();
return $user->USR_ID;
},
'CAL_ICON_LIST' => 'deafult.png',
'CAL_ICON_COLOR' => 'red',
'CAL_ICON_COLOR_SCREEN' => 'blue',
'CAL_CREATE_DATE' => $faker->dateTime(),
'CAL_UPDATE_DATE' => $faker->dateTime()
];
});

View File

@@ -69,7 +69,7 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function
return [
'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID,
'DEL_INDEX' => 1,
'DEL_INDEX' => $faker->unique()->numberBetween(2000),
'APP_NUMBER' => $application->APP_NUMBER,
'DEL_PREVIOUS' => 0,
'PRO_UID' => $process->PRO_UID,
@@ -176,7 +176,17 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker
// Create a last delegation
$factory->state(\ProcessMaker\Model\Delegation::class, 'last_thread', function (Faker $faker) {
return [
'DEL_LAST_INDEX' => 1,
];
});
// Create a first delegation
$factory->state(\ProcessMaker\Model\Delegation::class, 'first_thread', function (Faker $faker) {
return [
'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0,
];
});

View File

@@ -1,6 +1,6 @@
import ApiInstance from "./Api.js";
import Services from "./Services";
let Api = new ApiInstance( Services );
let Api = new ApiInstance(Services);
export let process = {
list: {
@@ -12,5 +12,13 @@ export let process = {
keys: {}
});
}
},
categories(dt) {
return Api.fetch({
service: "CATEGORIES",
method: "get",
data: dt,
keys: {}
});
}
};

View File

@@ -15,9 +15,18 @@
:column="column"
:headings="options.headings"
></slot>
<slot
name="send_by"
:item="item"
column="send_by"
:headings="options.headings"
></slot>
</b-col>
<b-col sm="3">
<slot name="actions"></slot>
<slot
name="actions"
:item="item"
></slot>
</b-col>
</b-row>
</vue-card>
@@ -45,12 +54,20 @@ export default {
};
},
mounted() {
this.filterOptions();
},
methods: {
classBtn(cls) {
return "btn btn-slim btn-force-radius v-btn-header " + cls;
},
/**
* Filter the column send_by
*/
filterOptions() {
this.options.columns = this.options.columns.filter(function(item) {
return item !== "send_by";
});
}
},
};
</script>

View File

@@ -7,7 +7,7 @@
>
<vue-list v-for="item in data" :key="item.id" :item="item" :options="options">
<b-row>
<b-col sm="10">
<b-col sm="5">
<slot
v-for="column in options.columns"
:name="column"
@@ -17,8 +17,19 @@
ref="containerList"
></slot>
</b-col>
<b-col sm="5">
<slot
name="send_by"
:item="item"
column="send_by"
:headings="options.headings"
></slot>
</b-col>
<b-col sm="2">
<slot name="actions"></slot>
<slot
name="actions"
:item="item"
></slot>
</b-col>
</b-row>
</vue-list>
@@ -46,12 +57,20 @@ export default {
};
},
mounted() {
this.filterOptions();
},
methods: {
classBtn(cls) {
return "btn btn-slim btn-force-radius v-btn-header " + cls;
},
/**
* Filter the column send_by
*/
filterOptions() {
this.options.columns = this.options.columns.filter(function(item) {
return item !== "send_by";
});
}
},
};
</script>

View File

@@ -69,7 +69,7 @@ export default {
.ellipsis {
white-space: nowrap;
width: 140px;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
}

View File

@@ -0,0 +1,71 @@
<template>
<div class="grouped-cell">
<div class="d-flex justify-content-center avatar" id="user">
<b-avatar
variant="info"
:src="data.userAvatar"
size="2em"
></b-avatar>
</div>
<b-popover
target="user"
placement="top"
ref="popover"
triggers="hover"
>
<b-row >
<b-col md="3">
<b-avatar
variant="info"
:src="data.userAvatar"
size="4em"
></b-avatar>
</b-col>
<b-col md="9">
<div class="font-weight-bold">{{data.userInfo}}</div>
<div v-if="data.userPosition !== ''">{{data.userPosition}}</div>
<b-link :href="mailto(data.userEmail)" >{{data.userEmail}}</b-link>
</b-col>
</b-row>
</b-popover>
</div>
</template>
<script>
export default {
name: "OwnerCell",
props: ["data"],
data() {
return {
//Color map for ["In Progress", "overdue", "inDraft", "paused", "unnasigned"]
colorMap: ["green", "red", "orange", "aqua", "silver"],
id: "avatar-" + _.random(1000000),
statusId: "status-" + _.random(1000000)
};
},
methods: {
/**
* Mail to link
* @param {string} email
* @returns {string}
*/
mailto: function(email) {
return "mailto:" + email;
}
}
};
</script>
<style>
.popover {
max-width: 600px !important;
min-width: 200px !important;
}
.grouped-cell {
font-size: small;
}
.avatar {
color: "red";
width: "1.3em";
}
</style>

View File

@@ -40,6 +40,9 @@
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
<div slot="send_by" slot-scope="props">
<CurrentUserCell :data="props.row.USER_DATA" />
</div>
<div slot="current_user" slot-scope="props">
{{ props.row.USERNAME_DISPLAY_FORMAT }}
</div>
@@ -69,7 +72,7 @@
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
@@ -120,7 +123,14 @@
<TaskCell :data="props.item.TASK" />
</span>
</div>
<div slot="send_by" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light">
<CurrentUserCell :data="props.item.USER_DATA" />
</span>
</div>
</VueCardView>
<VueListView
v-if="typeView === 'LIST'"
@@ -135,7 +145,7 @@
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
@@ -186,6 +196,14 @@
<TaskCell :data="props.item.TASK" />
</span>
</div>
<div slot="send_by" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light">
<CurrentUserCell :data="props.item.USER_DATA" />
</span>
</div>
</VueListView>
</div>
</template>
@@ -205,7 +223,7 @@ import defaultMixins from "./defaultMixins";
import Ellipsis from '../../components/utils/ellipsis.vue';
import ModalPauseCase from '../modal/ModalPauseCase.vue';
import ModalReassignCase from '../modal/ModalReassignCase.vue';
import CurrentUserCell from "../../components/vuetable/CurrentUserCell.vue";
export default {
name: "Todo",
@@ -222,6 +240,7 @@ export default {
Ellipsis,
ModalPauseCase,
ModalReassignCase,
CurrentUserCell,
},
props: ["defaultOption", "filters"],
data() {
@@ -240,6 +259,7 @@ export default {
"case_title",
"process_name",
"task",
"send_by",
"due_date",
"delegation_date",
"priority",
@@ -254,6 +274,7 @@ export default {
case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY"),
@@ -455,6 +476,7 @@ export default {
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : "",
},
],
USER_DATA: this.formatUser(v.SEND_BY_INFO),
USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({
userName: v.USR_LASTNAME,
firstName: v.USR_LASTNAME,
@@ -472,6 +494,30 @@ export default {
});
return data;
},
/**
* Set the format to show user's information
* @return {array} dataFormat
*/
formatUser(data) {
var dataFormat = [],
userDataFormat;
userDataFormat = utils.userNameDisplayFormat({
userName: data.user_tooltip.usr_firstname,
firstName: data.user_tooltip.usr_lastname,
lastName: data.user_tooltip.usr_username,
format: window.config.FORMATS.format || null
});
dataFormat.push({
USERNAME_DISPLAY_FORMAT: userDataFormat,
EMAIL: data.user_tooltip.usr_email,
POSITION: data.user_tooltip.usr_position,
AVATAR: userDataFormat !== "" ? window.config.SYS_SERVER_AJAX +
window.config.SYS_URI +
`users/users_ViewPhotoGrid?pUID=${data.user_tooltip.user_id}` : "",
UNASSIGNED: userDataFormat !== "" ? true : false
});
return dataFormat;
},
/**
* Open selected cases in the inbox
*

View File

@@ -40,25 +40,25 @@ export default {
this.openCase(item);
},
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"),
send_by: this.$i18n.t("ID_SEND_BY"),
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"
"task",
"send_by",
],
requestFunction(data) {
return that.getCases(data);

View File

@@ -38,6 +38,9 @@
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
<div slot="send_by" slot-scope="props">
<CurrentUserCell :data="props.row.USER_DATA" />
</div>
<div slot="current_user" slot-scope="props">
{{ props.row.USERNAME_DISPLAY_FORMAT }}
</div>
@@ -67,7 +70,7 @@
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
@@ -118,7 +121,14 @@
<TaskCell :data="props.item.TASK" />
</span>
</div>
<div slot="send_by" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light">
<CurrentUserCell :data="props.item.USER_DATA" />
</span>
</div>
</VueCardView>
<VueListView
v-if="typeView === 'LIST'"
@@ -133,7 +143,7 @@
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
@@ -184,6 +194,14 @@
<TaskCell :data="props.item.TASK" />
</span>
</div>
<div slot="send_by" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light">
<CurrentUserCell :data="props.item.USER_DATA" />
</span>
</div>
</VueListView>
<ModalUnpauseCase ref="modal-unpause-case"></ModalUnpauseCase>
</div>
@@ -204,6 +222,7 @@ import VueListView from "../../components/dataViews/vueListView/VueListView.vue"
import defaultMixins from "./defaultMixins";
import Ellipsis from '../../components/utils/ellipsis.vue';
import ModalReassignCase from '../modal/ModalReassignCase.vue';
import CurrentUserCell from "../../components/vuetable/CurrentUserCell.vue";
export default {
name: "Paused",
@@ -220,6 +239,7 @@ export default {
VueCardView,
VueListView,
ModalReassignCase,
CurrentUserCell,
},
props: ["defaultOption", "filters"],
data() {
@@ -238,6 +258,7 @@ export default {
"case_title",
"process_name",
"task",
"send_by",
"due_date",
"delegation_date",
"priority",
@@ -252,6 +273,7 @@ export default {
case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY"),
@@ -449,6 +471,7 @@ export default {
this.$i18n.t("ID_DELAYED") + ":" : this.statusTitle[v.TAS_STATUS],
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : ""
}],
USER_DATA: this.formatUser(v.SEND_BY_INFO),
USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({
userName: v.USR_LASTNAME,
firstName: v.USR_LASTNAME,
@@ -466,6 +489,30 @@ export default {
});
return data;
},
/**
* Set the format to show user's information
* @return {array} dataFormat
*/
formatUser(data) {
var dataFormat = [],
userDataFormat;
userDataFormat = utils.userNameDisplayFormat({
userName: data.user_tooltip.usr_firstname,
firstName: data.user_tooltip.usr_lastname,
lastName: data.user_tooltip.usr_username,
format: window.config.FORMATS.format || null
});
dataFormat.push({
USERNAME_DISPLAY_FORMAT: userDataFormat,
EMAIL: data.user_tooltip.usr_email,
POSITION: data.user_tooltip.usr_position,
AVATAR: userDataFormat !== "" ? window.config.SYS_SERVER_AJAX +
window.config.SYS_URI +
`users/users_ViewPhotoGrid?pUID=${data.user_tooltip.user_id}` : "",
UNASSIGNED: userDataFormat !== "" ? true : false
});
return dataFormat;
},
/**
* Open selected cases in the inbox
*

View File

@@ -39,25 +39,25 @@ export default {
this.openCase(item);
},
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"),
send_by: this.$i18n.t("ID_SEND_BY"),
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"
"task",
"send_by",
],
requestFunction(data) {
return that.getCases(data);

View File

@@ -36,6 +36,9 @@
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
<div slot="send_by" slot-scope="props">
<CurrentUserCell :data="props.row.USER_DATA" />
</div>
<div slot="due_date" slot-scope="props">
{{ props.row.DUE_DATE }}
</div>
@@ -62,7 +65,7 @@
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
@@ -113,6 +116,14 @@
<TaskCell :data="props.item.TASK" />
</span>
</div>
<div slot="send_by" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light">
<CurrentUserCell :data="props.item.USER_DATA" />
</span>
</div>
</VueCardView>
<VueListView
v-if="typeView === 'LIST'"
@@ -127,7 +138,7 @@
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
@@ -178,6 +189,14 @@
<TaskCell :data="props.item.TASK" />
</span>
</div>
<div slot="send_by" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light">
<CurrentUserCell :data="props.item.USER_DATA" />
</span>
</div>
</VueListView>
<ModalClaimCase ref="modal-claim-case"></ModalClaimCase>
<ModalPauseCase ref="modal-pause-case"></ModalPauseCase>
@@ -199,6 +218,7 @@ import VueCardView from "../../components/dataViews/vueCardView/VueCardView.vue"
import VueListView from "../../components/dataViews/vueListView/VueListView.vue";
import defaultMixins from "./defaultMixins";
import ModalPauseCase from '../modal/ModalPauseCase.vue';
import CurrentUserCell from "../../components/vuetable/CurrentUserCell.vue";
export default {
name: "Unassigned",
@@ -215,6 +235,7 @@ export default {
VueCardView,
VueListView,
ModalPauseCase,
CurrentUserCell,
},
props: ["defaultOption", "filters"],
data() {
@@ -233,6 +254,7 @@ export default {
"case_title",
"process_name",
"task",
"send_by",
"due_date",
"delegation_date",
"priority",
@@ -246,6 +268,7 @@ export default {
case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY"),
@@ -413,6 +436,7 @@ export default {
this.$i18n.t("ID_DELAYED") + ":" : this.statusTitle[v.TAS_STATUS],
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : ""
}],
USER_DATA: this.formatUser(v.SEND_BY_INFO),
DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL,
DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL,
PRIORITY: v.DEL_PRIORITY_LABEL,
@@ -424,6 +448,30 @@ export default {
});
return data;
},
/**
* Set the format to show user's information
* @return {array} dataFormat
*/
formatUser(data) {
var dataFormat = [],
userDataFormat;
userDataFormat = utils.userNameDisplayFormat({
userName: data.user_tooltip.usr_firstname,
firstName: data.user_tooltip.usr_lastname,
lastName: data.user_tooltip.usr_username,
format: window.config.FORMATS.format || null
});
dataFormat.push({
USERNAME_DISPLAY_FORMAT: userDataFormat,
EMAIL: data.user_tooltip.usr_email,
POSITION: data.user_tooltip.usr_position,
AVATAR: userDataFormat !== "" ? window.config.SYS_SERVER_AJAX +
window.config.SYS_URI +
`users/users_ViewPhotoGrid?pUID=${data.user_tooltip.user_id}` : "",
UNASSIGNED: userDataFormat !== "" ? true : false
});
return dataFormat;
},
/**
* Claim case
*

View File

@@ -39,25 +39,25 @@ export default {
this.openCase(item);
},
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"),
send_by: this.$i18n.t("ID_SEND_BY"),
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"
"task",
"send_by",
],
requestFunction(data) {
return that.getCases(data);

View File

@@ -5,7 +5,9 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Draft;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\User;
@@ -354,6 +356,7 @@ class DraftTest extends TestCase
* It tests the getCountersByProcesses() method with the category filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByProcesses()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCountersByProcesses()
* @test
*/
public function it_should_test_get_counters_by_processes_method_category()
@@ -643,6 +646,7 @@ class DraftTest extends TestCase
* It tests the getCountersByRange() method
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByRange()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCountersByProcesses()
* @test
*/
public function it_should_test_get_counters_by_range_method()
@@ -717,4 +721,49 @@ class DraftTest extends TestCase
$res = $draft->getCountersByRange(null, '2021-05-20', '2021-05-22');
$this->assertCount(3, $res);
}
/**
* This tests the getCustomListCount() method.
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCustomListCount()
* @test
*/
public function it_should_test_getCustomListCount_method()
{
$cases = $this->createManyDraft(3);
$additionalTables = factory(AdditionalTables::class)->create();
$query = ""
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
. "`APP_UID` varchar(32) NOT NULL,"
. "`APP_NUMBER` int(11) NOT NULL,"
. "`APP_STATUS` varchar(10) NOT NULL,"
. "`VAR1` varchar(255) DEFAULT NULL,"
. "`VAR2` varchar(255) DEFAULT NULL,"
. "`VAR3` varchar(255) DEFAULT NULL,"
. "PRIMARY KEY (`APP_UID`),"
. "KEY `indexTable` (`APP_UID`))";
DB::statement($query);
$caseList = factory(CaseList::class)->create([
'CAL_TYPE' => 'draft',
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
'USR_ID' => $cases->USR_ID
]);
$draft = new Draft();
$draft->setUserId($cases->USR_ID);
$draft->setUserUid($cases->USR_UID);
$res = $draft->getCustomListCount($caseList->CAL_ID, 'draft');
//assertions
$this->assertArrayHasKey('label', $res);
$this->assertArrayHasKey('name', $res);
$this->assertArrayHasKey('description', $res);
$this->assertArrayHasKey('tableName', $res);
$this->assertArrayHasKey('total', $res);
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
$this->assertEquals(3, $res['total']);
}
}

View File

@@ -5,7 +5,9 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Inbox;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
@@ -199,6 +201,7 @@ class InboxTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\Model\Delegation::scopeTask()
* @test
*/
public function it_filter_by_task()
@@ -611,4 +614,49 @@ class InboxTest extends TestCase
$res = $inbox->getCountersByRange(null, '2021-05-20', '2021-05-23');
$this->assertCount(1, $res);
}
/**
* This tests the getCustomListCount() method.
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCustomListCount()
* @test
*/
public function it_should_test_getCustomListCounts_method()
{
$cases = $this->createMultipleInbox(3);
$additionalTables = factory(AdditionalTables::class)->create();
$query = ""
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
. "`APP_UID` varchar(32) NOT NULL,"
. "`APP_NUMBER` int(11) NOT NULL,"
. "`APP_STATUS` varchar(10) NOT NULL,"
. "`VAR1` varchar(255) DEFAULT NULL,"
. "`VAR2` varchar(255) DEFAULT NULL,"
. "`VAR3` varchar(255) DEFAULT NULL,"
. "PRIMARY KEY (`APP_UID`),"
. "KEY `indexTable` (`APP_UID`))";
DB::statement($query);
$caseList = factory(CaseList::class)->create([
'CAL_TYPE' => 'inbox',
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
'USR_ID' => $cases->USR_ID
]);
$inbox = new Inbox();
$inbox->setUserId($cases->USR_ID);
$inbox->setUserUid($cases->USR_UID);
$res = $inbox->getCustomListCount($caseList->CAL_ID, 'inbox');
//assertions
$this->assertArrayHasKey('label', $res);
$this->assertArrayHasKey('name', $res);
$this->assertArrayHasKey('description', $res);
$this->assertArrayHasKey('tableName', $res);
$this->assertArrayHasKey('total', $res);
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
$this->assertEquals(3, $res['total']);
}
}

View File

@@ -5,8 +5,10 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Paused;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\AppDelay;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
@@ -606,4 +608,49 @@ class PausedTest extends TestCase
$res = $paused->getCountersByRange(null, '2021-05-20', '2021-05-23');
$this->assertCount(1, $res);
}
/**
* This tests the getCustomListCount() method.
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCustomListCount()
* @test
*/
public function it_should_test_getCustomListCounts_method()
{
$cases = $this->createMultiplePaused(3);
$additionalTables = factory(AdditionalTables::class)->create();
$query = ""
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
. "`APP_UID` varchar(32) NOT NULL,"
. "`APP_NUMBER` int(11) NOT NULL,"
. "`APP_STATUS` varchar(10) NOT NULL,"
. "`VAR1` varchar(255) DEFAULT NULL,"
. "`VAR2` varchar(255) DEFAULT NULL,"
. "`VAR3` varchar(255) DEFAULT NULL,"
. "PRIMARY KEY (`APP_UID`),"
. "KEY `indexTable` (`APP_UID`))";
DB::statement($query);
$caseList = factory(CaseList::class)->create([
'CAL_TYPE' => 'paused',
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
'USR_ID' => $cases->USR_ID
]);
$paused = new Paused();
$paused->setUserId($cases->USR_ID);
$paused->setUserUid($cases->USR_UID);
$res = $paused->getCustomListCount($caseList->CAL_ID, 'paused');
//assertions
$this->assertArrayHasKey('label', $res);
$this->assertArrayHasKey('name', $res);
$this->assertArrayHasKey('description', $res);
$this->assertArrayHasKey('tableName', $res);
$this->assertArrayHasKey('total', $res);
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
$this->assertEquals(3, $res['total']);
}
}

View File

@@ -5,9 +5,11 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\AppAssignSelfServiceValue;
use ProcessMaker\Model\AppAssignSelfServiceValueGroup;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\GroupUser;
use ProcessMaker\Model\Groupwf;
@@ -657,4 +659,68 @@ class UnassignedTest extends TestCase
$res = $unassigned->getCountersByRange(null, '2021-05-20', '2021-05-23');
$this->assertCount(1, $res);
}
/**
* It tests the getCustomListCount() method
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCustomListCount()
* @test
*/
public function it_should_test_getCustomListCount_method()
{
$cases = $this->createMultipleUnassigned(0);
$additionalTables = factory(AdditionalTables::class)->create();
$query = ""
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
. "`APP_UID` varchar(32) NOT NULL,"
. "`APP_NUMBER` int(11) NOT NULL,"
. "`APP_STATUS` varchar(10) NOT NULL,"
. "`VAR1` varchar(255) DEFAULT NULL,"
. "`VAR2` varchar(255) DEFAULT NULL,"
. "`VAR3` varchar(255) DEFAULT NULL,"
. "PRIMARY KEY (`APP_UID`),"
. "KEY `indexTable` (`APP_UID`))";
DB::statement($query);
$caseList = factory(CaseList::class)->create([
'CAL_TYPE' => 'unassigned',
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
'USR_ID' => $cases->USR_ID
]);
$unassigned = new Unassigned();
$unassigned->setUserId($cases->USR_ID);
$unassigned->setUserUid($cases->USR_UID);
$res = $unassigned->getCustomListCount($caseList->CAL_ID, 'unassigned');
//assertions
$this->assertArrayHasKey('label', $res);
$this->assertArrayHasKey('name', $res);
$this->assertArrayHasKey('description', $res);
$this->assertArrayHasKey('tableName', $res);
$this->assertArrayHasKey('total', $res);
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
$this->assertEquals(0, $res['total']);
//for user or group
$cases = $this->createSelfServiceUserOrGroup();
$unassigned = new Unassigned();
$unassigned->setUserUid($cases['taskUser']->USR_UID);
$unassigned->setUserId($cases['delegation']->USR_ID);
$res = $unassigned->getCustomListCount($caseList->CAL_ID, 'unassigned');
//assertions
$this->assertArrayHasKey('label', $res);
$this->assertArrayHasKey('name', $res);
$this->assertArrayHasKey('description', $res);
$this->assertArrayHasKey('tableName', $res);
$this->assertArrayHasKey('total', $res);
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
$this->assertEquals(0, $res['total']);
}
}

View File

@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel;
use Exception;
use G;
use Illuminate\Support\Facades\DB;
use ProcessMaker\Model\AppDelay;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Documents;
@@ -380,4 +381,45 @@ class CasesTest extends TestCase
// Get DynaForms assigned as steps for the second task when the application status is COMPLETED
self::assertCount(1, Cases::dynaFormsByApplication($application->APP_UID, $task2->TAS_UID, '', 'COMPLETED'));
}
/**
* It test the case info used in the PMFCaseLink
*
* @covers \ProcessMaker\BusinessModel\Cases::getStatusInfo()
* @covers \ProcessMaker\Model\AppDelay::getPaused()
* @test
*/
public function it_should_test_case_status_info()
{
// Get status info when the case is PAUSED
$table = factory(AppDelay::class)->states('paused_foreign_keys')->create();
$cases = new Cases();
$result = $cases->getStatusInfo($table->APP_UID, $table->APP_DEL_INDEX, $table->APP_DELEGATION_USER);
$this->assertNotEmpty($result);
$this->assertArrayHasKey('APP_STATUS', $result);
$this->assertArrayHasKey('DEL_INDEX', $result);
$this->assertArrayHasKey('PRO_UID', $result);
// Get status info when the case is UNASSIGNED
// Get status info when the case is TO_DO
$table = factory(Delegation::class)->states('foreign_keys')->create();
$cases = new Cases();
$result = $cases->getStatusInfo($table->APP_UID, $table->DEL_INDEX, $table->USR_UID);
$this->assertNotEmpty($result);
$this->assertArrayHasKey('APP_STATUS', $result);
$this->assertArrayHasKey('DEL_INDEX', $result);
$this->assertArrayHasKey('PRO_UID', $result);
// Get status info when the case is COMPLETED
$table = factory(Application::class)->states('completed')->create();
$table = factory(Delegation::class)->states('foreign_keys')->create([
'APP_NUMBER' => $table->APP_NUMBER,
'APP_UID' => $table->APP_UID,
]);
$cases = new Cases();
$result = $cases->getStatusInfo($table->APP_UID, $table->DEL_INDEX, $table->USR_UID);
$this->assertNotEmpty($result);
$this->assertArrayHasKey('APP_STATUS', $result);
$this->assertArrayHasKey('DEL_INDEX', $result);
$this->assertArrayHasKey('PRO_UID', $result);
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace ProcessMaker\BusinessModel;
use ProcessMaker\BusinessModel\Table;
use ProcessMaker\Model\AdditionalTables;
use Tests\TestCase;
class TableTest extends TestCase
{
/**
* Method setUp.
*/
public function setUp()
{
parent::setUp();
AdditionalTables::truncate();
}
/**
* Method tearDown.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* This test getTables() method.
* @test
* @covers \ProcessMaker\BusinessModel\Table::getTables()
*/
public function it_should_test_getTables_method()
{
$additionalTables = factory(AdditionalTables::class)
->create();
$proUid = $additionalTables->PRO_UID;
$search = $additionalTables->ADD_TAB_NAME;
$table = new Table();
$result = $table->getTables($proUid, true, false, $search);
//assertions
$this->assertNotEmpty($result);
$this->assertEquals($additionalTables->ADD_TAB_NAME, $result[0]['rep_tab_name']);
$search = '';
$table = new Table();
$result = $table->getTables($proUid, true, false, $search);
//assertions
$this->assertNotEmpty($result);
$this->assertEquals($additionalTables->ADD_TAB_NAME, $result[0]['rep_tab_name']);
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\AppDelay;
use Tests\TestCase;
/**
* Class AppDelayTest
*
* @coversDefaultClass \ProcessMaker\Model\AppDelay
*/
class AppDelayTest extends TestCase
{
use DatabaseTransactions;
/**
* Set up function.
*/
public function setUp()
{
parent::setUp();
AppDelay::truncate();
}
/**
* This test scopeType
*
* @covers \ProcessMaker\Model\AppDelay::scopeType()
* @test
*/
public function it_return_scope_type()
{
$table = factory(AppDelay::class)->states('paused_foreign_keys')->create();
$this->assertCount(1, $table->type('PAUSE')->get());
}
/**
* This test scopeNotDisabled
*
* @covers \ProcessMaker\Model\AppDelay::scopeNotDisabled()
* @test
*/
public function it_return_scope_not_action_disable()
{
$table = factory(AppDelay::class)->states('paused_foreign_keys')->create();
$this->assertCount(1, $table->notDisabled()->get());
}
/**
* This test scopeCase
*
* @covers \ProcessMaker\Model\AppDelay::scopeCase()
* @test
*/
public function it_return_scope_case()
{
$table = factory(AppDelay::class)->states('paused_foreign_keys')->create();
$this->assertCount(1, $table->case($table->APP_NUMBER)->get());
}
/**
* This test scopeIndex
*
* @covers \ProcessMaker\Model\AppDelay::scopeIndex()
* @test
*/
public function it_return_scope_index()
{
$table = factory(AppDelay::class)->states('paused_foreign_keys')->create();
$this->assertCount(1, $table->index($table->APP_DEL_INDEX)->get());
}
/**
* This test scopeDelegateUser
*
* @covers \ProcessMaker\Model\AppDelay::scopeDelegateUser()
* @test
*/
public function it_return_scope_delegate_user()
{
$table = factory(AppDelay::class)->states('paused_foreign_keys')->create();
$this->assertCount(1, $table->delegateUser($table->APP_DELEGATION_USER)->get());
}
/**
* This test getPaused
*
* @covers \ProcessMaker\Model\AppDelay::getPaused()
* @covers \ProcessMaker\Model\AppDelay::scopeCase()
* @covers \ProcessMaker\Model\AppDelay::scopeIndex()
* @covers \ProcessMaker\Model\AppDelay::scopeDelegateUser()
* @test
*/
public function it_return_paused_threads()
{
$table = factory(AppDelay::class)->states('paused_foreign_keys')->create();
$result = AppDelay::getPaused($table->APP_NUMBER, $table->APP_DEL_INDEX, $table->APP_DELEGATION_USER);
$this->assertNotEmpty($result);
}
}

View File

@@ -170,7 +170,7 @@ class DelegationTest extends TestCase
*/
public function it_return_scope_case_started()
{
$table = factory(Delegation::class)->states('foreign_keys')->create();
$table = factory(Delegation::class)->states('first_thread')->create();
$this->assertCount(1, $table->caseStarted($table->DEL_INDEX)->get());
}
@@ -532,7 +532,7 @@ class DelegationTest extends TestCase
{
$table = factory(Delegation::class)->states('foreign_keys')->create();
$cases = [$table->APP_NUMBER];
$rangeCases = [$table->APP_NUMBER.'-'.$table->APP_NUMBER];
$rangeCases = [$table->APP_NUMBER . '-' . $table->APP_NUMBER];
$this->assertCount(1, $table->casesOrRangeOfCases($cases, $rangeCases)->get());
}
@@ -2150,6 +2150,8 @@ class DelegationTest extends TestCase
//Review the self-service records
$result = Delegation::getSelfService($user->USR_UID);
$this->assertEquals(25, count($result));
$result = Delegation::getSelfService($user->USR_UID, ['APP_DELEGATION.APP_NUMBER', 'APP_DELEGATION.DEL_INDEX'], null, null,null, null, null, 0, 15);
$this->assertEquals(15, count($result));
}
/**
@@ -3369,7 +3371,7 @@ class DelegationTest extends TestCase
*/
public function it_get_cases_started_by_specific_user()
{
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
$delegation = factory(Delegation::class)->states('first_thread')->create();
$result = Delegation::casesStartedBy($delegation->USR_ID);
$this->assertNotEmpty($result);
}

View File

@@ -4493,6 +4493,12 @@ msgstr "City"
msgid "Claim"
msgstr "Claim"
# TRANSLATION
# LABEL/ID_CLAIM_THIS_CASE
#: LABEL/ID_CLAIM_THIS_CASE
msgid "Claim this case"
msgstr "Claim this case"
# TRANSLATION
# LABEL/ID_CLASSIC_EDITOR
#: LABEL/ID_CLASSIC_EDITOR
@@ -24671,6 +24677,12 @@ msgstr "An error has occurred, please verify on which server \"SendMail\" has be
msgid "send at"
msgstr "send at"
# TRANSLATION
# LABEL/ID_SEND_BY
#: LABEL/ID_SEND_BY
msgid "Send By"
msgstr "Send By"
# TRANSLATION
# LABEL/ID_SEND_EMAIL_CASE_PARTICIPANTS
#: LABEL/ID_SEND_EMAIL_CASE_PARTICIPANTS

View File

@@ -57561,6 +57561,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_CITY','en','City','2020-12-15') ,
( 'LABEL','ID_CHOOSE_TIME','en','Choose a time','2014-08-27') ,
( 'LABEL','ID_CLAIM','en','Claim','2014-01-15') ,
( 'LABEL','ID_CLAIM_THIS_CASE','en','Claim this case','2021-08-03') ,
( 'LABEL','ID_CLASSIC_EDITOR','en','Classic Editor','2014-01-15') ,
( 'LABEL','ID_CLASS_ALREADY_EXISTS','en','Class already exists','2014-01-15') ,
( 'LABEL','ID_CLASS_TABLE_DOESNT_EXIST','en','This Class Table doesn''t exist!','2014-01-15') ,
@@ -61026,6 +61027,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_SENDING_REQUEST_SALES_DEPARTMENT','en','Sending request to ProcessMaker Sales Department, please wait...','2014-09-18') ,
( 'LABEL','ID_SENDMAIL_NOT_INSTALLED','en','An error has occured, please verify on which server "SendMail" has been installed or any other mail service, and if it has been configured correctly.','2014-01-15') ,
( 'LABEL','ID_SEND_AT','en','send at','2014-01-15') ,
( 'LABEL','ID_SEND_BY','en','Send By','2021-08-02') ,
( 'LABEL','ID_SEND_EMAIL_CASE_PARTICIPANTS','en','Send Email (Case Participants)','2014-01-15') ,
( 'LABEL','ID_SEND_EMAIL_TO_PARTICIPANTS','en','Send email to participants','2020-12-01') ,
( 'LABEL','ID_SENT','en','Participated','2016-07-11') ,

View File

@@ -46,6 +46,7 @@ use ProcessMaker\BusinessModel\User as BmUser;
use ProcessMaker\Core\System;
use ProcessMaker\Exception\UploadException;
use ProcessMaker\Exception\CaseNoteUploadFile;
use ProcessMaker\Model\AppDelay as Delay;
use ProcessMaker\Model\Application as ModelApplication;
use ProcessMaker\Model\AppNotes as Notes;
use ProcessMaker\Model\AppTimeoutAction;
@@ -2456,33 +2457,25 @@ class Cases
/**
* This function get the status information
*
* @param object $rsCriteria
* @param array $result
* @param string $status
*
* @return array
* @throws Exception
*/
private function getStatusInfoDataByRsCriteria($rsCriteria)
private function getStatusInfoFormatted(array $result, string $status = '')
{
try {
$arrayData = [];
if ($rsCriteria->next()) {
$record = $rsCriteria->getRow();
$arrayData = [
'APP_STATUS' => $record['APP_STATUS'],
'DEL_INDEX' => [],
'PRO_UID' => $record['PRO_UID']
];
$record = head($result);
$arrayData = [
'APP_STATUS' => empty($status) ? $record['APP_STATUS'] : $status,
'DEL_INDEX' => [],
'PRO_UID' => $record['PRO_UID']
];
$arrayData['DEL_INDEX'][] = $record['DEL_INDEX'];
foreach ($result as $record) {
$arrayData['DEL_INDEX'][] = $record['DEL_INDEX'];
while ($rsCriteria->next()) {
$record = $rsCriteria->getRow();
$arrayData['DEL_INDEX'][] = $record['DEL_INDEX'];
}
}
//Return
return $arrayData;
} catch (Exception $e) {
@@ -2493,8 +2486,8 @@ class Cases
/**
* Get status info Case
*
* @param string $applicationUid Unique id of Case
* @param int $delIndex Delegation index
* @param string $appUid Unique id of Case
* @param int $index Delegation index
* @param string $userUid Unique id of User
*
* @return array Return an array with status info Case, array empty otherwise
@@ -2502,179 +2495,120 @@ class Cases
*
* @see workflow/engine/methods/cases/main_init.php
* @see workflow/engine/methods/cases/opencase.php
* @see ProcessMaker\BusinessModel\Cases->setCaseVariables()
* @see ProcessMaker\BusinessModel\Cases\InputDocument->getCasesInputDocuments()
* @see ProcessMaker\BusinessModel\Cases\InputDocument->throwExceptionIfHaventPermissionToDelete()
* @see ProcessMaker\BusinessModel\Cases\OutputDocument->throwExceptionIfCaseNotIsInInbox()
* @see ProcessMaker\BusinessModel\Cases\OutputDocument->throwExceptionIfHaventPermissionToDelete()
* @see \ProcessMaker\BusinessModel\Cases::setCaseVariables()
* @see \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocuments()
* @see \ProcessMaker\BusinessModel\Cases\InputDocument::throwExceptionIfHaventPermissionToDelete()
* @see \ProcessMaker\BusinessModel\Cases\OutputDocument::throwExceptionIfCaseNotIsInInbox()
* @see \ProcessMaker\BusinessModel\Cases\OutputDocument::throwExceptionIfHaventPermissionToDelete()
*/
public function getStatusInfo($applicationUid, $delIndex = 0, $userUid = "")
public function getStatusInfo(string $appUid, int $index = 0, string $userUid = "")
{
try {
//Verify data
$this->throwExceptionIfNotExistsCase($applicationUid, $delIndex,
$this->getFieldNameByFormatFieldName("APP_UID"));
//Get data
//Status is PAUSED
$delimiter = DBAdapter::getStringDelimiter();
$criteria = new Criteria("workflow");
$criteria->setDistinct();
$criteria->addSelectColumn($delimiter . 'PAUSED' . $delimiter . ' AS APP_STATUS');
$criteria->addSelectColumn(AppDelayPeer::APP_DEL_INDEX . " AS DEL_INDEX");
$criteria->addSelectColumn(AppDelayPeer::PRO_UID);
$criteria->add(AppDelayPeer::APP_UID, $applicationUid, Criteria::EQUAL);
$criteria->add(AppDelayPeer::APP_TYPE, "PAUSE", Criteria::EQUAL);
$criteria->add(
$criteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->addOr(
$criteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0, Criteria::EQUAL))
);
if ($delIndex != 0) {
$criteria->add(AppDelayPeer::APP_DEL_INDEX, $delIndex, Criteria::EQUAL);
$arrayData = [];
// Verify data
$this->throwExceptionIfNotExistsCase($appUid, $index, $this->getFieldNameByFormatFieldName("APP_UID"));
// Get the case number
$caseNumber = ModelApplication::getCaseNumber($appUid);
// Status is PAUSED
$result = Delay::getPaused($caseNumber, $index, $userUid);
if (!empty($result)) {
$arrayData = $this->getStatusInfoFormatted($result, 'PAUSED');
return $arrayData;
}
if ($userUid != "") {
$criteria->add(AppDelayPeer::APP_DELEGATION_USER, $userUid, Criteria::EQUAL);
// Status is UNASSIGNED
$query = Delegation::query()->select([
'APP_DELEGATION.APP_NUMBER',
'APP_DELEGATION.DEL_INDEX',
'APP_DELEGATION.PRO_UID'
]);
$query->taskAssignType('SELF_SERVICE');
$query->threadOpen()->withoutUserId();
// Filter specific user
if (!empty($userUid)) {
$delegation = new Delegation();
$delegation->casesUnassigned($query, $userUid);
}
// Filter specific case
$query->case($caseNumber);
// Filter specific index
if (is_int($index)) {
$query->index($index);
}
$results = $query->get();
$arrayData = $results->values()->toArray();
if (!empty($arrayData)) {
$arrayData = $this->getStatusInfoFormatted($arrayData, 'UNASSIGNED');
return $arrayData;
}
$rsCriteria = AppDelayPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
// Status is TO_DO, DRAFT
$query = Delegation::query()->select([
'APPLICATION.APP_STATUS',
'APP_DELEGATION.APP_NUMBER',
'APP_DELEGATION.DEL_INDEX',
'APP_DELEGATION.PRO_UID'
]);
$query->joinApplication();
// Filter the status TO_DO and DRAFT
$query->casesInProgress([1, 2]);
// Filter the OPEN thread
$query->threadOpen();
// Filter specific case
$query->case($caseNumber);
// Filter specific index
if ($index > 0) {
$query->index($index);
}
// Filter specific user
if (!empty($userUid)) {
$userId = !empty($userUid) ? User::getId($userUid) : 0;
$query->userId($userId);
}
$results = $query->get();
$arrayData = $results->values()->toArray();
$arrayData = $this->getStatusInfoDataByRsCriteria($rsCriteria);
if (!empty($arrayData)) {
$arrayData = $this->getStatusInfoFormatted($arrayData);
return $arrayData;
}
// Status is CANCELLED, COMPLETED
$query = Delegation::query()->select([
'APPLICATION.APP_STATUS',
'APP_DELEGATION.APP_NUMBER',
'APP_DELEGATION.DEL_INDEX',
'APP_DELEGATION.PRO_UID'
]);
$query->joinApplication();
// Filter the status COMPLETED and CANCELLED
$query->casesDone([3, 4]);
// Filter specific case
$query->case($caseNumber);
// Filter specific index
if ($index > 0) {
$query->index($index);
}
// Filter specific user
if (!empty($userUid)) {
$userId = !empty($userUid) ? User::getId($userUid) : 0;
$query->userId($userId);
}
$query->lastThread();
$results = $query->get();
$arrayData = $results->values()->toArray();
if (!empty($arrayData)) {
$arrayData = $this->getStatusInfoFormatted($arrayData);
return $arrayData;
}
// Status is PARTICIPATED
$arrayData = Delegation::getParticipatedInfo($appUid);
if (!empty($arrayData)) {
return $arrayData;
}
//Status is UNASSIGNED
if ($userUid != '') {
$appCacheView = new AppCacheView();
$criteria = $appCacheView->getUnassignedListCriteria($userUid);
} else {
$criteria = new Criteria('workflow');
$criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
$criteria->add(AppCacheViewPeer::USR_UID, '', Criteria::EQUAL);
}
$criteria->setDistinct();
$criteria->clearSelectColumns();
$criteria->addSelectColumn($delimiter . 'UNASSIGNED' . $delimiter . ' AS APP_STATUS');
$criteria->addSelectColumn(AppCacheViewPeer::DEL_INDEX);
$criteria->addSelectColumn(AppCacheViewPeer::PRO_UID);
$criteria->add(AppCacheViewPeer::APP_UID, $applicationUid, Criteria::EQUAL);
if ($delIndex != 0) {
$criteria->add(AppCacheViewPeer::DEL_INDEX, $delIndex, Criteria::EQUAL);
}
$rsCriteria = AppCacheViewPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrayData = $this->getStatusInfoDataByRsCriteria($rsCriteria);
if (!empty($arrayData)) {
return $arrayData;
}
//Status is TO_DO, DRAFT
$criteria = new Criteria("workflow");
$criteria->setDistinct();
$criteria->addSelectColumn(ApplicationPeer::APP_STATUS);
$criteria->addSelectColumn(ApplicationPeer::PRO_UID);
$criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$arrayCondition = array();
$arrayCondition[] = array(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::EQUAL);
$arrayCondition[] = array(
ApplicationPeer::APP_UID,
$delimiter . $applicationUid . $delimiter,
Criteria::EQUAL
);
$criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
$criteria->add(
$criteria->getNewCriterion(ApplicationPeer::APP_STATUS, "TO_DO", Criteria::EQUAL)->addAnd(
$criteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL))->addAnd(
$criteria->getNewCriterion(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))
)->addOr(
$criteria->getNewCriterion(ApplicationPeer::APP_STATUS, "DRAFT", Criteria::EQUAL)->addAnd(
$criteria->getNewCriterion(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))
);
if ($delIndex != 0) {
$criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex, Criteria::EQUAL);
}
if ($userUid != "") {
$criteria->add(AppDelegationPeer::USR_UID, $userUid, Criteria::EQUAL);
}
$rsCriteria = ApplicationPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrayData = $this->getStatusInfoDataByRsCriteria($rsCriteria);
if (!empty($arrayData)) {
return $arrayData;
}
//Status is CANCELLED, COMPLETED
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(ApplicationPeer::APP_STATUS);
$criteria->addSelectColumn(ApplicationPeer::PRO_UID);
$criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$arrayCondition = array();
$arrayCondition[] = array(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::EQUAL);
$arrayCondition[] = array(
ApplicationPeer::APP_UID,
$delimiter . $applicationUid . $delimiter,
Criteria::EQUAL
);
$criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
if ($delIndex != 0) {
$criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex, Criteria::EQUAL);
}
if ($userUid != "") {
$criteria->add(AppDelegationPeer::USR_UID, $userUid, Criteria::EQUAL);
}
$criteria2 = clone $criteria;
$criteria2->setDistinct();
$criteria2->add(ApplicationPeer::APP_STATUS, ['CANCELLED', 'COMPLETED'], Criteria::IN);
$criteria2->add(AppDelegationPeer::DEL_LAST_INDEX, 1, Criteria::EQUAL);
$rsCriteria2 = ApplicationPeer::doSelectRS($criteria2);
$rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrayData = $this->getStatusInfoDataByRsCriteria($rsCriteria2);
if (!empty($arrayData)) {
return $arrayData;
}
//Status is PARTICIPATED
$arrayData = Delegation::getParticipatedInfo($applicationUid);
if (!empty($arrayData)) {
return $arrayData;
}
//Return
return array();
return $arrayData;
} catch (Exception $e) {
throw $e;
}

View File

@@ -1492,8 +1492,7 @@ class AbstractCases implements CasesInterface
/**
* Count how many cases has each process
*
* @param string $list
*
* @param int $category
* @param bool $topTen
* @param array $processes
@@ -1528,7 +1527,7 @@ class AbstractCases implements CasesInterface
$query->topTen('TOTAL', 'DESC');
}
if (!empty($processes)) {
$query->inProcesses($processes);
$query->processInList($processes);
}
return $query->get()->values()->toArray();
}
@@ -1574,7 +1573,7 @@ class AbstractCases implements CasesInterface
}
$query->joinProcess();
if (!is_null($processId)) {
$query->inProcesses([$processId]);
$query->processInList([$processId]);
}
if (!is_null($dateFrom)) {
$query->where('APP_DELEGATION.DEL_DELEGATE_DATE', '>=', $dateFrom);

View File

@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\User;
@@ -166,4 +167,44 @@ class Draft extends AbstractCases
// Return the number of rows
return $query->count(['APP_DELEGATION.APP_NUMBER']);
}
/**
* Returns the total cases of the custom draft list.
* @param int $id
* @param string $type
* @return array
*/
public function getCustomListCount(int $id, string $type): array
{
$caseList = CaseList::where('CAL_ID', '=', $id)
->where('CAL_TYPE', '=', $type)
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
->select([
'CASE_LIST.*',
'ADDITIONAL_TABLES.ADD_TAB_NAME'
])
->get()
->first();
$query = Delegation::query()->select();
$query->draft($this->getUserId());
$name = '';
$description = '';
$tableName = '';
if (!is_null($caseList)) {
$name = $caseList->CAL_NAME;
$description = $caseList->CAL_DESCRIPTION;
$tableName = $caseList->ADD_TAB_NAME;
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
}
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
return [
'label' => G::LoadTranslation('ID_NUMBER_OF_CASES_DRAFT') . $count,
'name' => $name,
'description' => $description,
'tableName' => $tableName,
'total' => $count
];
}
}

View File

@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\User;
@@ -179,4 +180,44 @@ class Inbox extends AbstractCases
// Return the number of rows
return $query->count(['APP_DELEGATION.APP_NUMBER']);
}
/**
* Returns the total cases of the custom inbox list.
* @param int $id
* @param string $type
* @return array
*/
public function getCustomListCount(int $id, string $type): array
{
$caseList = CaseList::where('CAL_ID', '=', $id)
->where('CAL_TYPE', '=', $type)
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
->select([
'CASE_LIST.*',
'ADDITIONAL_TABLES.ADD_TAB_NAME'
])
->get()
->first();
$query = Delegation::query()->select();
$query->inbox($this->getUserId());
$name = '';
$description = '';
$tableName = '';
if (!is_null($caseList)) {
$name = $caseList->CAL_NAME;
$description = $caseList->CAL_DESCRIPTION;
$tableName = $caseList->ADD_TAB_NAME;
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
}
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
return [
'label' => G::LoadTranslation('ID_NUMBER_OF_CASES_INBOX') . $count,
'name' => $name,
'description' => $description,
'tableName' => $tableName,
'total' => $count
];
}
}

View File

@@ -3,6 +3,7 @@
namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\User;
@@ -173,4 +174,44 @@ class Paused extends AbstractCases
// Return the number of rows
return $query->count(['APP_DELEGATION.APP_NUMBER']);
}
/**
* Returns the total cases of the custom paused list.
* @param int $id
* @param string $type
* @return array
*/
public function getCustomListCount(int $id, string $type): array
{
$caseList = CaseList::where('CAL_ID', '=', $id)
->where('CAL_TYPE', '=', $type)
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
->select([
'CASE_LIST.*',
'ADDITIONAL_TABLES.ADD_TAB_NAME'
])
->get()
->first();
$query = Delegation::query()->select();
$query->paused($this->getUserId());
$name = '';
$description = '';
$tableName = '';
if (!is_null($caseList)) {
$name = $caseList->CAL_NAME;
$description = $caseList->CAL_DESCRIPTION;
$tableName = $caseList->ADD_TAB_NAME;
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
}
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
return [
'label' => G::LoadTranslation('ID_NUMBER_OF_CASES_PAUSED') . $count,
'name' => $name,
'description' => $description,
'tableName' => $tableName,
'total' => $count
];
}
}

View File

@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\User;
@@ -181,4 +182,44 @@ class Unassigned extends AbstractCases
// Return the number of rows
return $query->count(['APP_DELEGATION.APP_NUMBER']);
}
/**
* Returns the total cases of the custom unassigned list.
* @param int $id
* @param string $type
* @return array
*/
public function getCustomListCount(int $id, string $type): array
{
$caseList = CaseList::where('CAL_ID', '=', $id)
->where('CAL_TYPE', '=', $type)
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
->select([
'CASE_LIST.*',
'ADDITIONAL_TABLES.ADD_TAB_NAME'
])
->get()
->first();
$query = Delegation::query()->select();
$query->selfService($this->getUserId());
$name = '';
$description = '';
$tableName = '';
if (!is_null($caseList)) {
$name = $caseList->CAL_NAME;
$description = $caseList->CAL_DESCRIPTION;
$tableName = $caseList->ADD_TAB_NAME;
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
}
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
return [
'label' => G::LoadTranslation('ID_NUMBER_OF_CASES_UNASSIGNED') . $count,
'name' => $name,
'description' => $description,
'tableName' => $tableName,
'total' => $count
];
}
}

View File

@@ -8,6 +8,7 @@ use Fields;
use G;
use PmTable;
use ProcessMaker\BusinessModel\ReportTable as BusinessModelRpt;
use ProcessMaker\Model\AdditionalTables as ModelAdditionalTables;
use stdClass;
class Table
@@ -23,34 +24,25 @@ class Table
'or','throw','protected','public','static','switch','xor','try','use','var','while'];
/**
* List of Tables in process
* @var string $pro_uid. Uid for process
* @var string $reportFlag. If is report table
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* List of Tables in process.
* @param string $proUid
* @param bool $reportFlag
* @param bool $offline
* @param string $search
* @return array
*/
public function getTables($pro_uid = '', $reportFlag = false, $offline = false)
public function getTables(string $proUid = '', bool $reportFlag = false, bool $offline = false, string $search = ''): array
{
//VALIDATION
if ($reportFlag) {
$pro_uid = $this->validateProUid($pro_uid);
$proUid = $this->validateProUid($proUid);
}
$reportTables = array();
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn(\AdditionalTablesPeer::ADD_TAB_UID);
$oCriteria->add(\AdditionalTablesPeer::PRO_UID, $pro_uid, \Criteria::EQUAL);
$oDataset = \AdditionalTablesPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($oDataset->next()) {
$row = $oDataset->getRow();
$reportTables[] = $this->getTable($row['ADD_TAB_UID'], $pro_uid, $reportFlag, false);
}
return $reportTables;
$additionalTables = ModelAdditionalTables::where('PRO_UID', '=', $proUid)
->where('ADD_TAB_NAME', 'LIKE', "%{$search}%")
->get();
$additionalTables->transform(function ($object) use ($proUid, $reportFlag) {
return $this->getTable($object->ADD_TAB_UID, $proUid, $reportFlag, false);
});
return $additionalTables->toArray();
}
/**

View File

@@ -30,4 +30,94 @@ class AppDelay extends Model
'APP_ENABLE_ACTION_DATE',
'APP_DISABLE_ACTION_DATE',
];
/**
* Scope a query to filter a specific type
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $type
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeType($query, string $type = 'PAUSE')
{
return $query->where('APP_DELAY.APP_TYPE', $type);
}
/**
* Scope a query to filter a specific disable action
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeNotDisabled($query)
{
return $query->where('APP_DELAY.APP_DISABLE_ACTION_USER', 0);
}
/**
* Scope a query to filter a specific case
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param int $appNumber
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCase($query, int $appNumber)
{
return $query->where('APP_DELAY.APP_NUMBER', $appNumber);
}
/**
* Scope a query to filter a specific index
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param int $index
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeIndex($query, int $index)
{
return $query->where('APP_DELAY.APP_DEL_INDEX', $index);
}
/**
* Scope a query to filter a specific user
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $user
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeDelegateUser($query, string $user)
{
return $query->where('APP_DELAY.APP_DELEGATION_USER', $user);
}
/**
* Get the thread paused
*
* @param int $appNumber
* @param int $index
* @param string $userUid
*
* @return array
*/
public static function getPaused(int $appNumber, int $index, string $userUid = '')
{
$query = AppDelay::query()->select([
'APP_NUMBER',
'APP_DEL_INDEX AS DEL_INDEX',
'PRO_UID'
]);
$query->type('PAUSE')->notDisabled();
$query->case($appNumber);
// Filter specific index
if ($index > 0) {
$query->index($index);
}
// Filter specific delegate user
if (!empty($userUid)) {
$query->delegateUser($userUid);
}
// Get the result
$results = $query->get();
return $results->values()->toArray();
}
}

View File

@@ -173,9 +173,10 @@ class CaseList extends Model
* @param string $search
* @param int $offset
* @param int $limit
* @param bool $paged
* @return array
*/
public static function getSetting(string $type, string $search, int $offset, int $limit): array
public static function getSetting(string $type, string $search, int $offset, int $limit, bool $paged = true): array
{
$order = 'asc';
$model = CaseList::where('CAL_TYPE', '=', $type)
@@ -198,7 +199,11 @@ class CaseList extends Model
$count = $model->count();
$data = $model->offset($offset)->limit($limit)->get();
if ($paged === true) {
$model->offset($offset)->limit($limit);
}
$data = $model->get();
$data->transform(function ($item, $key) {
if (is_null($item->CAL_COLUMNS)) {
$item->CAL_COLUMNS = '[]';

View File

@@ -173,18 +173,6 @@ class Delegation extends Model
return $query->where('DEL_INDEX', '=', 1);
}
/**
* Scope a query to get the in-progress
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCaseInProgress($query)
{
return $query->statusIds([Application::STATUS_DRAFT, Application::STATUS_TODO]);
}
/**
* Scope a query to get the to_do cases
*
@@ -777,19 +765,6 @@ class Delegation extends Model
return $query->whereIn('APP_DELEGATION.PRO_ID', $processes);
}
/**
* Scope where in processes
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param array $processes
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeInProcesses($query, array $processes)
{
return $query->whereIn('PROCESS.PRO_ID', $processes);
}
/**
* Scope the Inbox cases
*
@@ -812,26 +787,6 @@ class Delegation extends Model
return $query;
}
/**
* Scope the Inbox cases
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeInboxWithoutUser($query)
{
// This scope is for the join with the APP_DELEGATION table
$query->joinApplication();
$query->status(Application::STATUS_TODO);
// Scope for the restriction of the task that must not be searched for
$query->excludeTaskTypes(Task::DUMMY_TASKS);
// Scope that establish that the DEL_THREAD_STATUS must be OPEN
$query->threadOpen();
return $query;
}
/**
* Scope a self service cases
*
@@ -1417,7 +1372,7 @@ class Delegation extends Model
* @param string $appUid
* @return array
*
* @see \ProcessMaker\BusinessModel\Cases:getStatusInfo()
* @see \ProcessMaker\BusinessModel\Cases::getStatusInfo()
*/
public static function getParticipatedInfo($appUid)
{

View File

@@ -215,6 +215,7 @@ class User extends Model
public static function getInformation(int $usrId)
{
$query = User::query()->select([
'USR_ID',
'USR_USERNAME',
'USR_FIRSTNAME',
'USR_LASTNAME',
@@ -226,6 +227,7 @@ class User extends Model
$results = $query->get();
$info = [];
$results->each(function ($item) use (&$info) {
$info['usr_id'] = $item->USR_ID;
$info['usr_username'] = $item->USR_USERNAME;
$info['usr_firstname'] = $item->USR_FIRSTNAME;
$info['usr_lastname'] = $item->USR_LASTNAME;

View File

@@ -14,6 +14,7 @@ use ProcessMaker\BusinessModel\Cases\Paused;
use ProcessMaker\BusinessModel\Cases\Search;
use ProcessMaker\BusinessModel\Cases\Supervising;
use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\ProcessCategory;
@@ -609,6 +610,30 @@ class Home extends Api
if ($menuInstance->Id[$i] === 'ID_CASE_ARCHIVE_SEARCH') {
$option->icon = "fas fa-archive";
}
//custom cases list
if (in_array($menuInstance->Id[$i], $optionsWithCounter)) {
$mapKeys = [
'CASES_INBOX' => 'inbox',
'CASES_DRAFT' => 'draft',
'CASES_SELFSERVICE' => 'unassigned',
'CASES_PAUSED' => 'paused'
];
$option->customCasesList = [];
$result = CaseList::getSetting($mapKeys[$menuInstance->Id[$i]], '', 0, 10, false);
foreach ($result['data'] as $value) {
$option->customCasesList[] = [
"href" => "casesListExtJs?action=" . $mapKeys[$menuInstance->Id[$i]],
"id" => $value['id'],
"title" => $value['name'],
"description" => $value['description'],
"icon" => $value['iconList'],
"badge" => [
"text" => "0",
"class" => "badge-custom"
]
];
}
}
// Add option to the menu
$menuHome[] = $option;
}
@@ -727,10 +752,48 @@ class Home extends Api
$result = [];
$result['label'] = $text . $count;
$result['total'] = $count;
return $result;
}
/**
* Get task counters for inbox, draft, paused, and unassigned for custom case lists.
* @url GET /:task/counter/caseList/:id
* @param string $task
* @param int $id
* @return array
* @access protected
* @class AccessControl {@permission PM_CASES}
*/
public function getCustomCaseListCounter(string $task, int $id)
{
try {
$usrUid = $this->getUserId();
$usrId = !empty($usrUid) ? User::getId($usrUid) : 0;
switch ($task) {
case 'inbox':
$taskList = new Inbox();
break;
case 'draft':
$taskList = new Draft();
break;
case 'paused':
$taskList = new Paused();
break;
case 'unassigned':
$taskList = new Unassigned();
break;
default:
return [];
}
$taskList->setUserUid($usrUid);
$taskList->setUserId($usrId);
$result = $taskList->getCustomListCount($id, $task);
return $result;
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* Get the tasks counters for todo, draft, paused and unassigned
*

View File

@@ -1,33 +1,29 @@
<?php
namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use Luracast\Restler\RestException;
use ProcessMaker\BusinessModel\Table;
use ProcessMaker\Services\Api;
/**
* Project\ReportTable Api Controller
*
* @author Brayan Pereyra <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @protected
*/
class ReportTable extends Api
{
/**
* @param string $prj_uid {@min 1} {@max 32}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* Get list of the report tables by project.
* @url GET /:proUid/report-tables
* @param string $proUid {@min 1} {@max 32}
* @param string $search
* @return array
*
* @url GET /:prj_uid/report-tables
* @throws RestException
*/
public function doGetReportTables($prj_uid)
public function doGetReportTables(string $proUid, string $search = '')
{
try {
$oReportTable = new \ProcessMaker\BusinessModel\Table();
$response = $oReportTable->getTables($prj_uid, true);
$reportTable = new Table();
$response = $reportTable->getTables($proUid, true, false, $search);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
@@ -38,9 +34,6 @@ class ReportTable extends Api
* @param string $prj_uid {@min 1} {@max 32}
* @param string $rep_uid {@min 1} {@max 32}
* @return array
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /:prj_uid/report-table/:rep_uid
*/
public function doGetReportTable($prj_uid, $rep_uid)
@@ -58,9 +51,6 @@ class ReportTable extends Api
* @param string $prj_uid {@min 1} {@max 32}
* @param string $rep_uid {@min 1} {@max 32}
* @return array
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /:prj_uid/report-table/:rep_uid/populate
*/
public function doGetPopulateReportTable($prj_uid, $rep_uid)
@@ -78,9 +68,6 @@ class ReportTable extends Api
* @param string $prj_uid {@min 1} {@max 32}
* @param string $rep_uid {@min 1} {@max 32}
* @return array
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /:prj_uid/report-table/:rep_uid/data
*/
public function doGetReportTableData($prj_uid, $rep_uid)

View File

@@ -416,7 +416,7 @@ Ext.onReady(function(){
buttonCancel = new Ext.Button({
buttonAlign: 'center',
text: 'Cancel',
text: _("ID_CANCEL"),
handler: redirectHistory,
cls: 'cancelSummary',
width: '100px',
@@ -427,7 +427,7 @@ Ext.onReady(function(){
buttonClaimCase = new Ext.Button({
buttonAlign: 'center',
ui: 'round',
text: 'Claim this case',
text: _("ID_CLAIM_THIS_CASE"),
handler: claimCase,
cls: 'claimCaseSummary',
width: '120px',