fix conflicts

This commit is contained in:
Rodrigo Quelca
2021-08-09 13:18:57 +00:00
55 changed files with 2214 additions and 899 deletions

View File

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

@@ -60,11 +60,16 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function
'APP_CUR_USER' => $user->USR_UID 'APP_CUR_USER' => $user->USR_UID
]); ]);
$delegateDate = $faker->dateTime();
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
// Return with default values // Return with default values
return [ return [
'DELEGATION_ID' => $faker->unique()->numberBetween(5000), 'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID, 'APP_UID' => $application->APP_UID,
'DEL_INDEX' => 1, 'DEL_INDEX' => $faker->unique()->numberBetween(2000),
'APP_NUMBER' => $application->APP_NUMBER, 'APP_NUMBER' => $application->APP_NUMBER,
'DEL_PREVIOUS' => 0, 'DEL_PREVIOUS' => 0,
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
@@ -74,10 +79,10 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function
'DEL_THREAD' => 1, 'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
'DEL_PRIORITY' => 3, 'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $faker->dateTime(), 'DEL_DELEGATE_DATE' => $delegateDate,
'DEL_INIT_DATE' => $faker->dateTime(), 'DEL_INIT_DATE' => $initDate,
'DEL_TASK_DUE_DATE' => $faker->dateTime(), 'DEL_TASK_DUE_DATE' => $taskDueDate,
'DEL_RISK_DATE' => $faker->dateTime(), 'DEL_RISK_DATE' => $riskDate,
'DEL_LAST_INDEX' => 1, 'DEL_LAST_INDEX' => 1,
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
@@ -138,7 +143,7 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'open', function (Faker $
$delegateDate = $faker->dateTime(); $delegateDate = $faker->dateTime();
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes'); $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day'); $riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+1 day'); $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
return [ return [
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
@@ -156,7 +161,7 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker
$delegateDate = $faker->dateTime(); $delegateDate = $faker->dateTime();
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes'); $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day'); $riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+1 day'); $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
$finishDate = $faker->dateTimeInInterval($initDate, '+10 days'); $finishDate = $faker->dateTimeInInterval($initDate, '+10 days');
return [ return [
@@ -171,7 +176,17 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker
// Create a last delegation // Create a last delegation
$factory->state(\ProcessMaker\Model\Delegation::class, 'last_thread', function (Faker $faker) { $factory->state(\ProcessMaker\Model\Delegation::class, 'last_thread', function (Faker $faker) {
return [ return [
'DEL_LAST_INDEX' => 1, '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

@@ -13,6 +13,9 @@
<ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis> <ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div> </div>
</div> </div>
<div slot="owner" slot-scope="props">
<OwnerCell :data="props.row.owner" />
</div>
</v-server-table> </v-server-table>
</div> </div>
@@ -21,13 +24,16 @@
<script> <script>
import Api from "./Api/CaseList"; import Api from "./Api/CaseList";
import ButtonFleft from "../../../components/home/ButtonFleft.vue"; import ButtonFleft from "../../../components/home/ButtonFleft.vue";
import Ellipsis from '../../../components/utils/ellipsis.vue'; import Ellipsis from "../../../components/utils/ellipsis.vue";
import utils from "../../../utils/utils";
import OwnerCell from "../../../components/vuetable/OwnerCell";
export default { export default {
name: "Tables", name: "Tables",
props: ["module"], props: ["module"],
components: { components: {
ButtonFleft, ButtonFleft,
Ellipsis Ellipsis,
OwnerCell
}, },
data() { data() {
return { return {
@@ -126,8 +132,9 @@ export default {
return new Promise((resolutionFunc, rejectionFunc) => { return new Promise((resolutionFunc, rejectionFunc) => {
Api.getCaseList(filters, that.module) Api.getCaseList(filters, that.module)
.then((response) => { .then((response) => {
dt = that.formatDataResponse(response.data.data);
resolutionFunc({ resolutionFunc({
data: response.data.data, data: dt,
count: response.data.total count: response.data.total
}); });
}) })
@@ -135,6 +142,35 @@ export default {
rejectionFunc(e); rejectionFunc(e);
}); });
}); });
},
/**
* Format Response API TODO to grid inbox and columns
* @param {object} response
* @returns {object}
*/
formatDataResponse(response){
let that = this,
data = [],
userDataFormat;
_.forEach(response, (v) => {
userDataFormat = utils.userNameDisplayFormat({
userName: v.userName || "",
firstName: v.userFirstname || "",
lastName: v.userLastname || "",
format: window.config.FORMATS.format || null
});
v["owner"] = {
userAvatar: userDataFormat !== "" ? window.config.SYS_SERVER_AJAX +
window.config.SYS_URI +
`users/users_ViewPhotoGrid?pUID=${v.userId}` : "",
userInfo: userDataFormat || "",
userEmail: v.userEmail,
userId: v.userId,
userPosition: v.userPosition || ""
}
data.push(v);
});
return data;
} }
} }
}; };

View File

@@ -25,5 +25,22 @@ export let menu = {
"Accept-Language": window.config.SYS_LANG "Accept-Language": window.config.SYS_LANG
} }
}); });
},
/**
* Get the counter of a specific task
* @param {string} task
* @returns
*/
getTooltip(task) {
return axios.get(
window.config.SYS_SERVER_API +
'/api/1.0/' +
window.config.SYS_WORKSPACE +
'/home/'+ task +'/counter', {
headers: {
'Authorization': 'Bearer ' + window.config.SYS_CREDENTIALS.accessToken,
"Accept-Language": window.config.SYS_LANG
}
});
} }
}; };

View File

@@ -69,5 +69,8 @@
CATEGORIES: "/home/categories", CATEGORIES: "/home/categories",
DEBUG_STATUS: "/home/process-debug-status?processUid={prj_uid}", DEBUG_STATUS: "/home/process-debug-status?processUid={prj_uid}",
CONFIG: "/home/config", CONFIG: "/home/config",
GET_CONFIG: "/home/config/{id}/{name}" GET_CONFIG: "/home/config/{id}/{name}",
PAUSE_CASE: "/cases/{app_uid}/pause",
REASSIGN_CASE: "/cases/{app_uid}/reassign-case",
REASSIGN_USERS: "/light/userstoreassign/{task_uid}"
}; };

View File

@@ -6,6 +6,8 @@
:style="{height: height + 'px'}" :style="{height: height + 'px'}"
> >
<vue-card v-for="item in data" :key="item.id" :item="item" :options="options"> <vue-card v-for="item in data" :key="item.id" :item="item" :options="options">
<b-row>
<b-col sm="9">
<slot <slot
v-for="column in options.columns" v-for="column in options.columns"
:name="column" :name="column"
@@ -13,6 +15,20 @@
:column="column" :column="column"
:headings="options.headings" :headings="options.headings"
></slot> ></slot>
<slot
name="send_by"
:item="item"
column="send_by"
:headings="options.headings"
></slot>
</b-col>
<b-col sm="3">
<slot
name="actions"
:item="item"
></slot>
</b-col>
</b-row>
</vue-card> </vue-card>
</div> </div>
@@ -38,12 +54,20 @@ export default {
}; };
}, },
mounted() { mounted() {
this.filterOptions();
}, },
methods: { methods: {
classBtn(cls) { classBtn(cls) {
return "btn btn-slim btn-force-radius v-btn-header " + 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> </script>

View File

@@ -6,13 +6,32 @@
:style="{height: height + 'px'}" :style="{height: height + 'px'}"
> >
<vue-list v-for="item in data" :key="item.id" :item="item" :options="options"> <vue-list v-for="item in data" :key="item.id" :item="item" :options="options">
<b-row>
<b-col sm="5">
<slot <slot
v-for="column in options.columns" v-for="column in options.columns"
:name="column" :name="column"
:item="item" :item="item"
:column="column" :column="column"
:headings="options.headings" :headings="options.headings"
ref="containerList"
></slot> ></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"
:item="item"
></slot>
</b-col>
</b-row>
</vue-list> </vue-list>
</div> </div>
@@ -38,12 +57,20 @@ export default {
}; };
}, },
mounted() { mounted() {
this.filterOptions();
}, },
methods: { methods: {
classBtn(cls) { classBtn(cls) {
return "btn btn-slim btn-force-radius v-btn-header " + 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> </script>

View File

@@ -34,7 +34,7 @@
" "
> >
<span class="vsm--title"> <span class="vsm--title">
{{ item.title }} <custom-tooltip :data="item"></custom-tooltip>
<b-icon <b-icon
v-if="item.sortable" v-if="item.sortable"
:icon="item.sortIcon" :icon="item.sortIcon"
@@ -139,7 +139,7 @@
</div> </div>
</draggable> </draggable>
<template #modal-footer="{ ok, cancel, hide }"> <template #modal-footer="{ cancel }">
<b-button size="sm" variant="danger" @click="cancel()"> <b-button size="sm" variant="danger" @click="cancel()">
Cancel Cancel
</b-button> </b-button>
@@ -153,6 +153,8 @@
import draggable from "vuedraggable"; import draggable from "vuedraggable";
import CustomSidebarMenuLink from "./CustomSidebarMenuLink"; import CustomSidebarMenuLink from "./CustomSidebarMenuLink";
import CustomSidebarMenuIcon from "./CustomSidebarMenuIcon"; import CustomSidebarMenuIcon from "./CustomSidebarMenuIcon";
import CustomTooltip from "./../utils/CustomTooltip.vue";
export default { export default {
name: "CustomSidebarMenuItem", name: "CustomSidebarMenuItem",
props: { props: {
@@ -201,6 +203,7 @@ export default {
draggable, draggable,
CustomSidebarMenuLink, CustomSidebarMenuLink,
CustomSidebarMenuIcon, CustomSidebarMenuIcon,
CustomTooltip
}, },
data() { data() {
return { return {
@@ -210,6 +213,7 @@ export default {
itemHover: false, itemHover: false,
exactActive: false, exactActive: false,
active: false, active: false,
titleHover: '',
}; };
}, },
computed: { computed: {

View File

@@ -31,7 +31,9 @@
<div class="p-1 v-flex"> <div class="p-1 v-flex">
<h5 class="v-search-title">{{ title }}</h5> <h5 class="v-search-title">{{ title }}</h5>
<div class="pm-in-text-icon">
<i :class="icon"></i>
</div>
<b-input-group class="w-75 p-1"> <b-input-group class="w-75 p-1">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
@@ -87,7 +89,7 @@ import api from "./../../api/index";
export default { export default {
name: "Cases", name: "Cases",
props: ["filters", "title"], props: ["filters", "title", "icon"],
components: { components: {
SearchPopover, SearchPopover,
CaseNumber, CaseNumber,
@@ -378,7 +380,12 @@ export default {
} }
.v-search-title { .v-search-title {
padding-right: 20px; padding-right: 10px;
line-height: 40px; line-height: 40px;
} }
.pm-in-text-icon {
font-size: 2vw;
padding-right: 10px;
line-height: 3vw;
}
</style> </style>

View File

@@ -29,7 +29,9 @@
<div class="p-1 v-flex"> <div class="p-1 v-flex">
<h5 class="v-search-title">{{ title }}</h5> <h5 class="v-search-title">{{ title }}</h5>
<div class="pm-mc-text-icon">
<i :class="icon"></i>
</div>
<b-input-group class="w-75 p-1"> <b-input-group class="w-75 p-1">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
@@ -86,7 +88,7 @@ import api from "./../../api/index";
export default { export default {
name: "MyCasesFilter", name: "MyCasesFilter",
props: ["filters","title"], props: ["filters","title", "icon"],
components:{ components:{
SearchPopover, SearchPopover,
CaseNumber, CaseNumber,
@@ -408,8 +410,13 @@ export default {
} }
.v-search-title { .v-search-title {
padding-right: 20px; padding-right: 10px;
line-height: 40px; line-height: 40px;
} }
.pm-mc-text-icon{
font-size: 2vw;
padding-right: 10px;
line-height: 3vw;
}
</style> </style>

View File

@@ -0,0 +1,71 @@
<template>
<span
:id="data.id"
@mouseover="hoverHandler"
v-b-tooltip.hover
:title="labelTooltip"
@mouseleave="unhoverHandler"
>
{{ data.title }}
<b-tooltip
:target="data.id"
triggers="hoverHandler"
:show.sync="show"
>
{{ labelTooltip }}
</b-tooltip>
</span>
</template>
<script>
import api from "./../../api/index";
export default {
name: "CustomTooltip",
props: {
data: Object,
},
data() {
return {
labelTooltip: "",
hovering: "",
show: false,
menuMap: {
CASES_INBOX: "inbox",
CASES_DRAFT: "draft",
CASES_PAUSED: "paused",
CASES_SELFSERVICE: "unassigned"
}
}
},
methods: {
/**
* Delay the hover event
*/
hoverHandler() {
this.hovering = setTimeout(() => { this.setTooltip() }, 3000);
},
/**
* Reset the delay and hide the tooltip
*/
unhoverHandler() {
this.labelTooltip = "";
this.show = false;
clearTimeout(this.hovering);
},
/**
* Set the label to show in the tooltip
*/
setTooltip() {
let that = this;
api.menu
.getTooltip(that.menuMap[that.data.id])
.then((response) => {
that.labelTooltip = response.data.label;
that.show = true;
});
},
}
}
</script>

View File

@@ -94,6 +94,7 @@ export default {
width: 0px; width: 0px;
z-index: 999; z-index: 999;
display: inline-flex !important; display: inline-flex !important;
opacity: 1 !important;
} }
.btn-outline-info { .btn-outline-info {
border: none; border: none;

View File

@@ -69,7 +69,7 @@ export default {
.ellipsis { .ellipsis {
white-space: nowrap; white-space: nowrap;
width: 140px; width: auto;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; 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

@@ -35,8 +35,8 @@
<div slot="case_title" slot-scope="props"> <div slot="case_title" slot-scope="props">
{{ props.row.CASE_TITLE }} {{ props.row.CASE_TITLE }}
</div> </div>
<div slot="assignee" slot-scope="props"> <div slot="current_user" slot-scope="props">
{{ props.row.ASSIGNEE }} <CurrentUserCell :data="props.row.USER_DATA" />
</div> </div>
<div slot="status" slot-scope="props"> <div slot="status" slot-scope="props">
{{ props.row.STATUS }} {{ props.row.STATUS }}
@@ -114,6 +114,7 @@ import ModalCancelCase from "../home/modal/ModalCancelCase.vue";
import ModalNewRequest from "./ModalNewRequest.vue"; import ModalNewRequest from "./ModalNewRequest.vue";
import ModalClaimCase from "./modal/ModalClaimCase.vue"; import ModalClaimCase from "./modal/ModalClaimCase.vue";
import TaskCell from "../components/vuetable/TaskCell.vue"; import TaskCell from "../components/vuetable/TaskCell.vue";
import CurrentUserCell from "../components/vuetable/CurrentUserCell.vue"
import utils from "./../utils/utils"; import utils from "./../utils/utils";
import Api from "../api/index"; import Api from "../api/index";
@@ -131,7 +132,8 @@ export default {
ButtonFleft, ButtonFleft,
ModalNewRequest, ModalNewRequest,
ModalClaimCase, ModalClaimCase,
TaskCell TaskCell,
CurrentUserCell
}, },
props: {}, props: {},
data() { data() {
@@ -153,7 +155,7 @@ export default {
columns: [ columns: [
"task", "task",
"case_title", "case_title",
"assignee", "current_user",
"status", "status",
"due_date", "due_date",
"actions" "actions"
@@ -164,7 +166,7 @@ export default {
headings: { headings: {
task: this.$i18n.t("ID_TASK"), task: this.$i18n.t("ID_TASK"),
case_title: this.$i18n.t("ID_CASE_TITLE"), case_title: this.$i18n.t("ID_CASE_TITLE"),
assignee: this.$i18n.t("ID_CURRENT_USER"), current_user: this.$i18n.t("ID_CURRENT_USER"),
status: this.$i18n.t("ID_STATUS"), status: this.$i18n.t("ID_STATUS"),
due_date: this.$i18n.t("ID_DUE_DATE"), due_date: this.$i18n.t("ID_DUE_DATE"),
actions: this.$i18n.t("ID_ACTIONS") actions: this.$i18n.t("ID_ACTIONS")
@@ -500,15 +502,7 @@ export default {
}, },
], ],
CASE_TITLE: v.DEL_TITLE, CASE_TITLE: v.DEL_TITLE,
ASSIGNEE: USER_DATA: this.formatUser(v.user_tooltip),
v.USR_ID !== 0
? utils.userNameDisplayFormat({
userName: v.USR_USERNAME,
firstName: v.USR_LASTNAME,
lastName: v.USR_LASTNAME,
format: window.config.FORMATS.format || null
})
: this.$i18n.t("ID_UNASSIGNED"),
STATUS: v.DEL_THREAD_STATUS, STATUS: v.DEL_THREAD_STATUS,
DUE_DATE: v.DEL_TASK_DUE_DATE, DUE_DATE: v.DEL_TASK_DUE_DATE,
TASK_COLOR: v.TAS_COLOR_LABEL, TASK_COLOR: v.TAS_COLOR_LABEL,
@@ -520,6 +514,31 @@ export default {
}); });
return data; return data;
}, },
/**
* Format user information to show
*/
formatUser(data) {
var dataFormat = [],
userDataFormat;
userDataFormat = data.usr_id ?
utils.userNameDisplayFormat({
userName: data.usr_firstname,
firstName: data.usr_lastname,
lastName: data.usr_username,
format: window.config.FORMATS.format || null
})
: this.$i18n.t("ID_UNASSIGNED");
dataFormat.push({
USERNAME_DISPLAY_FORMAT: userDataFormat !== "" ? userDataFormat : this.$i18n.t("ID_UNASSIGNED"),
EMAIL: data.usr_email,
POSITION: data.usr_position,
AVATAR: userDataFormat !== this.$i18n.t("ID_UNASSIGNED") ? window.config.SYS_SERVER_AJAX +
window.config.SYS_URI +
`users/users_ViewPhotoGrid?pUID=${data.usr_id}` : "",
UNASSIGNED: userDataFormat !== this.$i18n.t("ID_UNASSIGNED") ? true : false
});
return dataFormat;
},
/** /**
* Show the alert message * Show the alert message
* @param {string} message - message to be displayen in the body * @param {string} message - message to be displayen in the body

View File

@@ -5,6 +5,7 @@
<CasesFilter <CasesFilter
:filters="filters" :filters="filters"
:title="$t('ID_DRAFT')" :title="$t('ID_DRAFT')"
:icon="icon"
@onRemoveFilter="onRemoveFilter" @onRemoveFilter="onRemoveFilter"
@onUpdateFilters="onUpdateFilters" @onUpdateFilters="onUpdateFilters"
/> />
@@ -49,10 +50,19 @@
:options="optionsVueView" :options="optionsVueView"
ref="vueCardView" ref="vueCardView"
> >
<div slot="detail" slot-scope="props"> <div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)"> <div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i> <i class="fas fa-info-circle"></i>
</div> </div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div> </div>
<div slot="case_number" slot-scope="props" class="v-card-text"> <div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight" <span class="v-card-text-highlight"
@@ -106,10 +116,19 @@
:options="optionsVueView" :options="optionsVueView"
ref="vueListView" ref="vueListView"
> >
<div slot="detail" slot-scope="props"> <div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)"> <div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i> <i class="fas fa-info-circle"></i>
</div> </div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div> </div>
<div slot="case_number" slot-scope="props" class="v-card-text"> <div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight" <span class="v-card-text-highlight"
@@ -222,6 +241,7 @@ export default {
"actions" "actions"
], ],
tableData: [], tableData: [],
icon:"fas fa-edit",
options: { options: {
filterable: false, filterable: false,
headings: { headings: {
@@ -568,5 +588,7 @@ export default {
padding-left: 50px; padding-left: 50px;
padding-right: 50px; padding-right: 50px;
} }
.ellipsis-container {
margin-top: 5em;
}
</style> </style>

View File

@@ -7,6 +7,7 @@
<CasesFilter <CasesFilter
:filters="filters" :filters="filters"
:title="$t('ID_CASES_STATUS_TO_DO')" :title="$t('ID_CASES_STATUS_TO_DO')"
:icon="icon"
@onRemoveFilter="onRemoveFilter" @onRemoveFilter="onRemoveFilter"
@onUpdateFilters="onUpdateFilters" @onUpdateFilters="onUpdateFilters"
/> />
@@ -40,6 +41,9 @@
<div slot="task" slot-scope="props"> <div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" /> <TaskCell :data="props.row.TASK" />
</div> </div>
<div slot="send_by" slot-scope="props">
<CurrentUserCell :data="props.row.USER_DATA" />
</div>
<div slot="current_user" slot-scope="props"> <div slot="current_user" slot-scope="props">
{{ props.row.USERNAME_DISPLAY_FORMAT }} {{ props.row.USERNAME_DISPLAY_FORMAT }}
</div> </div>
@@ -61,10 +65,19 @@
:options="optionsVueView" :options="optionsVueView"
ref="vueCardView" ref="vueCardView"
> >
<div slot="detail" slot-scope="props"> <div slot="actions" slot-scope="props">
<div @click="updateDataEllipsis(props.row)"> <b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis> <ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div> </div>
</b-col>
</b-row>
</div> </div>
<div slot="case_number" slot-scope="props" class="v-card-text"> <div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight" <span class="v-card-text-highlight"
@@ -111,19 +124,35 @@
<TaskCell :data="props.item.TASK" /> <TaskCell :data="props.item.TASK" />
</span> </span>
</div> </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> </VueCardView>
<VueListView <VueListView
v-if="typeView === 'LIST'" v-if="typeView === 'LIST'"
:options="optionsVueView" :options="optionsVueView"
ref="vueListView" ref="vueListView"
> >
<div slot="detail" slot-scope="props"> <div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)"> <div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i> <i class="fas fa-info-circle"></i>
</div> </div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div> </div>
<div slot="case_number" slot-scope="props" class="v-card-text"> </b-col>
</b-row>
</div>
<div ref="text" slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight" <span class="v-card-text-highlight"
>{{ props["headings"][props.column] }} : {{ props["item"]["CASE_NUMBER"] }}</span >{{ props["headings"][props.column] }} : {{ props["item"]["CASE_NUMBER"] }}</span
> >
@@ -168,6 +197,14 @@
<TaskCell :data="props.item.TASK" /> <TaskCell :data="props.item.TASK" />
</span> </span>
</div> </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> </VueListView>
</div> </div>
</template> </template>
@@ -188,6 +225,7 @@ import Ellipsis from '../../components/utils/ellipsis.vue';
import ModalPauseCase from '../modal/ModalPauseCase.vue'; import ModalPauseCase from '../modal/ModalPauseCase.vue';
import ModalReassignCase from '../modal/ModalReassignCase.vue'; import ModalReassignCase from '../modal/ModalReassignCase.vue';
import { Event } from 'vue-tables-2'; import { Event } from 'vue-tables-2';
import CurrentUserCell from "../../components/vuetable/CurrentUserCell.vue";
export default { export default {
name: "Todo", name: "Todo",
@@ -204,6 +242,7 @@ export default {
Ellipsis, Ellipsis,
ModalPauseCase, ModalPauseCase,
ModalReassignCase, ModalReassignCase,
CurrentUserCell,
}, },
props: ["defaultOption", "settings"], props: ["defaultOption", "settings"],
data() { data() {
@@ -240,6 +279,7 @@ export default {
"actions" "actions"
], ],
tableData: [], tableData: [],
icon:"fas fa-check-circle",
options: { options: {
filterable: false, filterable: false,
headings: { headings: {
@@ -248,6 +288,7 @@ export default {
case_title: this.$i18n.t("ID_CASE_TITLE"), case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"), process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"), task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"), due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"), delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY"), priority: this.$i18n.t("ID_PRIORITY"),
@@ -479,6 +520,7 @@ export default {
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : "", DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : "",
}, },
], ],
USER_DATA: this.formatUser(v.SEND_BY_INFO),
USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({ USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({
userName: v.USR_LASTNAME, userName: v.USR_LASTNAME,
firstName: v.USR_LASTNAME, firstName: v.USR_LASTNAME,
@@ -496,6 +538,30 @@ export default {
}); });
return data; 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.usr_id}` : "",
UNASSIGNED: userDataFormat !== "" ? true : false
});
return dataFormat;
},
/** /**
* Open selected cases in the inbox * Open selected cases in the inbox
* *
@@ -650,7 +716,8 @@ export default {
display: inline-block; display: inline-block;
} }
.v-card-text { .ellipsis-container {
margin-top: 5em;
} }
.v-pm-card-info{ .v-pm-card-info{

View File

@@ -40,25 +40,25 @@ export default {
this.openCase(item); this.openCase(item);
}, },
headings: { headings: {
detail: "",
case_number: this.$i18n.t("ID_MYCASE_NUMBER"), case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
case_title: this.$i18n.t("ID_CASE_TITLE"), case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"), process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"), task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
current_user: this.$i18n.t("ID_CURRENT_USER"), current_user: this.$i18n.t("ID_CURRENT_USER"),
due_date: this.$i18n.t("ID_DUE_DATE"), due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"), delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY") priority: this.$i18n.t("ID_PRIORITY")
}, },
columns: [ columns: [
"detail",
"case_number", "case_number",
"case_title", "case_title",
"process_name", "process_name",
"due_date", "due_date",
"delegation_date", "delegation_date",
"priority", "priority",
"task" "task",
"send_by",
], ],
requestFunction(data) { requestFunction(data) {
return that.getCases(data); return that.getCases(data);

View File

@@ -13,6 +13,8 @@
<MyCasesFilter <MyCasesFilter
:filters="filters" :filters="filters"
:title="title" :title="title"
:random="random"
:icon="filterHeaderObject.icon"
@onRemoveFilter="onRemoveFilter" @onRemoveFilter="onRemoveFilter"
@onUpdateFilters="onUpdateFilters" @onUpdateFilters="onUpdateFilters"
/> />
@@ -116,12 +118,16 @@ export default {
filter: "CASES_INBOX", filter: "CASES_INBOX",
allView: [], allView: [],
filterHeader: "STARTED", filterHeader: "STARTED",
filterHeaderObject: {
icon:"fas fa-inbox"
},
headers: [], headers: [],
columMap: { columMap: {
case_number: "APP_NUMBER", case_number: "APP_NUMBER",
case_title: "DEL_TITLE", case_title: "DEL_TITLE",
process_name: "PRO_TITLE", process_name: "PRO_TITLE",
}, },
random: _.random(0,1000000000),
newCase: { newCase: {
title: this.$i18n.t("ID_NEW_CASE"), title: this.$i18n.t("ID_NEW_CASE"),
class: "btn-success", class: "btn-success",
@@ -621,6 +627,8 @@ export default {
that.filterHeader = obj.item; that.filterHeader = obj.item;
that.$refs["vueTable"].setPage(1); // Reset the page when change the header filter that.$refs["vueTable"].setPage(1); // Reset the page when change the header filter
that.$refs["vueTable"].getData(); that.$refs["vueTable"].getData();
that.filterHeaderObject = obj;
that.random = _.random(0,1000000000);
}, },
class: info[v.id].class, class: info[v.id].class,
}); });

View File

@@ -6,6 +6,7 @@
<CasesFilter <CasesFilter
:filters="filters" :filters="filters"
:title="$t('ID_PAUSED')" :title="$t('ID_PAUSED')"
:icon="icon"
@onRemoveFilter="onRemoveFilter" @onRemoveFilter="onRemoveFilter"
@onUpdateFilters="onUpdateFilters" @onUpdateFilters="onUpdateFilters"
/> />
@@ -39,6 +40,9 @@
<div slot="task" slot-scope="props"> <div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" /> <TaskCell :data="props.row.TASK" />
</div> </div>
<div slot="send_by" slot-scope="props">
<CurrentUserCell :data="props.row.USER_DATA" />
</div>
<div slot="current_user" slot-scope="props"> <div slot="current_user" slot-scope="props">
{{ props.row.USERNAME_DISPLAY_FORMAT }} {{ props.row.USERNAME_DISPLAY_FORMAT }}
</div> </div>
@@ -60,10 +64,19 @@
:options="optionsVueView" :options="optionsVueView"
ref="vueCardView" ref="vueCardView"
> >
<div slot="detail" slot-scope="props"> <div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)"> <div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i> <i class="fas fa-info-circle"></i>
</div> </div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div> </div>
<div slot="case_number" slot-scope="props" class="v-card-text"> <div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight" <span class="v-card-text-highlight"
@@ -110,17 +123,33 @@
<TaskCell :data="props.item.TASK" /> <TaskCell :data="props.item.TASK" />
</span> </span>
</div> </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> </VueCardView>
<VueListView <VueListView
v-if="typeView === 'LIST'" v-if="typeView === 'LIST'"
:options="optionsVueView" :options="optionsVueView"
ref="vueListView" ref="vueListView"
> >
<div slot="detail" slot-scope="props"> <div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)"> <div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i> <i class="fas fa-info-circle"></i>
</div> </div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div> </div>
<div slot="case_number" slot-scope="props" class="v-card-text"> <div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight" <span class="v-card-text-highlight"
@@ -167,6 +196,14 @@
<TaskCell :data="props.item.TASK" /> <TaskCell :data="props.item.TASK" />
</span> </span>
</div> </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> </VueListView>
<ModalUnpauseCase ref="modal-unpause-case"></ModalUnpauseCase> <ModalUnpauseCase ref="modal-unpause-case"></ModalUnpauseCase>
</div> </div>
@@ -188,6 +225,7 @@ import defaultMixins from "./defaultMixins";
import Ellipsis from '../../components/utils/ellipsis.vue'; import Ellipsis from '../../components/utils/ellipsis.vue';
import ModalReassignCase from '../modal/ModalReassignCase.vue'; import ModalReassignCase from '../modal/ModalReassignCase.vue';
import { Event } from 'vue-tables-2'; import { Event } from 'vue-tables-2';
import CurrentUserCell from "../../components/vuetable/CurrentUserCell.vue";
export default { export default {
name: "Paused", name: "Paused",
@@ -204,6 +242,7 @@ export default {
VueCardView, VueCardView,
VueListView, VueListView,
ModalReassignCase, ModalReassignCase,
CurrentUserCell,
}, },
props: ["defaultOption", "settings"], props: ["defaultOption", "settings"],
data() { data() {
@@ -221,17 +260,6 @@ export default {
this.$refs["newRequest"].show(); this.$refs["newRequest"].show();
}, },
}, },
// columns: [
// "detail",
// "case_number",
// "case_title",
// "process_name",
// "task",
// "due_date",
// "delegation_date",
// "priority",
// "actions",
// ],
filters: filters:
this.settings && this.settings.filters this.settings && this.settings.filters
? this.settings.filters ? this.settings.filters
@@ -251,6 +279,7 @@ export default {
"actions" "actions"
], ],
tableData: [], tableData: [],
icon:"far fa-pause-circle",
options: { options: {
filterable: false, filterable: false,
headings: { headings: {
@@ -259,6 +288,7 @@ export default {
case_title: this.$i18n.t("ID_CASE_TITLE"), case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"), process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"), task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"), due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"), delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY"), priority: this.$i18n.t("ID_PRIORITY"),
@@ -486,6 +516,7 @@ export default {
this.$i18n.t("ID_DELAYED") + ":" : this.statusTitle[v.TAS_STATUS], this.$i18n.t("ID_DELAYED") + ":" : this.statusTitle[v.TAS_STATUS],
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : "" DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : ""
}], }],
USER_DATA: this.formatUser(v.SEND_BY_INFO),
USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({ USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({
userName: v.USR_LASTNAME, userName: v.USR_LASTNAME,
firstName: v.USR_LASTNAME, firstName: v.USR_LASTNAME,
@@ -503,6 +534,30 @@ export default {
}); });
return data; 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.usr_id}` : "",
UNASSIGNED: userDataFormat !== "" ? true : false
});
return dataFormat;
},
/** /**
* Open selected cases in the inbox * Open selected cases in the inbox
* *

View File

@@ -39,25 +39,25 @@ export default {
this.openCase(item); this.openCase(item);
}, },
headings: { headings: {
detail: "",
case_number: this.$i18n.t("ID_MYCASE_NUMBER"), case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
case_title: this.$i18n.t("ID_CASE_TITLE"), case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"), process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"), task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
current_user: this.$i18n.t("ID_CURRENT_USER"), current_user: this.$i18n.t("ID_CURRENT_USER"),
due_date: this.$i18n.t("ID_DUE_DATE"), due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"), delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY") priority: this.$i18n.t("ID_PRIORITY")
}, },
columns: [ columns: [
"detail",
"case_number", "case_number",
"case_title", "case_title",
"process_name", "process_name",
"due_date", "due_date",
"delegation_date", "delegation_date",
"priority", "priority",
"task" "task",
"send_by",
], ],
requestFunction(data) { requestFunction(data) {
return that.getCases(data); return that.getCases(data);

View File

@@ -5,6 +5,7 @@
<CasesFilter <CasesFilter
:filters="filters" :filters="filters"
:title="$t('ID_UNASSIGNED')" :title="$t('ID_UNASSIGNED')"
:icon="icon"
@onRemoveFilter="onRemoveFilter" @onRemoveFilter="onRemoveFilter"
@onUpdateFilters="onUpdateFilters" @onUpdateFilters="onUpdateFilters"
/> />
@@ -37,6 +38,9 @@
<div slot="task" slot-scope="props"> <div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" /> <TaskCell :data="props.row.TASK" />
</div> </div>
<div slot="send_by" slot-scope="props">
<CurrentUserCell :data="props.row.USER_DATA" />
</div>
<div slot="due_date" slot-scope="props"> <div slot="due_date" slot-scope="props">
{{ props.row.DUE_DATE }} {{ props.row.DUE_DATE }}
</div> </div>
@@ -55,10 +59,19 @@
:options="optionsVueList" :options="optionsVueList"
ref="vueCardView" ref="vueCardView"
> >
<div slot="detail" slot-scope="props"> <div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)"> <div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i> <i class="fas fa-info-circle"></i>
</div> </div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div> </div>
<div slot="case_number" slot-scope="props" class="v-card-text"> <div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight" <span class="v-card-text-highlight"
@@ -105,16 +118,33 @@
<TaskCell :data="props.item.TASK" /> <TaskCell :data="props.item.TASK" />
</span> </span>
</div> </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> </VueCardView>
<VueListView <VueListView
v-if="typeView === 'LIST'" v-if="typeView === 'LIST'"
:options="optionsVueList" :options="optionsVueList"
ref="vueListView" ref="vueListView"
> >
<div slot="detail" slot-scope="props"> <div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)"> <div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i> <i class="fas fa-info-circle"></i>
</div> </div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.item)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div> </div>
<div slot="case_number" slot-scope="props" class="v-card-text"> <div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight" <span class="v-card-text-highlight"
@@ -161,6 +191,14 @@
<TaskCell :data="props.item.TASK" /> <TaskCell :data="props.item.TASK" />
</span> </span>
</div> </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> </VueListView>
<ModalClaimCase ref="modal-claim-case"></ModalClaimCase> <ModalClaimCase ref="modal-claim-case"></ModalClaimCase>
<ModalPauseCase ref="modal-pause-case"></ModalPauseCase> <ModalPauseCase ref="modal-pause-case"></ModalPauseCase>
@@ -183,6 +221,7 @@ import VueListView from "../../components/dataViews/vueListView/VueListView.vue"
import defaultMixins from "./defaultMixins"; import defaultMixins from "./defaultMixins";
import ModalPauseCase from '../modal/ModalPauseCase.vue'; import ModalPauseCase from '../modal/ModalPauseCase.vue';
import { Event } from 'vue-tables-2'; import { Event } from 'vue-tables-2';
import CurrentUserCell from "../../components/vuetable/CurrentUserCell.vue";
export default { export default {
name: "Unassigned", name: "Unassigned",
@@ -199,6 +238,7 @@ export default {
VueCardView, VueCardView,
VueListView, VueListView,
ModalPauseCase, ModalPauseCase,
CurrentUserCell,
}, },
props: ["defaultOption", "settings"], props: ["defaultOption", "settings"],
data() { data() {
@@ -242,6 +282,7 @@ export default {
case_title: this.$i18n.t("ID_CASE_TITLE"), case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"), process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"), task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"), due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"), delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY"), priority: this.$i18n.t("ID_PRIORITY"),
@@ -440,6 +481,7 @@ export default {
this.$i18n.t("ID_DELAYED") + ":" : this.statusTitle[v.TAS_STATUS], this.$i18n.t("ID_DELAYED") + ":" : this.statusTitle[v.TAS_STATUS],
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : "" DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : ""
}], }],
USER_DATA: this.formatUser(v.SEND_BY_INFO),
DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL, DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL,
DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL, DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL,
PRIORITY: v.DEL_PRIORITY_LABEL, PRIORITY: v.DEL_PRIORITY_LABEL,
@@ -451,6 +493,30 @@ export default {
}); });
return data; 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.usr_id}` : "",
UNASSIGNED: userDataFormat !== "" ? true : false
});
return dataFormat;
},
/** /**
* Claim case * Claim case
* *

View File

@@ -39,25 +39,25 @@ export default {
this.openCase(item); this.openCase(item);
}, },
headings: { headings: {
detail: "",
case_number: this.$i18n.t("ID_MYCASE_NUMBER"), case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
case_title: this.$i18n.t("ID_CASE_TITLE"), case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"), process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"), task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
current_user: this.$i18n.t("ID_CURRENT_USER"), current_user: this.$i18n.t("ID_CURRENT_USER"),
due_date: this.$i18n.t("ID_DUE_DATE"), due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"), delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY") priority: this.$i18n.t("ID_PRIORITY")
}, },
columns: [ columns: [
"detail",
"case_number", "case_number",
"case_title", "case_title",
"process_name", "process_name",
"due_date", "due_date",
"delegation_date", "delegation_date",
"priority", "priority",
"task" "task",
"send_by",
], ],
requestFunction(data) { requestFunction(data) {
return that.getCases(data); return that.getCases(data);

View File

@@ -90,7 +90,7 @@ class EmailServerAjaxTest extends TestCase
$content = $this->requireOnceForEmailServerAjax(); $content = $this->requireOnceForEmailServerAjax();
$data = json_decode($content, JSON_OBJECT_AS_ARRAY); $data = json_decode($content, JSON_OBJECT_AS_ARRAY);
$this->assertContains(200, $data); $this->assertContains(500, $data);
} }
/** /**

View File

@@ -5,7 +5,9 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Draft; use ProcessMaker\BusinessModel\Cases\Draft;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process; use ProcessMaker\Model\Process;
use ProcessMaker\Model\User; use ProcessMaker\Model\User;
@@ -354,6 +356,7 @@ class DraftTest extends TestCase
* It tests the getCountersByProcesses() method with the category filter * It tests the getCountersByProcesses() method with the category filter
* *
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByProcesses() * @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByProcesses()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCountersByProcesses()
* @test * @test
*/ */
public function it_should_test_get_counters_by_processes_method_category() public function it_should_test_get_counters_by_processes_method_category()
@@ -643,6 +646,7 @@ class DraftTest extends TestCase
* It tests the getCountersByRange() method * It tests the getCountersByRange() method
* *
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByRange() * @covers \ProcessMaker\BusinessModel\Cases\Draft::getCountersByRange()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCountersByProcesses()
* @test * @test
*/ */
public function it_should_test_get_counters_by_range_method() 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'); $res = $draft->getCountersByRange(null, '2021-05-20', '2021-05-22');
$this->assertCount(3, $res); $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\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Inbox; use ProcessMaker\BusinessModel\Cases\Inbox;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process; use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task; use ProcessMaker\Model\Task;
@@ -199,6 +201,7 @@ class InboxTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData() * @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView() * @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters() * @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @covers \ProcessMaker\Model\Delegation::scopeTask()
* @test * @test
*/ */
public function it_filter_by_task() public function it_filter_by_task()
@@ -611,4 +614,49 @@ class InboxTest extends TestCase
$res = $inbox->getCountersByRange(null, '2021-05-20', '2021-05-23'); $res = $inbox->getCountersByRange(null, '2021-05-20', '2021-05-23');
$this->assertCount(1, $res); $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,6 +5,7 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Participated; use ProcessMaker\BusinessModel\Cases\Participated;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use Tests\TestCase; use Tests\TestCase;
@@ -26,7 +27,7 @@ class ParticipatedTest extends TestCase
} }
/** /**
* Create participated cases factories * Create participated cases factories when the case is TO_DO
* *
* @param string * @param string
* *
@@ -37,8 +38,9 @@ class ParticipatedTest extends TestCase
$delegation = factory(Delegation::class)->states('foreign_keys')->create([ $delegation = factory(Delegation::class)->states('foreign_keys')->create([
'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_THREAD_STATUS' => 'CLOSED',
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
'DEL_LAST_INDEX' => 0,
]); ]);
$delegation2 = factory(Delegation::class)->states('last_thread')->create([ $delegation = factory(Delegation::class)->states('last_thread')->create([
'APP_NUMBER' => $delegation->APP_NUMBER, 'APP_NUMBER' => $delegation->APP_NUMBER,
'TAS_ID' => $delegation->TAS_ID, 'TAS_ID' => $delegation->TAS_ID,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
@@ -46,9 +48,41 @@ class ParticipatedTest extends TestCase
'USR_ID' => $delegation->USR_ID, 'USR_ID' => $delegation->USR_ID,
'PRO_ID' => $delegation->PRO_ID, 'PRO_ID' => $delegation->PRO_ID,
'DEL_INDEX' => 2, 'DEL_INDEX' => 2,
'DEL_LAST_INDEX' => 1,
]); ]);
return $delegation2; return $delegation;
}
/**
* Create participated cases factories when the case is COMPLETED
*
* @param string
*
* @return array
*/
public function createParticipatedCompleted()
{
$application = factory(Application::class)->states('completed')->create();
$delegation = factory(Delegation::class)->states('first_thread')->create([
'APP_NUMBER' => $application->APP_NUMBER,
'APP_UID' => $application->APP_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'DEL_INDEX' => 1,
'DEL_LAST_INDEX' => 0,
]);
$delegation = factory(Delegation::class)->states('last_thread')->create([
'APP_NUMBER' => $application->APP_NUMBER,
'APP_UID' => $application->APP_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $delegation->USR_UID,
'USR_ID' => $delegation->USR_ID,
'PRO_ID' => $delegation->PRO_ID,
'DEL_INDEX' => 2,
'DEL_LAST_INDEX' => 1,
]);
return $delegation;
} }
/** /**
@@ -67,6 +101,7 @@ class ParticipatedTest extends TestCase
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
'USR_UID' => $user->USR_UID, 'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'DEL_LAST_INDEX' => 0,
]); ]);
factory(Delegation::class)->states('last_thread')->create([ factory(Delegation::class)->states('last_thread')->create([
'APP_UID' => $delegation->APP_UID, 'APP_UID' => $delegation->APP_UID,
@@ -77,6 +112,7 @@ class ParticipatedTest extends TestCase
'USR_ID' => $delegation->USR_ID, 'USR_ID' => $delegation->USR_ID,
'PRO_ID' => $delegation->PRO_ID, 'PRO_ID' => $delegation->PRO_ID,
'DEL_INDEX' => 2, 'DEL_INDEX' => 2,
'DEL_LAST_INDEX' => 1,
]); ]);
} }
return $user; return $user;
@@ -105,9 +141,9 @@ class ParticipatedTest extends TestCase
// Set OrderBYColumn value // Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER'); $participated->setOrderByColumn('APP_NUMBER');
// Get the data // Get the data
$res = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEquals(2, count($res)); $this->assertNotEmpty($result);
} }
/** /**
@@ -137,9 +173,9 @@ class ParticipatedTest extends TestCase
// Set the filter STARTED // Set the filter STARTED
$participated->setParticipatedStatus('STARTED'); $participated->setParticipatedStatus('STARTED');
// Get the data // Get the data
$res = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEquals(1, count($res)); $this->assertNotEmpty($result);
} }
/** /**
@@ -156,7 +192,7 @@ class ParticipatedTest extends TestCase
public function it_filter_by_completed_by_me() public function it_filter_by_completed_by_me()
{ {
// Create factories related to the participated cases // Create factories related to the participated cases
$cases = $this->createParticipated(); $cases = $this->createParticipatedCompleted();
// Create new Participated object // Create new Participated object
$participated = new Participated(); $participated = new Participated();
// Set the user UID // Set the user UID
@@ -166,9 +202,9 @@ class ParticipatedTest extends TestCase
// Set the filter COMPLETED // Set the filter COMPLETED
$participated->setParticipatedStatus('COMPLETED'); $participated->setParticipatedStatus('COMPLETED');
// Get the data // Get the data
$res = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEquals(0, count($res)); $this->assertNotEmpty($result);
} }
/** /**
@@ -198,9 +234,9 @@ class ParticipatedTest extends TestCase
// Set the process // Set the process
$participated->setProcessId($cases['PRO_ID']); $participated->setProcessId($cases['PRO_ID']);
// Get the data // Get the data
$res = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEquals(2, count($res)); $this->assertNotEmpty($result);
} }
/** /**
@@ -227,9 +263,9 @@ class ParticipatedTest extends TestCase
// Set the case numbers // Set the case numbers
$participated->setCasesNumbers([$cases['APP_NUMBER']]); $participated->setCasesNumbers([$cases['APP_NUMBER']]);
// Get the data // Get the data
$res = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEquals(2, count($res)); $this->assertNotEmpty($result);
} }
/** /**
@@ -257,9 +293,9 @@ class ParticipatedTest extends TestCase
$rangeOfCases = $cases['APP_NUMBER'] . "-" . $cases['APP_NUMBER']; $rangeOfCases = $cases['APP_NUMBER'] . "-" . $cases['APP_NUMBER'];
$participated->setRangeCasesFromTo([$rangeOfCases]); $participated->setRangeCasesFromTo([$rangeOfCases]);
// Get the data // Get the data
$res = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEquals(2, count($res)); $this->assertNotEmpty($result);
} }
/** /**
@@ -291,9 +327,9 @@ class ParticipatedTest extends TestCase
// Set the title // Set the title
$participated->setCaseTitle($cases->DEL_TITLE); $participated->setCaseTitle($cases->DEL_TITLE);
// Get the data // Get the data
$res = $participated->getData(); $result = $participated->getData();
// Asserts // Asserts with the result
$this->assertCount(1, $res); $this->assertNotEmpty($result);
} }
/** /**
@@ -324,7 +360,7 @@ class ParticipatedTest extends TestCase
$participated->setCaseStatus('TO_DO'); $participated->setCaseStatus('TO_DO');
// Get the data // Get the data
$result = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
@@ -359,7 +395,7 @@ class ParticipatedTest extends TestCase
$participated->setStartCaseTo($date); $participated->setStartCaseTo($date);
// Get the data // Get the data
$result = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEmpty($result); $this->assertEmpty($result);
} }
@@ -394,7 +430,7 @@ class ParticipatedTest extends TestCase
$participated->setFinishCaseTo($date); $participated->setFinishCaseTo($date);
// Get the data // Get the data
$result = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEmpty($result); $this->assertEmpty($result);
} }
@@ -419,11 +455,39 @@ class ParticipatedTest extends TestCase
$participated->setUserId($cases->USR_ID); $participated->setUserId($cases->USR_ID);
// Set participated status // Set participated status
$participated->setParticipatedStatus('IN_PROGRESS'); $participated->setParticipatedStatus('IN_PROGRESS');
// Get result // Get the data
$result = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
/**
* It tests the specific filter setParticipatedStatus = STARTED
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setParticipatedStatus()
* @test
*/
public function it_get_status_started()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set participated status
$participated->setParticipatedStatus('STARTED');
// Get the data
$result = $participated->getData();
// Asserts with the result
$this->assertNotEmpty($result);
}
/** /**
* It tests the specific filter setParticipatedStatus = COMPLETED * It tests the specific filter setParticipatedStatus = COMPLETED
* *
@@ -436,7 +500,7 @@ class ParticipatedTest extends TestCase
public function it_get_status_completed() public function it_get_status_completed()
{ {
// Create factories related to the participated cases // Create factories related to the participated cases
$cases = $this->createParticipated(); $cases = $this->createParticipatedCompleted();
// Create new Participated object // Create new Participated object
$participated = new Participated(); $participated = new Participated();
// Set the user UID // Set the user UID
@@ -445,10 +509,10 @@ class ParticipatedTest extends TestCase
$participated->setUserId($cases->USR_ID); $participated->setUserId($cases->USR_ID);
// Set participated status // Set participated status
$participated->setParticipatedStatus('COMPLETED'); $participated->setParticipatedStatus('COMPLETED');
// Get result // Get the data
$result = $participated->getData(); $result = $participated->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEmpty($result); $this->assertNotEmpty($result);
} }
/** /**
@@ -460,7 +524,22 @@ class ParticipatedTest extends TestCase
*/ */
public function it_get_counter() public function it_get_counter()
{ {
// Create factories related to the participated cases // Create factories related to the in started cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set participated status
$participated->setParticipatedStatus('STARTED');
// Get the data
$result = $participated->getCounter();
// Asserts with the result
$this->assertTrue($result > 0);
// Create factories related to the in progress cases
$cases = $this->createParticipated(); $cases = $this->createParticipated();
// Create new Participated object // Create new Participated object
$participated = new Participated(); $participated = new Participated();
@@ -470,10 +549,25 @@ class ParticipatedTest extends TestCase
$participated->setUserId($cases->USR_ID); $participated->setUserId($cases->USR_ID);
// Set participated status // Set participated status
$participated->setParticipatedStatus('IN_PROGRESS'); $participated->setParticipatedStatus('IN_PROGRESS');
// Get result // Get the data
$res = $participated->getCounter(); $result = $participated->getCounter();
// Assert the result of getCounter method // Asserts with the result
$this->assertEquals(1, $res); $this->assertTrue($result > 0);
// Create factories related to the complete cases
$cases = $this->createParticipatedCompleted();
// Create new Participated object
$participated = new Participated();
// Set the user UID
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Set participated status
$participated->setParticipatedStatus('COMPLETED');
// Get the data
$result = $participated->getCounter();
// Asserts with the result
$this->assertTrue($result > 0);
} }
/** /**
@@ -485,20 +579,40 @@ class ParticipatedTest extends TestCase
*/ */
public function it_should_test_get_paging_counters_method() public function it_should_test_get_paging_counters_method()
{ {
$cases = $this->createMultipleParticipated(3); // Create factories related to the in started cases
$cases = $this->createParticipated();
$participated = new Participated(); $participated = new Participated();
$participated->setUserId($cases->USR_ID); $participated->setUserId($cases->USR_ID);
$participated->setUserUid($cases->USR_UID); $participated->setUserUid($cases->USR_UID);
$participated->setCaseUid($cases->APP_UID);
$participated->setParticipatedStatus('STARTED'); $participated->setParticipatedStatus('STARTED');
$res = $participated->getPagingCounters(); // Get the data
$this->assertEquals(3, $res); $result = $participated->getPagingCounters();
// Asserts with the result
$this->assertTrue($result >= 0);
$delegation = Delegation::select()->where('USR_ID', $cases->USR_ID)->first(); // Create factories related to the in progress cases
$participated->setCaseNumber($delegation->APP_NUMBER); $cases = $this->createParticipated();
$participated->setProcessId($delegation->PRO_ID); $participated = new Participated();
$participated->setTaskId($delegation->TAS_ID); $participated->setUserId($cases->USR_ID);
$participated->setCaseUid($delegation->APP_UID); $participated->setUserUid($cases->USR_UID);
$res = $participated->getPagingCounters(); $participated->setCaseUid($cases->APP_UID);
$this->assertEquals(1, $res); $participated->setParticipatedStatus('IN_PROGRESS');
// Get the data
$result = $participated->getPagingCounters();
// Asserts with the result
$this->assertTrue($result >= 0);
// Create factories related to the complete cases
$cases = $this->createParticipatedCompleted();
$participated = new Participated();
$participated->setUserId($cases->USR_ID);
$participated->setUserUid($cases->USR_UID);
$participated->setCaseUid($cases->APP_UID);
$participated->setParticipatedStatus('COMPLETED');
// Get the data
$result = $participated->getPagingCounters();
// Asserts with the result
$this->assertTrue($result >= 0);
} }
} }

View File

@@ -5,8 +5,10 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Paused; use ProcessMaker\BusinessModel\Cases\Paused;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\AppDelay; use ProcessMaker\Model\AppDelay;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process; use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task; use ProcessMaker\Model\Task;
@@ -606,4 +608,49 @@ class PausedTest extends TestCase
$res = $paused->getCountersByRange(null, '2021-05-20', '2021-05-23'); $res = $paused->getCountersByRange(null, '2021-05-20', '2021-05-23');
$this->assertCount(1, $res); $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

@@ -56,7 +56,7 @@ class SearchTest extends TestCase
// Create new Search object // Create new Search object
$search = new Search(); $search = new Search();
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
@@ -67,7 +67,6 @@ class SearchTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView() * @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters() * @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Search::setCaseNumber() * @covers \ProcessMaker\BusinessModel\Cases\Search::setCaseNumber()
* @covers \ProcessMaker\BusinessModel\Cases\Search::setOrderByColumn()
* @test * @test
*/ */
public function it_filter_by_app_number() public function it_filter_by_app_number()
@@ -77,10 +76,8 @@ class SearchTest extends TestCase
// Create new Search object // Create new Search object
$search = new Search(); $search = new Search();
$search->setCaseNumber($cases[0]->APP_NUMBER); $search->setCaseNumber($cases[0]->APP_NUMBER);
// Set order by column value
$search->setOrderByColumn('APP_NUMBER');
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']); $this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
} }
@@ -101,7 +98,7 @@ class SearchTest extends TestCase
$search = new Search(); $search = new Search();
$search->setCasesNumbers([$cases[0]->APP_NUMBER]); $search->setCasesNumbers([$cases[0]->APP_NUMBER]);
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']); $this->assertEquals($cases[0]->APP_NUMBER, $result[0]['APP_NUMBER']);
} }
@@ -123,7 +120,31 @@ class SearchTest extends TestCase
$rangeOfCases = $cases[0]->APP_NUMBER . "-" . $cases[0]->APP_NUMBER; $rangeOfCases = $cases[0]->APP_NUMBER . "-" . $cases[0]->APP_NUMBER;
$search->setRangeCasesFromTo([$rangeOfCases]); $search->setRangeCasesFromTo([$rangeOfCases]);
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertNotEmpty($result);
}
/**
* Tests the specific filter setCasesNumbers and setRangeCasesFromTo
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Search::setCasesNumbers()
* @covers \ProcessMaker\BusinessModel\Cases\Search::setRangeCasesFromTo()
* @test
*/
public function it_filter_by_cases_and_range_cases()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
// Create new Search object
$search = new Search();
$search->setCasesNumbers([$cases[0]->APP_NUMBER]);
$rangeOfCases = $cases[0]->APP_NUMBER . "-" . $cases[0]->APP_NUMBER;
$search->setRangeCasesFromTo([$rangeOfCases]);
$result = $search->getData();
// Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
@@ -144,7 +165,7 @@ class SearchTest extends TestCase
$search = new Search(); $search = new Search();
$search->setProcessId($cases[0]->PRO_ID); $search->setProcessId($cases[0]->PRO_ID);
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
@@ -165,7 +186,7 @@ class SearchTest extends TestCase
$search = new Search(); $search = new Search();
$search->setTaskId($cases[0]->TAS_ID); $search->setTaskId($cases[0]->TAS_ID);
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
@@ -195,6 +216,27 @@ class SearchTest extends TestCase
$this->assertNotEmpty($res); $this->assertNotEmpty($res);
} }
/**
* It tests the getData with setCategoryId
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Search::setCategoryId()
* @test
*/
public function it_filter_by_category()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
// Create new Search object
$search = new Search();
$search->setCategoryId(12);
$result = $search->getData();
// Asserts with the result
$this->assertEmpty($result);
}
/** /**
* It tests the getData with user * It tests the getData with user
* *
@@ -212,12 +254,12 @@ class SearchTest extends TestCase
$search = new Search(); $search = new Search();
$search->setUserId($cases[0]->USR_ID); $search->setUserId($cases[0]->USR_ID);
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
/** /**
* It tests the getData with user * It tests the getData with setStartCaseFrom and setStartCaseTo
* *
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData() * @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView() * @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
@@ -236,7 +278,31 @@ class SearchTest extends TestCase
$search->setStartCaseFrom($date); $search->setStartCaseFrom($date);
$search->setStartCaseTo($date); $search->setStartCaseTo($date);
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEmpty($result);
}
/**
* It tests the getData with setFinishCaseFrom and setFinishCaseTo
*
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Search::setFinishCaseFrom()
* @covers \ProcessMaker\BusinessModel\Cases\Search::setFinishCaseTo()
* @test
*/
public function it_filter_by_finish_date()
{
// Create factories related to the delegation cases
$cases = $this->createSearch();
// Create new Search object
$search = new Search();
$date = date('Y-m-d');
$search->setFinishCaseFrom($date);
$search->setFinishCaseTo($date);
$result = $search->getData();
// Asserts with the result
$this->assertEmpty($result); $this->assertEmpty($result);
} }
@@ -257,7 +323,7 @@ class SearchTest extends TestCase
$search = new Search(); $search = new Search();
$search->setCaseStatuses(['TO_DO']); $search->setCaseStatuses(['TO_DO']);
$result = $search->getData(); $result = $search->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }

View File

@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Supervising; use ProcessMaker\BusinessModel\Cases\Supervising;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\GroupUser;
use ProcessMaker\Model\Process; use ProcessMaker\Model\Process;
use ProcessMaker\Model\ProcessUser; use ProcessMaker\Model\ProcessUser;
use ProcessMaker\Model\Task; use ProcessMaker\Model\Task;
@@ -30,19 +31,26 @@ class SupervisingTest extends TestCase
/** /**
* Create supervising cases factories * Create supervising cases factories
* This function define a specific user in the supervisors list
* *
* @param string * @param int $cases
* *
* @return array * @return array
*/ */
public function createSupervising() public function createSupervising(int $cases = 2)
{ {
// Create process // Create process
$process = factory(Process::class)->create(); $process = factory(Process::class)->create();
// Create user // Create user
$user = factory(User::class)->create(); $user = factory(User::class)->create();
// Define this user like process supervisor
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
// Create a task // Create a task
$task = factory(Task::class)->create([ $task = factory(Task::class)->create([
'TAS_ASSIGN_TYPE' => 'NORMAL', 'TAS_ASSIGN_TYPE' => 'NORMAL',
@@ -54,100 +62,32 @@ class SupervisingTest extends TestCase
'TAS_GROUP_VARIABLE' => '', 'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
]); ]);
// Create n cases related to the process
// Create 3 cases $delegation = [];
$app1 = factory(Application::class)->states('todo')->create([ for ($i = 0; $i < $cases; $i = $i + 1) {
'APP_STATUS' => 'TO_DO', // Create case
'APP_STATUS_ID' => 2, $app = factory(Application::class)->states('todo')->create([
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID, 'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID,
]); ]);
$app2 = factory(Application::class)->states('todo')->create([ // Create two threads
'APP_STATUS' => 'TO_DO', $delegation = factory(Delegation::class)->create([
'APP_STATUS_ID' => 2, 'APP_UID' => $app['APP_UID'],
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app3 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
// Create the registers in delegation
factory(Delegation::class)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task->TAS_ID, 'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID, 'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID, 'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'], 'APP_NUMBER' => $app['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' => 1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0 'DEL_PREVIOUS' => 0,
]); 'DEL_LAST_INDEX' => 0
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' => 1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0
]); ]);
$delegation = factory(Delegation::class)->create([ $delegation = factory(Delegation::class)->create([
"APP_UID" => $app3['APP_UID'], 'APP_UID' => $app['APP_UID'],
'TAS_ID' => $task2->TAS_ID, 'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID, 'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
@@ -155,40 +95,42 @@ class SupervisingTest extends TestCase
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'], 'APP_NUMBER' => $app['APP_NUMBER'],
'DEL_INDEX' => 2, 'DEL_INDEX' => 2,
'DEL_PREVIOUS' => 1 'DEL_PREVIOUS' => 1,
'DEL_LAST_INDEX' => 1
]); ]);
}
// Create the register in the ProcessUser table
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
return $delegation; return $delegation;
} }
/** /**
* Create many supervising cases for one user * Create supervising cases factories
* This function define a group user in the supervisors list
* *
* @param int * @param int $cases
* @return object *
* @return array
*/ */
public function createMultipleSupervising($cases) public function createGroupSupervising(int $cases = 2)
{ {
$user = factory(\ProcessMaker\Model\User::class)->create();
for ($i = 0; $i < $cases; $i = $i + 1) {
// Create process // Create process
$process = factory(Process::class)->create(); $process = factory(Process::class)->create();
// Create user // Create user
$user = factory(User::class)->create(); $user = factory(User::class)->create();
// Create group
$group = factory(GroupUser::class)->create([
'USR_UID' => $user->USR_UID,
]);
// Define this group like process supervisor
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $group->GRP_UID,
'PU_TYPE' => 'GROUP_SUPERVISOR'
]
);
// Create a task // Create a task
$task = factory(Task::class)->create([ $task = factory(Task::class)->create([
'TAS_ASSIGN_TYPE' => 'NORMAL', 'TAS_ASSIGN_TYPE' => 'NORMAL',
@@ -200,100 +142,32 @@ class SupervisingTest extends TestCase
'TAS_GROUP_VARIABLE' => '', 'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
]); ]);
// Create n cases related to the process
// Create 3 cases $delegation = [];
$app1 = factory(Application::class)->states('todo')->create([ for ($i = 0; $i < $cases; $i = $i + 1) {
'APP_STATUS' => 'TO_DO', // Create case
'APP_STATUS_ID' => 2, $app = factory(Application::class)->states('todo')->create([
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID, 'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID, 'APP_CUR_USER' => $user->USR_UID,
]); ]);
$app2 = factory(Application::class)->states('todo')->create([ // Create two threads
'APP_STATUS' => 'TO_DO', $delegation = factory(Delegation::class)->create([
'APP_STATUS_ID' => 2, 'APP_UID' => $app['APP_UID'],
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
$app3 = factory(Application::class)->states('todo')->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
// Create the registers in delegation
factory(Delegation::class)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task->TAS_ID, 'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID, 'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app1['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID, 'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app1['APP_NUMBER'], 'APP_NUMBER' => $app['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' => 1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0 'DEL_PREVIOUS' => 0,
]); 'DEL_LAST_INDEX' => 0
factory(Delegation::class, 1)->create([
"APP_UID" => $app2['APP_UID'],
'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app2['APP_NUMBER'],
'DEL_INDEX' => 2,
'DEL_PREVIOUS' => 1
]);
factory(Delegation::class, 1)->create([
"APP_UID" => $app3['APP_UID'],
'TAS_ID' => $task->TAS_ID,
'TAS_UID' => $task->TAS_UID,
'DEL_THREAD_STATUS' => 'CLOSED',
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'],
'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0
]); ]);
$delegation = factory(Delegation::class)->create([ $delegation = factory(Delegation::class)->create([
"APP_UID" => $app3['APP_UID'], 'APP_UID' => $app['APP_UID'],
'TAS_ID' => $task2->TAS_ID, 'TAS_ID' => $task2->TAS_ID,
'TAS_UID' => $task2->TAS_UID, 'TAS_UID' => $task2->TAS_UID,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
@@ -301,21 +175,14 @@ class SupervisingTest extends TestCase
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'APP_NUMBER' => $app3['APP_NUMBER'], 'APP_NUMBER' => $app['APP_NUMBER'],
'DEL_INDEX' => 2, 'DEL_INDEX' => 2,
'DEL_PREVIOUS' => 1 'DEL_PREVIOUS' => 1,
'DEL_LAST_INDEX' => 1
]); ]);
// Create the register in the ProcessUser table
factory(ProcessUser::class)->create(
[
'PRO_UID' => $process->PRO_UID,
'USR_UID' => $user->USR_UID,
'PU_TYPE' => 'SUPERVISOR'
]
);
} }
return $user;
return $delegation;
} }
/** /**
@@ -337,8 +204,8 @@ class SupervisingTest extends TestCase
$supervising->setUserId($cases->USR_ID); $supervising->setUserId($cases->USR_ID);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts the result contains 3 registers // Asserts with the result
$this->assertCount(3, $result); $this->assertNotEmpty($result);
} }
/** /**
@@ -360,8 +227,8 @@ class SupervisingTest extends TestCase
$supervising->setUserId($cases->USR_ID); $supervising->setUserId($cases->USR_ID);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts the result contains 3 registers // Asserts with the result
$this->assertCount(3, $result); $this->assertNotEmpty($result);
} }
/** /**
@@ -384,7 +251,7 @@ class SupervisingTest extends TestCase
$supervising->setUserId($user->USR_ID); $supervising->setUserId($user->USR_ID);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts the result // Asserts with the result
$this->assertEmpty($result); $this->assertEmpty($result);
} }
@@ -412,10 +279,8 @@ class SupervisingTest extends TestCase
$supervising->setCaseNumber($cases->APP_NUMBER); $supervising->setCaseNumber($cases->APP_NUMBER);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts the result contains 3 registers // Asserts with the result
$this->assertCount(1, $result); $this->assertNotEmpty($result);
// Asserts that the result contains the app number searched
$this->assertContains($cases->APP_NUMBER, $result[0]);
} }
/** /**
@@ -442,10 +307,8 @@ class SupervisingTest extends TestCase
$supervising->setCasesNumbers([$cases->APP_NUMBER]); $supervising->setCasesNumbers([$cases->APP_NUMBER]);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts the result contains 3 registers // Asserts with the result
$this->assertCount(1, $result); $this->assertNotEmpty($result);
// Asserts that the result contains the app number searched
$this->assertContains($cases->APP_NUMBER, $result[0]);
} }
/** /**
@@ -473,10 +336,39 @@ class SupervisingTest extends TestCase
$supervising->setRangeCasesFromTo([$rangeOfCases]); $supervising->setRangeCasesFromTo([$rangeOfCases]);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts the result contains 3 registers // Asserts with the result
$this->assertCount(1, $result); $this->assertNotEmpty($result);
// Asserts that the result contains the app number searched }
$this->assertContains($cases->APP_NUMBER, $result[0]);
/**
* Tests the specific filter setCasesNumbers and setRangeCasesFromTo
*
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserUid()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setUserId()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCasesNumbers()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setRangeCasesFromTo()
* @test
*/
public function it_filter_by_cases_and_range_cases()
{
$cases = $this->createSupervising();
// Instance the Supervising object
$supervising = new Supervising();
// Set the user UID
$supervising->setUserUid($cases->USR_UID);
// Set the user ID
$supervising->setUserId($cases->USR_ID);
// Set the range of case numbers
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
$supervising->setCasesNumbers([$cases->APP_NUMBER]);
$supervising->setRangeCasesFromTo([$rangeOfCases]);
// Get the data
$result = $supervising->getData();
// Asserts with the result
$this->assertNotEmpty($result);
} }
/** /**
@@ -509,8 +401,8 @@ class SupervisingTest extends TestCase
$supervising->setCaseTitle($title); $supervising->setCaseTitle($title);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts // Asserts with the result
$this->assertCount(1, $result); $this->assertNotEmpty($result);
} }
/** /**
@@ -537,7 +429,8 @@ class SupervisingTest extends TestCase
$supervising->setProcessId($cases['PRO_ID']); $supervising->setProcessId($cases['PRO_ID']);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
$this->assertCount(3, $result); // Asserts with the result
$this->assertNotEmpty($result);
} }
/** /**
@@ -564,7 +457,8 @@ class SupervisingTest extends TestCase
$supervising->setTaskId($cases['TAS_ID']); $supervising->setTaskId($cases['TAS_ID']);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
$this->assertCount(3, $result); // Asserts with the result
$this->assertNotEmpty($result);
} }
/** /**
@@ -591,6 +485,7 @@ class SupervisingTest extends TestCase
$supervising->setCaseStatus('TO_DO'); $supervising->setCaseStatus('TO_DO');
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
@@ -621,7 +516,7 @@ class SupervisingTest extends TestCase
$supervising->setStartCaseTo($date); $supervising->setStartCaseTo($date);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEmpty($result); $this->assertEmpty($result);
} }
@@ -652,7 +547,7 @@ class SupervisingTest extends TestCase
$supervising->setFinishCaseTo($date); $supervising->setFinishCaseTo($date);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// This assert that the expected numbers of results are returned // Asserts with the result
$this->assertEmpty($result); $this->assertEmpty($result);
} }
@@ -687,6 +582,7 @@ class SupervisingTest extends TestCase
$supervising->setOrderByColumn($columnsView[$index]); $supervising->setOrderByColumn($columnsView[$index]);
// Get the data // Get the data
$result = $supervising->getData(); $result = $supervising->getData();
// Asserts with the result
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
@@ -709,24 +605,27 @@ class SupervisingTest extends TestCase
$supervising->setUserId($cases->USR_ID); $supervising->setUserId($cases->USR_ID);
// Get the data // Get the data
$result = $supervising->getCounter(); $result = $supervising->getCounter();
// Assert the counter // Asserts with the result
$this->assertEquals(3, $result); $this->assertTrue($result > 0 );
} }
/** /**
* It tests the getPagingCounters() method * It tests the getPagingCounters() method
* *
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getPagingCounters() * @covers \ProcessMaker\BusinessModel\Cases\Supervising::getPagingCounters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @test * @test
*/ */
public function it_should_test_get_paging_counters_method() public function it_should_test_get_paging_counters_method()
{ {
$cases = $this->createMultipleSupervising(3); $cases = $this->createSupervising(3);
$supervising = new Supervising(); $supervising = new Supervising();
$supervising->setUserId($cases->USR_ID); $supervising->setUserId($cases->USR_ID);
$supervising->setUserUid($cases->USR_UID); $supervising->setUserUid($cases->USR_UID);
$supervising->setCaseUid($cases->APP_UID);
// Get the count // Get the count
$result = $supervising->getPagingCounters(); $result = $supervising->getPagingCounters();
$this->assertEquals(3, $result); // Asserts with the result
$this->assertTrue($result > 0 );
} }
} }

View File

@@ -5,9 +5,11 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Cases\Unassigned; use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\Model\AdditionalTables;
use ProcessMaker\Model\AppAssignSelfServiceValue; use ProcessMaker\Model\AppAssignSelfServiceValue;
use ProcessMaker\Model\AppAssignSelfServiceValueGroup; use ProcessMaker\Model\AppAssignSelfServiceValueGroup;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\GroupUser; use ProcessMaker\Model\GroupUser;
use ProcessMaker\Model\Groupwf; use ProcessMaker\Model\Groupwf;
@@ -657,4 +659,68 @@ class UnassignedTest extends TestCase
$res = $unassigned->getCountersByRange(null, '2021-05-20', '2021-05-23'); $res = $unassigned->getCountersByRange(null, '2021-05-20', '2021-05-23');
$this->assertCount(1, $res); $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 Exception;
use G; use G;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use ProcessMaker\Model\AppDelay;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Documents; 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 // 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')); 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() 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()); $this->assertCount(1, $table->caseStarted($table->DEL_INDEX)->get());
} }
@@ -426,6 +426,42 @@ class DelegationTest extends TestCase
$this->assertCount(1, $table->dueTo($table->DEL_TASK_DUE_DATE)->get()); $this->assertCount(1, $table->dueTo($table->DEL_TASK_DUE_DATE)->get());
} }
/**
* This test scopeOnTime
*
* @covers \ProcessMaker\Model\Delegation::scopeOnTime()
* @test
*/
public function it_return_scope_on_time()
{
$table = factory(Delegation::class)->states('closed')->create();
$this->assertCount(1, $table->onTime($table->DEL_DELEGATE_DATE)->get());
}
/**
* This test scopeAtRisk
*
* @covers \ProcessMaker\Model\Delegation::scopeAtRisk()
* @test
*/
public function it_return_scope_at_risk()
{
$table = factory(Delegation::class)->states('closed')->create();
$this->assertCount(1, $table->atRisk($table->DEL_DELEGATE_DATE)->get());
}
/**
* This test scopeOverdue
*
* @covers \ProcessMaker\Model\Delegation::scopeOverdue()
* @test
*/
public function it_return_scope_overdue()
{
$table = factory(Delegation::class)->states('closed')->create();
$this->assertCount(1, $table->overdue($table->DEL_DELEGATE_DATE)->get());
}
/** /**
* This test scopeCase * This test scopeCase
* *
@@ -496,7 +532,7 @@ class DelegationTest extends TestCase
{ {
$table = factory(Delegation::class)->states('foreign_keys')->create(); $table = factory(Delegation::class)->states('foreign_keys')->create();
$cases = [$table->APP_NUMBER]; $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()); $this->assertCount(1, $table->casesOrRangeOfCases($cases, $rangeCases)->get());
} }
@@ -2114,6 +2150,8 @@ class DelegationTest extends TestCase
//Review the self-service records //Review the self-service records
$result = Delegation::getSelfService($user->USR_UID); $result = Delegation::getSelfService($user->USR_UID);
$this->assertEquals(25, count($result)); $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));
} }
/** /**
@@ -3196,6 +3234,28 @@ class DelegationTest extends TestCase
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
/**
* This check the return of thread info
*
* @covers \ProcessMaker\Model\Delegation::getDatesFromThread()
* @test
*/
public function it_get_thread_dates()
{
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
$task = new Task();
$taskInfo = $task->load($delegation->TAS_UID);
$taskInfo = head($taskInfo);
$taskType = $taskInfo['TAS_TYPE'];
$result = Delegation::getDatesFromThread(
$delegation->APP_UID,
$delegation->DEL_INDEX,
$delegation->TAS_UID,
$taskType
);
$this->assertNotEmpty($result);
}
/** /**
* This check the return of pending threads * This check the return of pending threads
* *
@@ -3207,6 +3267,8 @@ class DelegationTest extends TestCase
$delegation = factory(Delegation::class)->states('foreign_keys')->create(); $delegation = factory(Delegation::class)->states('foreign_keys')->create();
$result = Delegation::getPendingThreads($delegation->APP_NUMBER); $result = Delegation::getPendingThreads($delegation->APP_NUMBER);
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
$result = Delegation::getPendingThreads($delegation->APP_NUMBER, false);
$this->assertNotEmpty($result);
} }
/** /**
@@ -3283,9 +3345,9 @@ class DelegationTest extends TestCase
]); ]);
$res = Delegation::hasActiveParentsCases($parents); $res = Delegation::hasActiveParentsCases($parents);
// Assert the result is true
$this->assertTrue($res); $this->assertTrue($res);
$res = Delegation::hasActiveParentsCases([]);
$this->assertFalse($res);
} }
/** /**
@@ -3296,9 +3358,9 @@ class DelegationTest extends TestCase
*/ */
public function it_get_cases_completed_by_specific_user() public function it_get_cases_completed_by_specific_user()
{ {
$delegation = factory(Delegation::class)->states('foreign_keys')->create(); $delegation = factory(Delegation::class)->states('last_thread')->create();
$result = Delegation::casesCompletedBy($delegation->USR_ID); $result = Delegation::casesCompletedBy($delegation->USR_ID);
$this->assertEmpty($result); $this->assertNotEmpty($result);
} }
/** /**
@@ -3309,7 +3371,7 @@ class DelegationTest extends TestCase
*/ */
public function it_get_cases_started_by_specific_user() 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); $result = Delegation::casesStartedBy($delegation->USR_ID);
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }

View File

@@ -799,36 +799,40 @@ class Calendar extends CalendarDefinition
return $return; return $return;
} }
/**
* Calculate date adding a duration, will considerate the calendar
*
* @param string $initialDate
/**************SLA classes***************/ * @param string $duration
public function dashCalculateDate ($iniDate, $duration, $formatDuration, $calendarData = array()) * @param string $formatDuration
* @param array $calendarData
*
* @return string
*/
public function dashCalculateDate($initialDate, $duration, $formatDuration, $calendarData = [])
{ {
if ( G::toUpper($formatDuration) == 'DAYS' ) { if (G::toUpper($formatDuration) == 'DAYS') {
$duration = $duration*$calendarData['HOURS_FOR_DAY']; $duration = $duration * $calendarData['HOURS_FOR_DAY'];
} }
if ( G::toUpper($formatDuration) == 'MINUTES' ) { if (G::toUpper($formatDuration) == 'MINUTES') {
$duration = $duration/60; $duration = $duration / 60;
} }
$hoursDuration = (float)$duration; $hoursDuration = (float)$duration;
$newDate = $iniDate; $newDate = $initialDate;
while ($hoursDuration > 0) { while ($hoursDuration > 0) {
$newDate = $this->dashGetIniDate($newDate, $calendarData); $newDate = $this->dashGetIniDate($newDate, $calendarData);
$rangeWorkHour = $this->dashGetRangeWorkHours($newDate, $calendarData['BUSINESS_DAY']); $rangeWorkHour = $this->dashGetRangeWorkHours($newDate, $calendarData['BUSINESS_DAY']);
$onlyDate = (date('Y-m-d',strtotime($newDate))) . ' ' . $rangeWorkHour['END']; $onlyDate = (date('Y-m-d', strtotime($newDate))) . ' ' . $rangeWorkHour['END'];
$rangeWorkHourTotal = (float)$rangeWorkHour['TOTAL'];
if ( (((float)$hoursDuration) >= ((float)$rangeWorkHour['TOTAL'])) || if ($hoursDuration >= $rangeWorkHourTotal ||
((strtotime($onlyDate) - strtotime($newDate)) < (((float)$hoursDuration)*3600)) ((strtotime($onlyDate) - strtotime($newDate)) < (($hoursDuration) * 3600))
) { ) {
$secondRes = (float)(strtotime($onlyDate) - strtotime($newDate)); $secondRes = (float)(strtotime($onlyDate) - strtotime($newDate));
$newDate = $onlyDate; $newDate = $onlyDate;
$hoursDuration -= (float)($secondRes/3600); $hoursDuration -= (float)($secondRes / 3600);
} else { } else {
$newDate = date('Y-m-d H:i:s', strtotime('+' . round((((float)$hoursDuration)*3600), 5) . ' seconds', strtotime($newDate))); $newDate = date('Y-m-d H:i:s', strtotime('+' . round((($hoursDuration) * 3600), 5) . ' seconds', strtotime($newDate)));
$hoursDuration = 0; $hoursDuration = 0;
} }
} }

View File

@@ -41,6 +41,22 @@ use ProcessMaker\Plugins\PluginRegistry;
*/ */
class AppDelegation extends BaseAppDelegation class AppDelegation extends BaseAppDelegation
{ {
/**
* Get the risk value
*
* @return double
*/
public function getRisk()
{
try {
$risk = 2;
return $risk;
} catch (Exception $e) {
throw $e;
}
}
/** /**
* Get previous delegation (Valid Task) * Get previous delegation (Valid Task)
* *
@@ -91,42 +107,59 @@ class AppDelegation extends BaseAppDelegation
} }
/** /**
* create an application delegation * Create an application delegation
* *
* @param $sProUid process Uid * @param string $proUid process Uid
* @param $sAppUid Application Uid * @param string $appUid Application Uid
* @param $sTasUid Task Uid * @param string $tasUid Task Uid
* @param $sUsrUid User Uid * @param string $usrUid User Uid
* @param $iPriority delegation priority * @param int $priority delegation priority
* @param $isSubprocess is a subprocess inside a process? * @param bool $isSubprocess is a subprocess inside a process?
* @return delegation index of the application delegation. *
* @return int index of the application delegation.
*/ */
public function createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0, $appNumber = 0, $taskId = 0, $userId = 0, $proId = 0) public function createAppDelegation(
{ $proUid,
if (! isset($sProUid) || strlen($sProUid) == 0) { $appUid,
throw (new Exception('Column "PRO_UID" cannot be null.')); $tasUid,
$usrUid,
$sAppThread,
$priority = 3,
$isSubprocess = false,
$previous = -1,
$nextTasParam = null,
$flagControl = false,
$flagControlMulInstance = false,
$delPrevious = 0,
$appNumber = 0,
$taskId = 0,
$userId = 0,
$proId = 0
){
if (! isset($proUid) || strlen($proUid) == 0) {
throw new Exception('Column "PRO_UID" cannot be null.');
} }
if (! isset($sAppUid) || strlen($sAppUid) == 0) { if (! isset($appUid) || strlen($appUid) == 0) {
throw (new Exception('Column "APP_UID" cannot be null.')); throw new Exception('Column "APP_UID" cannot be null.');
} }
if (! isset($sTasUid) || strlen($sTasUid) == 0) { if (! isset($tasUid) || strlen($tasUid) == 0) {
throw (new Exception('Column "TAS_UID" cannot be null.')); throw new Exception('Column "TAS_UID" cannot be null.');
} }
if (! isset($sUsrUid) /*|| strlen($sUsrUid ) == 0*/) { if (! isset($usrUid)) {
throw (new Exception('Column "USR_UID" cannot be null.')); throw new Exception('Column "USR_UID" cannot be null.');
} }
if (! isset($sAppThread) || strlen($sAppThread) == 0) { if (! isset($sAppThread) || strlen($sAppThread) == 0) {
throw (new Exception('Column "APP_THREAD" cannot be null.')); throw new Exception('Column "APP_THREAD" cannot be null.');
} }
$this->delegation_id = null; $this->delegation_id = null;
//Get max DEL_INDEX // Get max DEL_INDEX
$criteria = new Criteria("workflow"); $criteria = new Criteria("workflow");
$criteria->add(AppDelegationPeer::APP_UID, $sAppUid); $criteria->add(AppDelegationPeer::APP_UID, $appUid);
$criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1); $criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1);
$criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX); $criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
@@ -136,8 +169,8 @@ class AppDelegation extends BaseAppDelegation
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$delIndex = 1; $delIndex = 1;
$delPreviusUsrUid = $sUsrUid; $delPreviusUsrUid = $usrUid;
$delPreviousFather = $sPrevious; $delPreviousFather = $previous;
if ($rs->next()) { if ($rs->next()) {
$row = $rs->getRow(); $row = $rs->getRow();
@@ -149,7 +182,7 @@ class AppDelegation extends BaseAppDelegation
$criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_INDEX); $criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); $criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
$criteriaDelIndex->add(AppDelegationPeer::APP_UID, $sAppUid); $criteriaDelIndex->add(AppDelegationPeer::APP_UID, $appUid);
$criteriaDelIndex->addDescendingOrderByColumn(AppDelegationPeer::DEL_DELEGATE_DATE); $criteriaDelIndex->addDescendingOrderByColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
$rsCriteriaDelIndex = AppDelegationPeer::doSelectRS($criteriaDelIndex); $rsCriteriaDelIndex = AppDelegationPeer::doSelectRS($criteriaDelIndex);
@@ -161,23 +194,23 @@ class AppDelegation extends BaseAppDelegation
$delIndex = (isset($row["DEL_INDEX"]))? $row["DEL_INDEX"] + 1 : 1; $delIndex = (isset($row["DEL_INDEX"]))? $row["DEL_INDEX"] + 1 : 1;
} }
} }
//Verify successors: parrallel submit in the same time // Verify successors: parallel submit in the same time
if ($flagControl) { if ($flagControl) {
$nextTaskUid = $sTasUid; $nextTaskUid = $tasUid;
$index = $this->getAllTasksBeforeSecJoin($nextTaskUid, $sAppUid, $delPreviousFather); $index = $this->getAllTasksBeforeSecJoin($nextTaskUid, $appUid, $delPreviousFather);
if ($this->createThread($index, $sAppUid)) { if ($this->createThread($index, $appUid)) {
return 0; return 0;
} }
} }
if ($flagControlMulInstance) { if ($flagControlMulInstance) {
$nextTaskUid = $sTasUid; $nextTaskUid = $tasUid;
$index = $this->getAllTheardMultipleInstance($delPreviousFather, $sAppUid); $index = $this->getAllTheardMultipleInstance($delPreviousFather, $appUid);
if ($this->createThread($index, $sAppUid, $sUsrUid)) { if ($this->createThread($index, $appUid, $usrUid)) {
return 0; return 0;
} }
} }
//Update set // Update set
$criteriaUpdate = new Criteria('workflow'); $criteriaUpdate = new Criteria('workflow');
$criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0); $criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0);
BasePeer::doUpdate($criteria, $criteriaUpdate, Propel::getConnection('workflow')); BasePeer::doUpdate($criteria, $criteriaUpdate, Propel::getConnection('workflow'));
@@ -185,15 +218,15 @@ class AppDelegation extends BaseAppDelegation
// Define the status of the thread, if is subprocess we need to CLOSED the thread // Define the status of the thread, if is subprocess we need to CLOSED the thread
$theadStatus = !$isSubprocess ? 'OPEN' : 'CLOSED'; $theadStatus = !$isSubprocess ? 'OPEN' : 'CLOSED';
$this->setAppUid($sAppUid); $this->setAppUid($appUid);
$this->setProUid($sProUid); $this->setProUid($proUid);
$this->setTasUid($sTasUid); $this->setTasUid($tasUid);
$this->setDelIndex($delIndex); $this->setDelIndex($delIndex);
$this->setDelLastIndex(1); $this->setDelLastIndex(1);
$this->setDelPrevious($sPrevious == - 1 ? 0 : $sPrevious); $this->setDelPrevious($previous == - 1 ? 0 : $previous);
$this->setUsrUid($sUsrUid); $this->setUsrUid($usrUid);
$this->setDelType('NORMAL'); $this->setDelType('NORMAL');
$this->setDelPriority(($iPriority != '' ? $iPriority : '3')); $this->setDelPriority(($priority != '' ? $priority : '3'));
$this->setDelThread($sAppThread); $this->setDelThread($sAppThread);
$this->setDelThreadStatus($theadStatus); $this->setDelThreadStatus($theadStatus);
$this->setDelThreadStatusId(Delegation::$thread_status[$theadStatus]); $this->setDelThreadStatusId(Delegation::$thread_status[$theadStatus]);
@@ -203,24 +236,22 @@ class AppDelegation extends BaseAppDelegation
$this->setUsrId($userId); $this->setUsrId($userId);
$this->setProId($proId); $this->setProId($proId);
//The function return an array now. By JHL // The function return an array now. By JHL
$delTaskDueDate = $this->calculateDueDate($sNextTasParam); $delTaskDueDate = $this->calculateDueDate($nextTasParam);
$delRiskDate = $this->calculateRiskDate($sNextTasParam, $this->getRisk()); $delRiskDate = $this->calculateRiskDate($nextTasParam, $this->getRisk());
//$this->setDelTaskDueDate( $delTaskDueDate['DUE_DATE'] ); // Due date formatted
$this->setDelTaskDueDate($delTaskDueDate); $this->setDelTaskDueDate($delTaskDueDate);
$this->setDelRiskDate($delRiskDate); $this->setDelRiskDate($delRiskDate);
if ((defined("DEBUG_CALENDAR_LOG")) && (DEBUG_CALENDAR_LOG)) { if ((defined("DEBUG_CALENDAR_LOG")) && (DEBUG_CALENDAR_LOG)) {
//$this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine // Log of actions made by Calendar Engine
$this->setDelData($delTaskDueDate); $this->setDelData($delTaskDueDate);
} else { } else {
$this->setDelData(''); $this->setDelData('');
} }
// this condition assures that an internal delegation like a subprocess dont have an initial date setted // This condition assures that an internal delegation like a subprocess don't have an initial date set
if ($delIndex == 1 && ! $isSubprocess) { if ($delIndex == 1 && ! $isSubprocess) {
//the first delegation, init date this should be now for draft applications, in other cases, should be null. // The first delegation, init date this should be now for draft applications, in other cases, should be null.
$this->setDelInitDate('now'); $this->setDelInitDate('now');
} }
@@ -247,16 +278,16 @@ class AppDelegation extends BaseAppDelegation
$bpmn = new \ProcessMaker\Project\Bpmn(); $bpmn = new \ProcessMaker\Project\Bpmn();
$flagActionsByEmail = true; $flagActionsByEmail = true;
$arrayAppDelegationPrevious = $this->getPreviousDelegationValidTask($sAppUid, $delIndex); $arrayAppDelegationPrevious = $this->getPreviousDelegationValidTask($appUid, $delIndex);
$data = new stdclass(); $data = new stdclass();
$data->TAS_UID = $sTasUid; $data->TAS_UID = $tasUid;
$data->APP_UID = $sAppUid; $data->APP_UID = $appUid;
$data->DEL_INDEX = $delIndex; $data->DEL_INDEX = $delIndex;
$data->USR_UID = $sUsrUid; $data->USR_UID = $usrUid;
$data->PREVIOUS_USR_UID = ($arrayAppDelegationPrevious !== false)? $arrayAppDelegationPrevious['USR_UID'] : $delPreviusUsrUid; $data->PREVIOUS_USR_UID = ($arrayAppDelegationPrevious !== false)? $arrayAppDelegationPrevious['USR_UID'] : $delPreviusUsrUid;
if ($bpmn->exists($sProUid)) { if ($bpmn->exists($proUid)) {
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
// this section evaluates the actions by email trigger execution please // this section evaluates the actions by email trigger execution please
// modify this section carefully, the if evaluation checks if the license has been // modify this section carefully, the if evaluation checks if the license has been
@@ -265,8 +296,8 @@ class AppDelegation extends BaseAppDelegation
::getSingleton() ::getSingleton()
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { ->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
$criteriaAbe = new Criteria(); $criteriaAbe = new Criteria();
$criteriaAbe->add(AbeConfigurationPeer::PRO_UID, $sProUid); $criteriaAbe->add(AbeConfigurationPeer::PRO_UID, $proUid);
$criteriaAbe->add(AbeConfigurationPeer::TAS_UID, $sTasUid); $criteriaAbe->add(AbeConfigurationPeer::TAS_UID, $tasUid);
$resultAbe = AbeConfigurationPeer::doSelectRS($criteriaAbe); $resultAbe = AbeConfigurationPeer::doSelectRS($criteriaAbe);
$resultAbe->setFetchmode(ResultSet::FETCHMODE_ASSOC); $resultAbe->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($resultAbe->next()) { if ($resultAbe->next()) {
@@ -289,7 +320,7 @@ class AppDelegation extends BaseAppDelegation
$pmGoogle = new PmGoogleApi(); $pmGoogle = new PmGoogleApi();
if ($pmGoogle->getServiceGmailStatus()) { if ($pmGoogle->getServiceGmailStatus()) {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail(); $Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$Pmgmail->gmailsForRouting($sUsrUid, $sTasUid, $sAppUid, $delIndex, $isSubprocess); $Pmgmail->gmailsForRouting($usrUid, $tasUid, $appUid, $delIndex, $isSubprocess);
} }
} catch (Exception $oError) { } catch (Exception $oError) {
error_log($oError->getMessage()); error_log($oError->getMessage());
@@ -299,8 +330,8 @@ class AppDelegation extends BaseAppDelegation
} }
if ($flagActionsByEmail) { if ($flagActionsByEmail) {
$oPluginRegistry = PluginRegistry::loadSingleton(); $pluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data); $pluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data);
} }
} }
@@ -474,30 +505,38 @@ class AppDelegation extends BaseAppDelegation
//Calendar - Use the dates class to calculate dates //Calendar - Use the dates class to calculate dates
$calendar = new Calendar(); $calendar = new Calendar();
$arrayCalendarData = $calendar->getCalendarData($aCalendarUID); $calendarData = $calendar->getCalendarData($aCalendarUID);
if ($calendar->pmCalendarUid == "") { if ($calendar->pmCalendarUid == "") {
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid()); $calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
$arrayCalendarData = $calendar->getCalendarData(); $calendarData = $calendar->getCalendarData();
} }
//Due date //Due date
$initDate = $this->getDelDelegateDate(); $initDate = $this->getDelDelegateDate();
$timeZone = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($initDate); $timeZone = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($initDate);
$dueDate = $calendar->dashCalculateDate($timeZone, $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $arrayCalendarData); $dueDate = $calendar->dashCalculateDate($timeZone, $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $calendarData);
$dueDate = \ProcessMaker\Util\DateTime::convertDataToUtc($dueDate); $dueDate = \ProcessMaker\Util\DateTime::convertDataToUtc($dueDate);
return $dueDate; return $dueDate;
} }
public function calculateRiskDate($dueDate, $risk) /**
* Calculate the risk date
*
* @param array $nextTask
* @param double $risk
*
* @return string
*/
public function calculateRiskDate($nextTask, $risk)
{ {
try { try {
$data = array(); $data = [];
if (isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') { if (isset($nextTask['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $nextTask['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
$data['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION']; $data['TAS_DURATION'] = $nextTask['NEXT_TASK']['TAS_DURATION'];
$data['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT']; $data['TAS_TIMEUNIT'] = $nextTask['NEXT_TASK']['TAS_TIMEUNIT'];
} else { } else {
$task = TaskPeer::retrieveByPK($this->getTasUid()); $task = TaskPeer::retrieveByPK($this->getTasUid());
$data['TAS_DURATION'] = $task->getTasDuration(); $data['TAS_DURATION'] = $task->getTasDuration();
@@ -506,19 +545,21 @@ class AppDelegation extends BaseAppDelegation
$riskTime = $data['TAS_DURATION'] - ($data['TAS_DURATION'] * $risk); $riskTime = $data['TAS_DURATION'] - ($data['TAS_DURATION'] * $risk);
//Calendar - Use the dates class to calculate dates // Calendar - Use the dates class to calculate dates
$calendar = new Calendar(); $calendar = new Calendar();
$calendarData = [];
$arrayCalendarData = array(); if (empty($calendar->pmCalendarUid)) {
if ($calendar->pmCalendarUid == "") {
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid()); $calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
$calendarData = $calendar->getCalendarData();
$arrayCalendarData = $calendar->getCalendarData();
} }
//Risk date // Risk date
$riskDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $riskTime, $data['TAS_TIMEUNIT'], $arrayCalendarData); $riskDate = $calendar->dashCalculateDate(
$this->getDelDelegateDate(),
$riskTime,
$data['TAS_TIMEUNIT'],
$calendarData
);
return $riskDate; return $riskDate;
} catch (Exception $e) { } catch (Exception $e) {
@@ -526,12 +567,6 @@ class AppDelegation extends BaseAppDelegation
} }
} }
public function getDiffDate($date1, $date2)
{
return ($date1 - $date2) / (24 * 60 * 60); //days
return ($date1 - $date2) / 3600;
}
//usually this function is called when routing in the flow, so by default cron =0 //usually this function is called when routing in the flow, so by default cron =0
public function calculateDuration($cron = 0) public function calculateDuration($cron = 0)
{ {
@@ -799,8 +834,10 @@ class AppDelegation extends BaseAppDelegation
/** /**
* This function get the current user related to the specific case and index * This function get the current user related to the specific case and index
*
* @param string $appUid, Uid related to the case * @param string $appUid, Uid related to the case
* @param integer $index, Index to review * @param integer $index, Index to review
*
* @return array * @return array
*/ */
public static function getCurrentUsers($appUid, $index) public static function getCurrentUsers($appUid, $index)
@@ -820,7 +857,8 @@ class AppDelegation extends BaseAppDelegation
/** /**
* Verify if the current case is already routed. * Verify if the current case is already routed.
* *
* @param string $AppUid the uid of the application * @param string $appUid the uid of the application
*
* @return array $Fields the fields * @return array $Fields the fields
*/ */
@@ -841,18 +879,6 @@ class AppDelegation extends BaseAppDelegation
} }
} }
public function getRisk()
{
try {
$risk = 0.2;
//Return
return $risk;
} catch (Exception $e) {
throw $e;
}
}
/** /**
* Get all task before Join Threads * Get all task before Join Threads
* *

View File

@@ -4493,6 +4493,12 @@ msgstr "City"
msgid "Claim" msgid "Claim"
msgstr "Claim" msgstr "Claim"
# TRANSLATION
# LABEL/ID_CLAIM_THIS_CASE
#: LABEL/ID_CLAIM_THIS_CASE
msgid "Claim this case"
msgstr "Claim this case"
# TRANSLATION # TRANSLATION
# LABEL/ID_CLASSIC_EDITOR # LABEL/ID_CLASSIC_EDITOR
#: 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" msgid "send at"
msgstr "send at" msgstr "send at"
# TRANSLATION
# LABEL/ID_SEND_BY
#: LABEL/ID_SEND_BY
msgid "Send By"
msgstr "Send By"
# TRANSLATION # TRANSLATION
# LABEL/ID_SEND_EMAIL_CASE_PARTICIPANTS # LABEL/ID_SEND_EMAIL_CASE_PARTICIPANTS
#: 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_CITY','en','City','2020-12-15') ,
( 'LABEL','ID_CHOOSE_TIME','en','Choose a time','2014-08-27') , ( 'LABEL','ID_CHOOSE_TIME','en','Choose a time','2014-08-27') ,
( 'LABEL','ID_CLAIM','en','Claim','2014-01-15') , ( '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_CLASSIC_EDITOR','en','Classic Editor','2014-01-15') ,
( 'LABEL','ID_CLASS_ALREADY_EXISTS','en','Class already exists','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') , ( '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_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_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_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_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_SEND_EMAIL_TO_PARTICIPANTS','en','Send email to participants','2020-12-01') ,
( 'LABEL','ID_SENT','en','Participated','2016-07-11') , ( 'LABEL','ID_SENT','en','Participated','2016-07-11') ,

View File

@@ -6,6 +6,8 @@ use ProcessMaker\Core\System;
global $translation; global $translation;
global $RBAC; global $RBAC;
$conf = new Configurations();
if ($RBAC->userCanAccess("PM_SETUP") != 1 || $RBAC->userCanAccess("PM_SETUP_ADVANCE") != 1) { if ($RBAC->userCanAccess("PM_SETUP") != 1 || $RBAC->userCanAccess("PM_SETUP_ADVANCE") != 1) {
G::SendTemporalMessage("ID_USER_HAVENT_RIGHTS_PAGE", "error", "labels"); G::SendTemporalMessage("ID_USER_HAVENT_RIGHTS_PAGE", "error", "labels");
exit(0); exit(0);
@@ -30,4 +32,5 @@ ScriptVariables::add('SYS_WORKSPACE', config("system.workspace"));
ScriptVariables::add('SYS_URI', SYS_URI); ScriptVariables::add('SYS_URI', SYS_URI);
ScriptVariables::add('SYS_LANG', SYS_LANG); ScriptVariables::add('SYS_LANG', SYS_LANG);
ScriptVariables::add('TRANSLATIONS', $translation); ScriptVariables::add('TRANSLATIONS', $translation);
ScriptVariables::add('FORMATS', $conf->getFormats());
echo View::make('Views::admin.settings.customCasesList', compact("userCanAccess"))->render(); echo View::make('Views::admin.settings.customCasesList', compact("userCanAccess"))->render();

View File

@@ -46,6 +46,7 @@ use ProcessMaker\BusinessModel\User as BmUser;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Exception\UploadException; use ProcessMaker\Exception\UploadException;
use ProcessMaker\Exception\CaseNoteUploadFile; use ProcessMaker\Exception\CaseNoteUploadFile;
use ProcessMaker\Model\AppDelay as Delay;
use ProcessMaker\Model\Application as ModelApplication; use ProcessMaker\Model\Application as ModelApplication;
use ProcessMaker\Model\AppNotes as Notes; use ProcessMaker\Model\AppNotes as Notes;
use ProcessMaker\Model\AppTimeoutAction; use ProcessMaker\Model\AppTimeoutAction;
@@ -2456,33 +2457,25 @@ class Cases
/** /**
* This function get the status information * This function get the status information
* *
* @param object $rsCriteria * @param array $result
* @param string $status
* *
* @return array * @return array
* @throws Exception * @throws Exception
*/ */
private function getStatusInfoDataByRsCriteria($rsCriteria) private function getStatusInfoFormatted(array $result, string $status = '')
{ {
try { try {
$arrayData = []; $record = head($result);
if ($rsCriteria->next()) {
$record = $rsCriteria->getRow();
$arrayData = [ $arrayData = [
'APP_STATUS' => $record['APP_STATUS'], 'APP_STATUS' => empty($status) ? $record['APP_STATUS'] : $status,
'DEL_INDEX' => [], 'DEL_INDEX' => [],
'PRO_UID' => $record['PRO_UID'] 'PRO_UID' => $record['PRO_UID']
]; ];
$arrayData['DEL_INDEX'][] = $record['DEL_INDEX']; $arrayData['DEL_INDEX'][] = $record['DEL_INDEX'];
foreach ($result as $record) {
while ($rsCriteria->next()) {
$record = $rsCriteria->getRow();
$arrayData['DEL_INDEX'][] = $record['DEL_INDEX']; $arrayData['DEL_INDEX'][] = $record['DEL_INDEX'];
} }
}
//Return //Return
return $arrayData; return $arrayData;
} catch (Exception $e) { } catch (Exception $e) {
@@ -2493,8 +2486,8 @@ class Cases
/** /**
* Get status info Case * Get status info Case
* *
* @param string $applicationUid Unique id of Case * @param string $appUid Unique id of Case
* @param int $delIndex Delegation index * @param int $index Delegation index
* @param string $userUid Unique id of User * @param string $userUid Unique id of User
* *
* @return array Return an array with status info Case, array empty otherwise * @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/main_init.php
* @see workflow/engine/methods/cases/opencase.php * @see workflow/engine/methods/cases/opencase.php
* @see ProcessMaker\BusinessModel\Cases->setCaseVariables() * @see \ProcessMaker\BusinessModel\Cases::setCaseVariables()
* @see ProcessMaker\BusinessModel\Cases\InputDocument->getCasesInputDocuments() * @see \ProcessMaker\BusinessModel\Cases\InputDocument::getCasesInputDocuments()
* @see ProcessMaker\BusinessModel\Cases\InputDocument->throwExceptionIfHaventPermissionToDelete() * @see \ProcessMaker\BusinessModel\Cases\InputDocument::throwExceptionIfHaventPermissionToDelete()
* @see ProcessMaker\BusinessModel\Cases\OutputDocument->throwExceptionIfCaseNotIsInInbox() * @see \ProcessMaker\BusinessModel\Cases\OutputDocument::throwExceptionIfCaseNotIsInInbox()
* @see ProcessMaker\BusinessModel\Cases\OutputDocument->throwExceptionIfHaventPermissionToDelete() * @see \ProcessMaker\BusinessModel\Cases\OutputDocument::throwExceptionIfHaventPermissionToDelete()
*/ */
public function getStatusInfo($applicationUid, $delIndex = 0, $userUid = "") public function getStatusInfo(string $appUid, int $index = 0, string $userUid = "")
{ {
try { try {
//Verify data $arrayData = [];
$this->throwExceptionIfNotExistsCase($applicationUid, $delIndex, // Verify data
$this->getFieldNameByFormatFieldName("APP_UID")); $this->throwExceptionIfNotExistsCase($appUid, $index, $this->getFieldNameByFormatFieldName("APP_UID"));
// Get the case number
//Get data $caseNumber = ModelApplication::getCaseNumber($appUid);
//Status is PAUSED // Status is PAUSED
$delimiter = DBAdapter::getStringDelimiter(); $result = Delay::getPaused($caseNumber, $index, $userUid);
if (!empty($result)) {
$criteria = new Criteria("workflow"); $arrayData = $this->getStatusInfoFormatted($result, 'PAUSED');
return $arrayData;
$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);
} }
if ($userUid != "") { // Status is UNASSIGNED
$criteria->add(AppDelayPeer::APP_DELEGATION_USER, $userUid, Criteria::EQUAL); $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); // Status is TO_DO, DRAFT
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $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)) { if (!empty($arrayData)) {
return $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; 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();
} catch (Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }

View File

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

View File

@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel\Cases;
use G; use G;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\User; use ProcessMaker\Model\User;
@@ -166,4 +167,44 @@ class Draft extends AbstractCases
// Return the number of rows // Return the number of rows
return $query->count(['APP_DELEGATION.APP_NUMBER']); 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 G;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\User; use ProcessMaker\Model\User;
@@ -179,4 +180,44 @@ class Inbox extends AbstractCases
// Return the number of rows // Return the number of rows
return $query->count(['APP_DELEGATION.APP_NUMBER']); 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; namespace ProcessMaker\BusinessModel\Cases;
use G; use G;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\User; use ProcessMaker\Model\User;
@@ -173,4 +174,44 @@ class Paused extends AbstractCases
// Return the number of rows // Return the number of rows
return $query->count(['APP_DELEGATION.APP_NUMBER']); 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 G;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\User; use ProcessMaker\Model\User;
@@ -181,4 +182,44 @@ class Unassigned extends AbstractCases
// Return the number of rows // Return the number of rows
return $query->count(['APP_DELEGATION.APP_NUMBER']); 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 G;
use PmTable; use PmTable;
use ProcessMaker\BusinessModel\ReportTable as BusinessModelRpt; use ProcessMaker\BusinessModel\ReportTable as BusinessModelRpt;
use ProcessMaker\Model\AdditionalTables as ModelAdditionalTables;
use stdClass; use stdClass;
class Table class Table
@@ -23,34 +24,25 @@ class Table
'or','throw','protected','public','static','switch','xor','try','use','var','while']; 'or','throw','protected','public','static','switch','xor','try','use','var','while'];
/** /**
* List of Tables in process * List of Tables in process.
* @var string $pro_uid. Uid for process * @param string $proUid
* @var string $reportFlag. If is report table * @param bool $reportFlag
* * @param bool $offline
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com> * @param string $search
* @copyright Colosa - Bolivia
*
* @return array * @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) { if ($reportFlag) {
$pro_uid = $this->validateProUid($pro_uid); $proUid = $this->validateProUid($proUid);
} }
$additionalTables = ModelAdditionalTables::where('PRO_UID', '=', $proUid)
$reportTables = array(); ->where('ADD_TAB_NAME', 'LIKE', "%{$search}%")
$oCriteria = new \Criteria('workflow'); ->get();
$oCriteria->addSelectColumn(\AdditionalTablesPeer::ADD_TAB_UID); $additionalTables->transform(function ($object) use ($proUid, $reportFlag) {
$oCriteria->add(\AdditionalTablesPeer::PRO_UID, $pro_uid, \Criteria::EQUAL); return $this->getTable($object->ADD_TAB_UID, $proUid, $reportFlag, false);
$oDataset = \AdditionalTablesPeer::doSelectRS($oCriteria); });
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); return $additionalTables->toArray();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$reportTables[] = $this->getTable($row['ADD_TAB_UID'], $pro_uid, $reportFlag, false);
}
return $reportTables;
} }
/** /**

View File

@@ -30,4 +30,94 @@ class AppDelay extends Model
'APP_ENABLE_ACTION_DATE', 'APP_ENABLE_ACTION_DATE',
'APP_DISABLE_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 string $search
* @param int $offset * @param int $offset
* @param int $limit * @param int $limit
* @param bool $paged
* @return array * @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'; $order = 'asc';
$model = CaseList::where('CAL_TYPE', '=', $type) $model = CaseList::where('CAL_TYPE', '=', $type)
@@ -198,7 +199,11 @@ class CaseList extends Model
$count = $model->count(); $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) { $data->transform(function ($item, $key) {
if (is_null($item->CAL_COLUMNS)) { if (is_null($item->CAL_COLUMNS)) {
$item->CAL_COLUMNS = '[]'; $item->CAL_COLUMNS = '[]';

View File

@@ -173,18 +173,6 @@ class Delegation extends Model
return $query->where('DEL_INDEX', '=', 1); 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 * Scope a query to get the to_do cases
* *
@@ -381,36 +369,39 @@ class Delegation extends Model
* Scope a query to get only the date on time * Scope a query to get only the date on time
* *
* @param \Illuminate\Database\Eloquent\Builder $query * @param \Illuminate\Database\Eloquent\Builder $query
* @param string $now
* *
* @return \Illuminate\Database\Eloquent\Builder * @return \Illuminate\Database\Eloquent\Builder
*/ */
public function scopeOnTime($query) public function scopeOnTime($query, $now)
{ {
return $query->whereRaw('TIMEDIFF(DEL_RISK_DATE, NOW()) > 0'); return $query->where('DEL_RISK_DATE', '>', $now);
} }
/** /**
* Scope a query to get only the date at risk * Scope a query to get only the date at risk
* *
* @param \Illuminate\Database\Eloquent\Builder $query * @param \Illuminate\Database\Eloquent\Builder $query
* @param string $now
* *
* @return \Illuminate\Database\Eloquent\Builder * @return \Illuminate\Database\Eloquent\Builder
*/ */
public function scopeAtRisk($query) public function scopeAtRisk($query, $now)
{ {
return $query->whereRaw('TIMEDIFF(DEL_RISK_DATE, NOW()) < 0 AND TIMEDIFF(DEL_TASK_DUE_DATE, NOW()) > 0'); return $query->where('DEL_RISK_DATE', '>=', $now)->where('DEL_TASK_DUE_DATE', '>=', $now);
} }
/** /**
* Scope a query to get only the date overdue * Scope a query to get only the date overdue
* *
* @param \Illuminate\Database\Eloquent\Builder $query * @param \Illuminate\Database\Eloquent\Builder $query
* @param string $now
* *
* @return \Illuminate\Database\Eloquent\Builder * @return \Illuminate\Database\Eloquent\Builder
*/ */
public function scopeOverdue($query) public function scopeOverdue($query, $now)
{ {
return $query->whereRaw('TIMEDIFF(DEL_TASK_DUE_DATE, NOW()) < 0'); return $query->where('DEL_TASK_DUE_DATE', '>', $now);
} }
/** /**
@@ -774,19 +765,6 @@ class Delegation extends Model
return $query->whereIn('APP_DELEGATION.PRO_ID', $processes); 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 * Scope the Inbox cases
* *
@@ -809,26 +787,6 @@ class Delegation extends Model
return $query; 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 * Scope a self service cases
* *
@@ -1414,7 +1372,7 @@ class Delegation extends Model
* @param string $appUid * @param string $appUid
* @return array * @return array
* *
* @see \ProcessMaker\BusinessModel\Cases:getStatusInfo() * @see \ProcessMaker\BusinessModel\Cases::getStatusInfo()
*/ */
public static function getParticipatedInfo($appUid) public static function getParticipatedInfo($appUid)
{ {

View File

@@ -215,6 +215,7 @@ class User extends Model
public static function getInformation(int $usrId) public static function getInformation(int $usrId)
{ {
$query = User::query()->select([ $query = User::query()->select([
'USR_ID',
'USR_USERNAME', 'USR_USERNAME',
'USR_FIRSTNAME', 'USR_FIRSTNAME',
'USR_LASTNAME', 'USR_LASTNAME',
@@ -226,6 +227,7 @@ class User extends Model
$results = $query->get(); $results = $query->get();
$info = []; $info = [];
$results->each(function ($item) use (&$info) { $results->each(function ($item) use (&$info) {
$info['usr_id'] = $item->USR_ID;
$info['usr_username'] = $item->USR_USERNAME; $info['usr_username'] = $item->USR_USERNAME;
$info['usr_firstname'] = $item->USR_FIRSTNAME; $info['usr_firstname'] = $item->USR_FIRSTNAME;
$info['usr_lastname'] = $item->USR_LASTNAME; $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\Search;
use ProcessMaker\BusinessModel\Cases\Supervising; use ProcessMaker\BusinessModel\Cases\Supervising;
use ProcessMaker\BusinessModel\Cases\Unassigned; use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation; use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process; use ProcessMaker\Model\Process;
use ProcessMaker\Model\ProcessCategory; use ProcessMaker\Model\ProcessCategory;
@@ -609,6 +610,30 @@ class Home extends Api
if ($menuInstance->Id[$i] === 'ID_CASE_ARCHIVE_SEARCH') { if ($menuInstance->Id[$i] === 'ID_CASE_ARCHIVE_SEARCH') {
$option->icon = "fas fa-archive"; $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 // Add option to the menu
$menuHome[] = $option; $menuHome[] = $option;
} }
@@ -727,10 +752,48 @@ class Home extends Api
$result = []; $result = [];
$result['label'] = $text . $count; $result['label'] = $text . $count;
$result['total'] = $count; $result['total'] = $count;
return $result; 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 * Get the tasks counters for todo, draft, paused and unassigned
* *

View File

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

View File

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