Merge branch 'release/3.6.0' of https://bitbucket.org/colosa/processmaker into debugger

This commit is contained in:
Henry Jordan
2021-01-14 19:13:10 +00:00
42 changed files with 777 additions and 520 deletions

View File

@@ -14,7 +14,7 @@ const services = {
GET_LISTS_COMPLETED: "/light/completed",
GET_USERS_PICTURES: "/light/users/data",
FORMS_ARRAY: "/light/project/{pro_uid}/activity/{act_uid}/steps",
GET_NEW_CASES: "/light/start-case",
GET_NEW_CASES: "/case/start-cases?type_view=category",
GET_HISTORY_CASES: "/light/history/{app_uid}",
LOGOUT_USER: "/light/logout",
UPLOAD_LOCATION: "/light/case/{app_uid}/upload/location",

View File

@@ -111,6 +111,11 @@ export let cases = {
window.config.SYS_URI +
`cases/open?APP_UID=${data.APP_UID}&DEL_INDEX=${data.DEL_INDEX}&action=${data.ACTION}`);
},
cases_open(data) {
return axios.get(window.config.SYS_SERVER +
window.config.SYS_URI +
`cases/cases_Open?APP_UID=${data.APP_UID}&DEL_INDEX=${data.DEL_INDEX}&action=${data.ACTION}`);
},
cancel(data) {
var params = new URLSearchParams();
params.append('action', 'cancelCase');
@@ -120,6 +125,14 @@ export let cases = {
window.config.SYS_URI +
`cases/ajaxListener`, params);
},
actions(data) {
var params = new URLSearchParams();
params.append('action', 'getCaseMenu');
params.append('app_status', 'TO_DO');
return axios.post(window.config.SYS_SERVER +
window.config.SYS_URI +
`cases/ajaxListener`, params);
},
unpause(data) {
var params = new URLSearchParams();
params.append('action', 'unpauseCase');

View File

@@ -80,4 +80,16 @@ export default {
display: flex;
justify-content: space-between;
}
.btn-warning {
color: white;
background-color: #ffc107;
border-color: #ffc107;
}
.btn-warning:hover {
color: white;
background-color: #e0a800;
border-color: #d39e00;
}
</style>

View File

@@ -5,7 +5,7 @@
<div class="card-text">
<div
v-for="item in data.items"
:key="item.title"
:key="item.data.id"
class="v-attached-block"
>
<div class="v-list v-list-row block">

View File

@@ -5,7 +5,7 @@
<div class="card-text">
<div
v-for="item in data.items"
:key="item.title"
:key="item.data.id"
class="v-attached-block"
>
<span>

View File

@@ -123,18 +123,22 @@ export default {
onDropFile(e) {
e.preventDefault();
e.stopPropagation();
if(this.data.noPerms === 1){
return;
}
let that = this,
fls = [];
_.each(e.dataTransfer.files, (f) => {
that.files.push(f);
});
that.files = that.files.slice(0,5);
_.each(that.files, (f) => {
fls.push({
data: f,
title: f.name,
extension: f.name.split(".").pop(),
onClick: () => {},
id: _.random(1000000)
});
});
@@ -143,6 +147,9 @@ export default {
},
onDragOver(e) {
e.preventDefault();
if(this.data.noPerms === 1){
return;
}
if (!this.showMaskDrop) {
this.showMaskDrop = true;
}

View File

@@ -52,8 +52,9 @@
</div>
</div>
<br />
<div v-if="data.onClick">
<h6 class="card-subtitle mb-2 text-muted">{{ data.titleActions }}</h6>
<div v-if="data.btnType" class="container v-case-summary-center">
<div class="container v-case-summary-center">
<button
type="button"
class="btn btn-success btn-sm"
@@ -62,14 +63,6 @@
{{ data.btnLabel }}
</button>
</div>
<div v-else class="container v-case-summary-center">
<button
type="button"
class="btn btn-success btn-sm"
@click="data.onClick"
>
{{ data.btnLabel }}
</button>
</div>
</div>
</div>

View File

@@ -5,7 +5,7 @@
<div class="card-text">
<div
v-for="item in data.inputDocuments"
:key="item.title"
:key="item.data.APP_DOC_UID"
class="v-attached-block"
>
<div class="v-list v-list-row block">
@@ -79,6 +79,13 @@ export default {
return this.icon[icon] ? this.icon[icon] : "fas fa-file-alt";
},
href(item) {
if (item.data.DOWNLOAD_LINK) {
return (
window.config.SYS_SERVER +
window.config.SYS_URI +
`cases/${item.data.DOWNLOAD_LINK}`
);
}
return (
window.config.SYS_SERVER +
window.config.SYS_URI +

View File

@@ -42,7 +42,6 @@ export default {
},
mounted() {
this.onResize();
window.addEventListener("resize", this.onResize);
},
methods: {
/**

View File

@@ -256,7 +256,7 @@ export default {
id: "CaseStatus",
title: `${this.$i18n.t('ID_FILTER')}: ${this.$i18n.t('ID_CASE_STATUS')}`,
optionLabel: this.$i18n.t('ID_STATUS'),
detail: "ID_PLEASE_SELECT_THE_STATUS_FOR_THE_SEARCH",
detail: this.$i18n.t('ID_PLEASE_SELECT_THE_STATUS_FOR_THE_SEARCH'),
tagText: "",
tagPrefix: this.$i18n.t('ID_SEARCH_BY_STATUS'),
items:[

View File

@@ -14,7 +14,7 @@
<b-form-group
:state="valueState"
label-for="name-input"
:invalid-feedback="$t('ID_INVALID_CASE_NUMBER_RANGE')"
:invalid-feedback="$t('ID_INVALID_CASE_NUMBER')"
>
<b-form-input
id="name-input"

View File

@@ -1,6 +1,6 @@
<template>
<div v-if="data.length" class="grouped-cell">
<div v-for="item in data" class="d-flex mb-3">
<div v-for="item in data" v-bind:key="item.TITLE" class="d-flex mb-3">
<div
v-bind:style="{ color: activeColor(item.STATUS) }"
v-b-popover.hover.top="item.DELAYED_MSG"
@@ -10,13 +10,34 @@
<div class="col ellipsis" v-b-popover.hover.top="item.TAS_NAME">
{{ item.TAS_NAME }}
</div>
<div class="avatar">
<div class="avatar" :id="id">
<b-avatar
variant="info"
:src="item.AVATAR"
size="1.2em"
size="2em"
></b-avatar>
</div>
<b-popover
:target="id"
placement="top"
ref="popover"
triggers="hover"
>
<b-row >
<b-col md="3">
<b-avatar
variant="info"
:src="item.AVATAR"
size="4em"
></b-avatar>
</b-col>
<b-col md="9">
<div class="font-weight-bold">{{item.USERNAME}}</div>
<div v-if="item.POSITION !== ''">{{item.POSITION}}</div>
<b-link :href="mailto(item.EMAIL)" >{{item.EMAIL}}</b-link>
</b-col>
</b-row>
</b-popover>
</div>
</div>
</template>
@@ -29,6 +50,7 @@ export default {
return {
//Color map for ["In Progress", "overdue", "inDraft", "paused", "unnasigned"]
colorMap: ["green", "red", "orange", "aqua", "silver"],
id: "avatar-" + _.random(1000000)
};
},
methods: {
@@ -40,13 +62,20 @@ export default {
activeColor: function(codeColor) {
return this.colorMap[codeColor - 1];
},
mailto: function(email) {
return "mailto:" + email;
}
}
};
</script>
<style>
<style>
.popover {
max-width: 600px !important;
min-width: 200px !important;
}
.grouped-cell {
font-size: smaller;
font-size: small;
}
.ellipsis {
@@ -55,9 +84,7 @@ export default {
overflow: hidden;
text-overflow: ellipsis;
}
.color {
color: red;
}
.avatar {

View File

@@ -1,6 +1,6 @@
<template>
<div class="v-task-cell">
<div v-for="item in data" class="d-flex mb-3">
<div v-for="item in data" v-bind:key="item.TITLE" class="d-flex mb-3">
<div v-bind:style="{ color: activeColor(item.CODE_COLOR) }">
<i class="fas fa-square"></i>
</div>

View File

@@ -30,6 +30,7 @@
:columns="columns"
:options="options"
ref="vueTable"
@row-click="onRowClick"
>
<div slot="info" slot-scope="props">
<b-icon
@@ -88,7 +89,7 @@ import AdvancedFilter from "../components/search/AdvancedFilter";
import TaskCell from "../components/vuetable/TaskCell.vue";
import ModalComments from "./modal/ModalComments.vue";
import api from "./../api/index";
import { Event } from "vue-tables-2";
import utils from "./../utils/utils";
export default {
name: "AdvancedSearch",
@@ -120,7 +121,6 @@ export default {
},
},
columns: [
"info",
"case_number",
"case_title",
"process_name",
@@ -159,7 +159,9 @@ export default {
},
customFilters: ["myfilter"],
},
pmDateFormat: window.config.FORMATS.dateFormat
pmDateFormat: window.config.FORMATS.dateFormat,
clickCount: 0,
singleClickTimer: null
};
},
watch: {
@@ -168,6 +170,23 @@ export default {
},
},
methods: {
/**
* Row click event handler
* @param {object} event
*/
onRowClick(event) {
let self = this;
self.clickCount += 1;
if (self.clickCount === 1) {
self.singleClickTimer = setTimeout(function() {
self.clickCount = 0;
}, 400);
} else if (self.clickCount === 2) {
clearTimeout(self.singleClickTimer);
self.clickCount = 0;
self.openCaseDetail(event.row);
}
},
/**
* Get cases data by header
*/
@@ -244,49 +263,16 @@ export default {
dataFormat = [];
for (i = 0; i < data.length; i += 1) {
dataFormat.push({
USER_DATA: this.nameFormatCases(
data[i].usr_firstname,
data[i].usr_lastname,
data[i].usr_username
)
USER_DATA: utils.userNameDisplayFormat({
userName: data[i].usr_firstname,
firstName: data[i].usr_lastname,
lastName: data[i].usr_username,
format: window.config.FORMATS.format || null
}),
});
}
return dataFormat;
},
/**
* Get for user format name configured in Processmaker Environment Settings
*
* @param {string} name
* @param {string} lastName
* @param {string} userName
* @return {string} nameFormat
*/
nameFormatCases(name, lastName, userName) {
let nameFormat = "";
if (/^\s*$/.test(name) && /^\s*$/.test(lastName)) {
return nameFormat;
}
if (this.nameFormat === "@firstName @lastName") {
nameFormat = name + " " + lastName;
} else if (this.nameFormat === "@firstName @lastName (@userName)") {
nameFormat = name + " " + lastName + " (" + userName + ")";
} else if (this.nameFormat === "@userName") {
nameFormat = userName;
} else if (this.nameFormat === "@userName (@firstName @lastName)") {
nameFormat = userName + " (" + name + " " + lastName + ")";
} else if (this.nameFormat === "@lastName @firstName") {
nameFormat = lastName + " " + name;
} else if (this.nameFormat === "@lastName, @firstName") {
nameFormat = lastName + ", " + name;
} else if (
this.nameFormat === "@lastName, @firstName (@userName)"
) {
nameFormat = lastName + ", " + name + " (" + userName + ")";
} else {
nameFormat = name + " " + lastName;
}
return nameFormat;
},
/**
* Convert string to date format
*

View File

@@ -155,7 +155,7 @@ export default {
headings: {
task: this.$i18n.t("ID_TASK"),
case_title: this.$i18n.t("ID_CASE_TITLE"),
assignee: this.$i18n.t("ID_ASSIGNEE"),
assignee: this.$i18n.t("ID_CURRENT_USER"),
status: this.$i18n.t("ID_STATUS"),
due_date: this.$i18n.t("ID_DUE_DATE"),
actions: this.$i18n.t("ID_ACTIONS"),
@@ -241,7 +241,9 @@ export default {
this.dataAttachedDocuments.items = att;
},
getDataCaseSummary() {
let that = this;
let action,
option,
that = this;
Api.cases
.casesummary(this.dataCase)
.then((response) => {
@@ -252,9 +254,7 @@ export default {
titleActions: this.$i18n.t("ID_ACTIONS"),
btnLabel: this.$i18n.t("ID_CANCEL_CASE"),
btnType: false,
onClick: () => {
that.$refs["modal-cancel-case"].show();
},
onClick: null,
label: {
numberCase: data[2].label,
process: data[0].label,
@@ -274,6 +274,19 @@ export default {
duration: response.data[11].value.split(" ")[1],
},
};
// Hack for identify the cancel case button
Api.cases
.actions(this.dataCase).then((response)=>{
action = _.find(response.data, function(o) { return o.id == "ACTIONS"; });
if(action){
option = _.find(action.options, function(o) { return o.fn == "cancelCase"; });
if(!option.hide){
that.dataCaseSummary.onClick = () => {
that.$refs["modal-cancel-case"].show();
};
}
}
});
})
.catch((err) => {
throw new Error(err);
@@ -387,6 +400,7 @@ export default {
let that = this,
notesArray = [];
_.each(notes, (n) => {
n.id = _.random(1000000);
notesArray.push({
user: that.nameFormatCases(
n.USR_FIRSTNAME,

View File

@@ -13,6 +13,7 @@
:columns="columns"
:options="options"
ref="vueTable"
@row-click="onRowClick"
>
<div slot="detail" slot-scope="props">
<div class="btn-default" @click="openCaseDetail(props.row)">
@@ -31,21 +32,6 @@
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
<div slot="current_user" slot-scope="props">
{{
nameFormatCases(
props.row.USR_FIRSTNAME,
props.row.USR_LASTNAME,
props.row.USR_USERNAME
)
}}
</div>
<div slot="due_date" slot-scope="props">
{{ props.row.DUE_DATE }}
</div>
<div slot="delegation_date" slot-scope="props">
{{ props.row.DELEGATION_DATE }}
</div>
<div slot="priority" slot-scope="props">{{ props.row.PRIORITY }}</div>
<div slot="actions" slot-scope="props">
<button class="btn btn-success btn-sm" @click="openCase(props.row)">
@@ -89,11 +75,8 @@ export default {
"case_title",
"process_name",
"task",
"current_user",
"due_date",
"delegation_date",
"priority",
"actions",
"actions"
],
tableData: [],
filters: {},
@@ -104,11 +87,7 @@ export default {
case_title: this.$i18n.t("ID_CASE_TITLE"),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"),
current_user: this.$i18n.t("ID_CURRENT_USER"),
due_date: this.$i18n.t("ID_DUE_DATE"),
delegation_date: this.$i18n.t("ID_DELEGATION_DATE"),
priority: this.$i18n.t("ID_PRIORITY"),
actions: "",
actions: ""
},
selectable: {
mode: "single",
@@ -123,6 +102,8 @@ export default {
},
},
pmDateFormat: "Y-m-d H:i:s",
clickCount: 0,
singleClickTimer: null
};
},
mounted() {},
@@ -138,6 +119,23 @@ export default {
updated() {},
beforeCreate() {},
methods: {
/**
* On row click event handler
* @param {object} event
*/
onRowClick(event) {
let self = this;
self.clickCount += 1;
if (self.clickCount === 1) {
self.singleClickTimer = setTimeout(function() {
self.clickCount = 0;
}, 400);
} else if (self.clickCount === 2) {
clearTimeout(self.singleClickTimer);
self.clickCount = 0;
self.openCase(event.row);
}
},
/**
* Get cases todo data
*/
@@ -187,52 +185,15 @@ export default {
CODE_COLOR: v.TAS_COLOR,
COLOR: v.TAS_COLOR_LABEL,
}],
USR_FIRSTNAME: v.USR_FIRSTNAME,
USR_LASTNAME: v.USR_LASTNAME,
USR_USERNAME: v.USR_USERNAME,
DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL,
DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL,
PRIORITY: v.DEL_PRIORITY_LABEL,
PRO_UID: v.PRO_UID,
TAS_UID: v.TAS_UID,
DEL_INDEX: v.DEL_INDEX,
APP_UID: v.APP_UID,
APP_UID: v.APP_UID
});
});
return data;
},
/**
* Get for user format name configured in Processmaker Environment Settings
*
* @param {string} name
* @param {string} lastName
* @param {string} userName
* @return {string} nameFormat
*/
nameFormatCases(name, lastName, userName) {
let nameFormat = "";
if (/^\s*$/.test(name) && /^\s*$/.test(lastName)) {
return nameFormat;
}
if (this.nameFormat === "@firstName @lastName") {
nameFormat = name + " " + lastName;
} else if (this.nameFormat === "@firstName @lastName (@userName)") {
nameFormat = name + " " + lastName + " (" + userName + ")";
} else if (this.nameFormat === "@userName") {
nameFormat = userName;
} else if (this.nameFormat === "@userName (@firstName @lastName)") {
nameFormat = userName + " (" + name + " " + lastName + ")";
} else if (this.nameFormat === "@lastName @firstName") {
nameFormat = lastName + " " + name;
} else if (this.nameFormat === "@lastName, @firstName") {
nameFormat = lastName + ", " + name;
} else if (this.nameFormat === "@lastName, @firstName (@userName)") {
nameFormat = lastName + ", " + name + " (" + userName + ")";
} else {
nameFormat = name + " " + lastName;
}
return nameFormat;
},
/**
* Open selected cases in the inbox
*
@@ -256,14 +217,16 @@ export default {
openCaseDetail(item) {
let that = this;
api.cases.open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
});
that.$emit("onUpdatePage", "case-detail");
});
that.$emit("onUpdatePage", "case-detail");
});
},
onRemoveFilter(data) {},

View File

@@ -22,6 +22,7 @@
ref="component"
:filters="filters"
:id="pageId"
:pageUri="pageUri"
:name="pageName"
@onSubmitFilter="onSubmitFilter"
@onRemoveFilter="onRemoveFilter"
@@ -46,6 +47,7 @@ import CaseDetail from "./CaseDetail";
import XCase from "./XCase";
import TaskReassignments from "./TaskReassignments";
import AdvancedSearch from "./AdvancedSearch";
import LegacyFrame from "./LegacyFrame";
import api from "./../api/index";
@@ -64,6 +66,7 @@ export default {
Paused,
Unassigned,
CaseDetail,
LegacyFrame
},
data() {
return {
@@ -78,28 +81,48 @@ export default {
sidebarWidth: "310px",
pageId: null,
pageName: null,
filters: null,
pageUri: null,
filters: null,
menuMap: {
CASES_MY_CASES: "MyCases",
CASES_SEARCH: "advanced-search",
CASES_INBOX: "todo",
CASES_DRAFT: "draft",
CASES_PAUSED: "paused",
CASES_SELFSERVICE: "unassigned",
CONSOLIDATED_CASES: "batch-routing",
CASES_TO_REASSIGN: "task-reassignments",
CASES_FOLDERS: "my-documents"
}
};
},
mounted() {
this.onResize();
window.addEventListener("resize", this.onResize);
this.getMenu();
this.listenerIframe();
window.setInterval(this.setCounter, parseInt(window.config.FORMATS.casesListRefreshTime) * 1000);
window.setInterval(
this.setCounter,
parseInt(window.config.FORMATS.casesListRefreshTime) * 1000
);
},
methods: {
/**
* Listener for iframes childs
*/
listenerIframe(){
listenerIframe() {
let that = this,
eventMethod = window.addEventListener? "addEventListener": "attachEvent",
eventer = window[eventMethod],
messageEvent = eventMethod === "attachEvent"? "onmessage": "message";
eventMethod = window.addEventListener
? "addEventListener"
: "attachEvent",
eventer = window[eventMethod],
messageEvent =
eventMethod === "attachEvent" ? "onmessage" : "message";
eventer(messageEvent, function (e) {
if (e.data === "redirect=todo" || e.message === "redirect=todo"){
eventer(messageEvent, function(e) {
if (
e.data === "redirect=todo" ||
e.message === "redirect=todo"
) {
that.page = "todo";
}
});
@@ -111,6 +134,7 @@ export default {
api.menu
.get()
.then((response) => {
this.setDefaultCasesMenu(response.data);
this.menu = this.mappingMenu(response.data);
this.setCounter();
})
@@ -118,6 +142,18 @@ export default {
console.error(e);
});
},
/**
* Set default cases menu option
*/
setDefaultCasesMenu(data) {
let menuItem = _.find(data, function(o) {
return o.id === window.config._nodeId;
});
if (menuItem && menuItem.href) {
this.page = this.menuMap[window.config._nodeId] || "MyCases";
this.$router.push(menuItem.href);
}
},
/**
* Do a mapping of vue view for menus
* @returns array
@@ -126,22 +162,13 @@ export default {
var i,
j,
newData = data,
auxId,
viewVue = {
CASES_MY_CASES: "MyCases",
CASES_SEARCH: "advanced-search",
CASES_INBOX: "todo",
CASES_DRAFT: "draft",
CASES_PAUSED: "paused",
CASES_SELFSERVICE: "unassigned",
CONSOLIDATED_CASES: "batch-routing",
CASES_TO_REASSIGN: "task-reassignments",
CASES_FOLDERS: "my-documents",
};
auxId;
for (i = 0; i < data.length; i += 1) {
auxId = data[i].id || "";
if (auxId !== "" && viewVue[auxId]) {
newData[i].id = viewVue[auxId];
if (auxId !== "" && this.menuMap[auxId]) {
newData[i].id = this.menuMap[auxId];
} else if (newData[i].href) {
newData[i].id = "LegacyFrame";
}
}
return newData;
@@ -151,10 +178,12 @@ export default {
this.page = "advanced-search";
this.filters = item.item.filters;
this.pageId = item.item.id;
this.pageUri = item.item.href;
this.pageName = item.item.title;
} else {
this.filters = [];
this.pageId = null;
this.pageUri = item.item.href;
this.page = item.item.id || "MyCases";
if (this.$refs["component"] && this.$refs["component"].updateView) {
this.$refs["component"].updateView();
@@ -171,7 +200,7 @@ export default {
var i,
j,
data = response.data;
that.counters = data;
that.counters = data;
for (i = 0; i < that.menu.length; i += 1) {
if (that.menu[i].id && data[that.menu[i].id]) {
that.menu[i].badge.text = data[that.menu[i].id];
@@ -276,7 +305,7 @@ export default {
onUpdateFilters(filters) {
this.filters = filters;
}
},
}
};
</script>

View File

@@ -0,0 +1,40 @@
<template>
<div>
<iframe
:width="width"
ref="xIFrame"
frameborder="0"
:src="pageUri"
:height="height"
allowfullscreen
></iframe>
</div>
</template>
<script>
export default {
name: "LegacyFrame",
components: {},
props: {
pageUri: String,
},
mounted() {
this.height = window.innerHeight - this.diffHeight;
},
data() {
return {
height: "100%",
width: "100%",
diffHeight: 10
};
},
methods: {
classBtn(cls) {
return "btn v-btn-request " + cls;
},
},
};
</script>
<style>
</style>

View File

@@ -64,8 +64,10 @@ export default {
api.process.list
.start()
.then((response) => {
that.categories = that.formatCategories(response.data);
that.categoriesFiltered = that.categories;
if (response.data && response.data.success !== "failure") {
that.categories = that.formatCategories(response.data);
that.categoriesFiltered = that.categories;
}
})
.catch((e) => {
console.error(e);
@@ -131,21 +133,21 @@ export default {
categories = [];
_.each(data, (o) => {
index = _.findIndex(categories, (c) => {
return c.id == o.categoryId;
return c.id == o.pro_category;
});
if (index == -1) {
categories.push({
id: o.categoryId,
title: o.categoryName,
id: o.pro_category,
title: o.category_name,
items: [],
});
index = categories.length - 1;
}
categories[index].items.push({
title: o.text,
description: o.text,
task_uid: o.taskId,
pro_uid: o.processId,
title: o.pro_title,
description: o.pro_description,
task_uid: o.tas_uid,
pro_uid: o.pro_uid,
onClick: that.startNewCase,
});
});

View File

@@ -1,5 +1,14 @@
<template>
<div id="v-mycases" ref="v-mycases" class="v-container-mycases">
<b-alert
:show="dataAlert.dismissCountDown"
dismissible
:variant="dataAlert.variant"
@dismissed="dataAlert.dismissCountDown = 0"
@dismiss-count-down="countDownChanged"
>
{{ dataAlert.message }}
</b-alert>
<button-fleft :data="newCase"></button-fleft>
<MyCasesFilter
:filters="filters"
@@ -15,7 +24,13 @@
:columns="columns"
:options="options"
ref="vueTable"
@row-click="onRowClick"
>
<div slot="detail" slot-scope="props">
<div class="btn-default" @click="openCaseDetail(props.row)">
<i class="fas fa-info-circle"></i>
</div>
</div>
<div slot="case_number" slot-scope="props">
{{ props.row.CASE_NUMBER }}
</div>
@@ -56,6 +71,7 @@ import MyCasesFilter from "../components/search/MyCasesFilter";
import ModalComments from "./modal/ModalComments.vue";
import GroupedCell from "../components/vuetable/GroupedCell.vue";
import api from "./../api/index";
import utils from "./../utils/utils";
export default {
name: "MyCases",
@@ -70,6 +86,12 @@ export default {
props: ["filters"],
data() {
return {
dataAlert: {
dismissSecs: 5,
dismissCountDown: 0,
message: "",
variant: "info"
},
metrics: [],
title: this.$i18n.t('ID_MY_CASES'),
filter: "CASES_INBOX",
@@ -121,11 +143,18 @@ export default {
},
},
translations: null,
pmDateFormat: window.config.FORMATS.dateFormat
pmDateFormat: window.config.FORMATS.dateFormat,
clickCount: 0,
singleClickTimer: null
};
},
mounted() {
this.getHeaders();
// force to open start cases modal
// if the user has start case as a default case menu option
if (window.config._nodeId === "CASES_START_CASE") {
this.$refs["newRequest"].show();
}
},
watch: {},
computed: {
@@ -139,6 +168,43 @@ export default {
updated() {},
beforeCreate() {},
methods: {
/**
* Row click event handler
* @param {object} event
*/
onRowClick(event) {
let self = this;
self.clickCount += 1;
if (self.clickCount === 1) {
self.singleClickTimer = setTimeout(function() {
self.clickCount = 0;
}, 400);
} else if (self.clickCount === 2) {
clearTimeout(self.singleClickTimer);
self.clickCount = 0;
self.openCaseDetail(event.row);
}
},
/**
* Open case detail
*
* @param {object} item
*/
openCaseDetail(item) {
let that = this;
api.cases.open(_.extend({ ACTION: "todo" }, item)).then(() => {
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
});
that.$emit("onUpdatePage", "case-detail");
});
});
},
/**
* Get Cases Headers from BE
*/
@@ -146,8 +212,26 @@ export default {
let that = this;
api.casesHeader.get().then((response) => {
that.headers = that.formatCasesHeaders(response.data);
that.setFilterHeader();
});
},
/**
* Set a filter in the header from Default Cases Menu option
*/
setFilterHeader() {
let header = window.config._nodeId,
filters = this.headers,
filter,
i;
if (header === "CASES_TO_REVISE") {
filter = "SUPERVISING";
}
for (i = 0; i < filters.length; i += 1) {
if (filters[i].item === filter) {
filters[i].onClick(filters[i]);
}
}
},
/**
* Get cases data by header
*/
@@ -218,46 +302,23 @@ export default {
{
TAS_NAME: data[i].tas_title,
STATUS: data[i].tas_color,
PENDING: ""
DELAYED_MSG: data[i].delay,
AVATAR: window.config.SYS_SERVER +
window.config.SYS_URI +
`users/users_ViewPhotoGrid?pUID=${data[i].user_id}`,
USERNAME: utils.userNameDisplayFormat({
userName: data[i].user_tooltip.usr_username,
firstName: data[i].user_tooltip.usr_firstname,
lastName: data[i].user_tooltip.usr_lastname,
format: window.config.FORMATS.format || null
}),
POSITION: data[i].user_tooltip.usr_position,
EMAIL: data[i].user_tooltip.usr_email
}
);
}
return dataFormat;
},
/**
* Get for user format name configured in Processmaker Environment Settings
*
* @param {string} name
* @param {string} lastName
* @param {string} userName
* @return {string} nameFormat
*/
nameFormatCases(name, lastName, userName) {
let nameFormat = "";
if (/^\s*$/.test(name) && /^\s*$/.test(lastName)) {
return nameFormat;
}
if (this.nameFormat === "@firstName @lastName") {
nameFormat = name + " " + lastName;
} else if (this.nameFormat === "@firstName @lastName (@userName)") {
nameFormat = name + " " + lastName + " (" + userName + ")";
} else if (this.nameFormat === "@userName") {
nameFormat = userName;
} else if (this.nameFormat === "@userName (@firstName @lastName)") {
nameFormat = userName + " (" + name + " " + lastName + ")";
} else if (this.nameFormat === "@lastName @firstName") {
nameFormat = lastName + " " + name;
} else if (this.nameFormat === "@lastName, @firstName") {
nameFormat = lastName + ", " + name;
} else if (
this.nameFormat === "@lastName, @firstName (@userName)"
) {
nameFormat = lastName + ", " + name + " (" + userName + ")";
} else {
nameFormat = name + " " + lastName;
}
return nameFormat;
},
/**
* Convert string to date format
*
@@ -344,32 +405,6 @@ export default {
}
return dateToConvert;
},
/**
* Open selected cases in the inbox
*
* @param {object} item
*/
openCase(item) {
const action = "todo";
if (this.isIE) {
window.open(
"../../../cases/open?APP_UID=" +
item.row.APP_UID +
"&DEL_INDEX=" +
item.row.DEL_INDEX +
"&action=" +
action
);
} else {
window.location.href =
"../../../cases/open?APP_UID=" +
item.row.APP_UID +
"&DEL_INDEX=" +
item.row.DEL_INDEX +
"&action=" +
action;
}
},
/**
* Format Response from HEADERS
* @param {*} response
@@ -396,18 +431,21 @@ export default {
},
};
_.forEach(response, (v) => {
data.push({
title: v.title,
counter: v.counter,
item: v.id,
icon: info[v.id].icon,
onClick: (obj) => {
that.title = obj.title;
that.filterHeader = obj.item;
that.$refs["vueTable"].getData();
},
class: info[v.id].class,
});
//Hack for display the SUPERVISING CARD
if(!(v.id === "SUPERVISING" && v.counter === 0)){
data.push({
title: v.title,
counter: v.counter,
item: v.id,
icon: info[v.id].icon,
onClick: (obj) => {
that.title = obj.title;
that.filterHeader = obj.item;
that.$refs["vueTable"].getData();
},
class: info[v.id].class
});
}
});
return data;
},
@@ -437,7 +475,25 @@ export default {
*/
onPostNotes() {
this.$refs["vueTable"].getData();
}
},
/**
* Show the alert message
* @param {string} message - message to be displayen in the body
* @param {string} type - alert type
*/
showAlert(message, type) {
this.dataAlert.message = message;
this.dataAlert.variant = type || "info";
this.dataAlert.dismissCountDown = this.dataAlert.dismissSecs;
},
/**
* Updates the alert dismiss value to update
* dismissCountDown and decrease
* @param {mumber}
*/
countDownChanged(dismissCountDown) {
this.dataAlert.dismissCountDown = dismissCountDown;
},
},
};
</script>
@@ -448,4 +504,4 @@ export default {
padding-left: 50px;
padding-right: 50px;
}
</style>
</style>

View File

@@ -13,6 +13,7 @@
:columns="columns"
:options="options"
ref="vueTable"
@row-click="onRowClick"
>
<div slot="detail" slot-scope="props">
<div class="btn-default" @click="openCaseDetail(props.row)">
@@ -33,15 +34,8 @@
<TaskCell :data="props.row.TASK" />
</div>
<div slot="current_user" slot-scope="props">
{{
nameFormatCases(
props.row.USR_FIRSTNAME,
props.row.USR_LASTNAME,
props.row.USR_USERNAME
)
}}
{{ props.row.USERNAME_DISPLAY_FORMAT }}
</div>
<div slot="due_date" slot-scope="props">
{{ props.row.DUE_DATE }}
</div>
@@ -70,6 +64,7 @@ import CasesFilter from "../components/search/CasesFilter";
import TaskCell from "../components/vuetable/TaskCell.vue";
import ModalUnpauseCase from "./modal/ModalUnpauseCase.vue";
import api from "./../api/index";
import utils from "./../utils/utils";
export default {
name: "Paused",
@@ -132,6 +127,8 @@ export default {
},
},
pmDateFormat: "Y-m-d H:i:s",
clickCount: 0,
singleClickTimer: null
};
},
mounted() {},
@@ -147,6 +144,23 @@ export default {
updated() {},
beforeCreate() {},
methods: {
/**
* On row click event handler
* @param {object} event
*/
onRowClick(event) {
let self = this;
self.clickCount += 1;
if (self.clickCount === 1) {
self.singleClickTimer = setTimeout(function() {
self.clickCount = 0;
}, 400);
} else if (self.clickCount === 2) {
clearTimeout(self.singleClickTimer);
self.clickCount = 0;
self.showModalUnpauseCase(event.row);
}
},
/**
* Get cases todo data
*/
@@ -196,9 +210,12 @@ export default {
CODE_COLOR: v.TAS_COLOR,
COLOR: v.TAS_COLOR_LABEL,
}],
USR_FIRSTNAME: v.USR_FIRSTNAME,
USR_LASTNAME: v.USR_LASTNAME,
USR_USERNAME: v.USR_USERNAME,
USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({
userName: v.USR_LASTNAME,
firstName: v.USR_LASTNAME,
lastName: v.USR_LASTNAME,
format: window.config.FORMATS.format || null
}),
DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL,
DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL,
PRIORITY: v.DEL_PRIORITY_LABEL,
@@ -210,38 +227,6 @@ export default {
});
return data;
},
/**
* Get for user format name configured in Processmaker Environment Settings
*
* @param {string} name
* @param {string} lastName
* @param {string} userName
* @return {string} nameFormat
*/
nameFormatCases(name, lastName, userName) {
let nameFormat = "";
if (/^\s*$/.test(name) && /^\s*$/.test(lastName)) {
return nameFormat;
}
if (this.nameFormat === "@firstName @lastName") {
nameFormat = name + " " + lastName;
} else if (this.nameFormat === "@firstName @lastName (@userName)") {
nameFormat = name + " " + lastName + " (" + userName + ")";
} else if (this.nameFormat === "@userName") {
nameFormat = userName;
} else if (this.nameFormat === "@userName (@firstName @lastName)") {
nameFormat = userName + " (" + name + " " + lastName + ")";
} else if (this.nameFormat === "@lastName @firstName") {
nameFormat = lastName + " " + name;
} else if (this.nameFormat === "@lastName, @firstName") {
nameFormat = lastName + ", " + name;
} else if (this.nameFormat === "@lastName, @firstName (@userName)") {
nameFormat = lastName + ", " + name + " (" + userName + ")";
} else {
nameFormat = name + " " + lastName;
}
return nameFormat;
},
/**
* Open case detail
*
@@ -250,14 +235,16 @@ export default {
openCaseDetail(item) {
let that = this;
api.cases.open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
});
that.$emit("onUpdatePage", "case-detail");
});
that.$emit("onUpdatePage", "case-detail");
});
},
showModalUnpauseCase(item) {

View File

@@ -13,6 +13,7 @@
:columns="columns"
:options="options"
ref="vueTable"
@row-click="onRowClick"
>
<div slot="detail" slot-scope="props">
<div class="btn-default" @click="openCaseDetail(props.row)">
@@ -33,15 +34,8 @@
<TaskCell :data="props.row.TASK" />
</div>
<div slot="current_user" slot-scope="props">
{{
nameFormatCases(
props.row.USR_FIRSTNAME,
props.row.USR_LASTNAME,
props.row.USR_USERNAME
)
}}
{{ props.row.USERNAME_DISPLAY_FORMAT}}
</div>
<div slot="due_date" slot-scope="props">
{{ props.row.DUE_DATE }}
</div>
@@ -65,6 +59,7 @@ import ModalNewRequest from "./ModalNewRequest.vue";
import TaskCell from "../components/vuetable/TaskCell.vue";
import CasesFilter from "../components/search/CasesFilter";
import api from "./../api/index";
import utils from "./../utils/utils";
export default {
name: "Todo",
@@ -124,6 +119,8 @@ export default {
},
},
pmDateFormat: "Y-m-d H:i:s",
clickCount: 0,
singleClickTimer: null
};
},
mounted() {},
@@ -139,6 +136,23 @@ export default {
updated() {},
beforeCreate() {},
methods: {
/**
* On row click event handler
* @param {object} event
*/
onRowClick(event) {
let self = this;
self.clickCount += 1;
if (self.clickCount === 1) {
self.singleClickTimer = setTimeout(function() {
self.clickCount = 0;
}, 400);
} else if (self.clickCount === 2) {
clearTimeout(self.singleClickTimer);
self.clickCount = 0;
self.openCase(event.row);
}
},
/**
* Get cases todo data
*/
@@ -188,9 +202,12 @@ export default {
CODE_COLOR: v.TAS_COLOR,
COLOR: v.TAS_COLOR_LABEL,
}],
USR_FIRSTNAME: v.USR_FIRSTNAME,
USR_LASTNAME: v.USR_LASTNAME,
USR_USERNAME: v.USR_USERNAME,
USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({
userName: v.USR_LASTNAME,
firstName: v.USR_LASTNAME,
lastName: v.USR_LASTNAME,
format: window.config.FORMATS.format || null
}),
DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL,
DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL,
PRIORITY: v.DEL_PRIORITY_LABEL,
@@ -202,38 +219,6 @@ export default {
});
return data;
},
/**
* Get for user format name configured in Processmaker Environment Settings
*
* @param {string} name
* @param {string} lastName
* @param {string} userName
* @return {string} nameFormat
*/
nameFormatCases(name, lastName, userName) {
let nameFormat = "";
if (/^\s*$/.test(name) && /^\s*$/.test(lastName)) {
return nameFormat;
}
if (this.nameFormat === "@firstName @lastName") {
nameFormat = name + " " + lastName;
} else if (this.nameFormat === "@firstName @lastName (@userName)") {
nameFormat = name + " " + lastName + " (" + userName + ")";
} else if (this.nameFormat === "@userName") {
nameFormat = userName;
} else if (this.nameFormat === "@userName (@firstName @lastName)") {
nameFormat = userName + " (" + name + " " + lastName + ")";
} else if (this.nameFormat === "@lastName @firstName") {
nameFormat = lastName + " " + name;
} else if (this.nameFormat === "@lastName, @firstName") {
nameFormat = lastName + ", " + name;
} else if (this.nameFormat === "@lastName, @firstName (@userName)") {
nameFormat = lastName + ", " + name + " (" + userName + ")";
} else {
nameFormat = name + " " + lastName;
}
return nameFormat;
},
/**
* Open selected cases in the inbox
*
@@ -257,15 +242,17 @@ export default {
openCaseDetail(item) {
let that = this;
api.cases.open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
});
that.$emit("onUpdatePage", "case-detail");
});
that.$emit("onUpdatePage", "case-detail");
});
});
},
onRemoveFilter(data) {},
onUpdateFilters(data) {

View File

@@ -13,6 +13,7 @@
:columns="columns"
:options="options"
ref="vueTable"
@row-click="onRowClick"
>
<div slot="detail" slot-scope="props">
<div class="btn-default" @click="openCaseDetail(props.row)">
@@ -32,16 +33,6 @@
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
<div slot="current_user" slot-scope="props">
{{
nameFormatCases(
props.row.USR_FIRSTNAME,
props.row.USR_LASTNAME,
props.row.USR_USERNAME
)
}}
</div>
<div slot="due_date" slot-scope="props">
{{ props.row.DUE_DATE }}
</div>
@@ -94,7 +85,6 @@ export default {
"case_title",
"process_name",
"task",
"current_user",
"due_date",
"delegation_date",
"priority",
@@ -129,6 +119,8 @@ export default {
},
},
pmDateFormat: "Y-m-d H:i:s",
clickCount: 0,
singleClickTimer: null
};
},
mounted() {},
@@ -144,6 +136,23 @@ export default {
updated() {},
beforeCreate() {},
methods: {
/**
* On row click event handler
* @param {object} event
*/
onRowClick(event) {
let self = this;
self.clickCount += 1;
if (self.clickCount === 1) {
self.singleClickTimer = setTimeout(function() {
self.clickCount = 0;
}, 400);
} else if (self.clickCount === 2) {
clearTimeout(self.singleClickTimer);
self.clickCount = 0;
self.claimCase(event.row);
}
},
/**
* Get cases unassigned data
*/
@@ -193,9 +202,6 @@ export default {
CODE_COLOR: v.TAS_COLOR,
COLOR: v.TAS_COLOR_LABEL,
}],
USR_FIRSTNAME: v.USR_FIRSTNAME,
USR_LASTNAME: v.USR_LASTNAME,
USR_USERNAME: v.USR_USERNAME,
DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL,
DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL,
PRIORITY: v.DEL_PRIORITY_LABEL,
@@ -207,42 +213,6 @@ export default {
});
return data;
},
/**
* Get for user format name configured in Processmaker Environment Settings
*
* @param {string} name
* @param {string} lastName
* @param {string} userName
* @return {string} nameFormat
*/
nameFormatCases(name, lastName, userName) {
let nameFormat = "";
if (!(name && lastName && userName)) {
return "";
}
if (/^\s*$/.test(name) && /^\s*$/.test(lastName)) {
return nameFormat;
}
if (this.nameFormat === "@firstName @lastName") {
nameFormat = name + " " + lastName;
} else if (this.nameFormat === "@firstName @lastName (@userName)") {
nameFormat = name + " " + lastName + " (" + userName + ")";
} else if (this.nameFormat === "@userName") {
nameFormat = userName;
} else if (this.nameFormat === "@userName (@firstName @lastName)") {
nameFormat = userName + " (" + name + " " + lastName + ")";
} else if (this.nameFormat === "@lastName @firstName") {
nameFormat = lastName + " " + name;
} else if (this.nameFormat === "@lastName, @firstName") {
nameFormat = lastName + ", " + name;
} else if (this.nameFormat === "@lastName, @firstName (@userName)") {
nameFormat = lastName + ", " + name + " (" + userName + ")";
} else {
nameFormat = name + " " + lastName;
}
return nameFormat;
},
/**
* Claim case
*
@@ -263,14 +233,16 @@ export default {
openCaseDetail(item) {
let that = this;
api.cases.open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
});
that.$emit("onUpdatePage", "case-detail");
});
that.$emit("onUpdatePage", "case-detail");
});
},
onRemoveFilter(data) {},

View File

@@ -52,6 +52,7 @@ export default {
mounted() {},
data() {
return {
permission: true,
dataAlert: {
dismissSecs: 5,
dismissCountDown: 0,
@@ -114,18 +115,33 @@ export default {
return "btn v-btn-request " + cls;
},
show() {
this.getCasesNotes();
this.$refs["modal-comments"].show();
let that = this;
//Clean the data attached documents for ever
this.dataAttachedDocuments.items = [];
this.getCasesNotes((response) => {
if (that.permission) {
that.$refs["modal-comments"].show();
} else {
that.$parent.showAlert(
that.$i18n.t("ID_CASES_NOTES_NO_PERMISSIONS"),
"danger"
);
}
});
},
cancel() {
this.$refs["modal-comments"].hide();
},
getCasesNotes() {
getCasesNotes(callback) {
let that = this;
Api.cases
.casenotes(this.dataCase)
.then((response) => {
that.formatResponseCaseNotes(response.data.notes);
that.permission = response.data.noPerms == 1 ? false : true;
if (_.isFunction(callback)) {
callback(response);
}
})
.catch((err) => {
throw new Error(err);
@@ -138,6 +154,7 @@ export default {
let that = this,
notesArray = [];
_.each(notes, (n) => {
n.id = _.random(1000000);
notesArray.push({
user: that.nameFormatCases(
n.USR_FIRSTNAME,
@@ -154,6 +171,7 @@ export default {
},
dropFiles(files) {
this.attachDocuments = true;
this.dataAttachedDocuments.items = [];
this.dataAttachedDocuments.items = files;
},
/**

View File

@@ -0,0 +1,23 @@
import _ from "lodash";
export default {
/**
* Environment Formats function for full name
* @param {object} params
*/
userNameDisplayFormat(params) {
let aux;
let defaultValues = {
userName: '',
firstName: '',
lastName: '',
format: '(@lastName, @firstName) @userName'
};
_.assignIn(defaultValues, params);
console.log(defaultValues);
aux = defaultValues.format;
aux = aux.replace('@userName',defaultValues.userName);
aux = aux.replace('@firstName',defaultValues.firstName);
aux = aux.replace('@lastName',defaultValues.lastName);
return aux;
}
}

View File

@@ -154,4 +154,24 @@ class UserTest extends TestCase
$results = User::getId(G::generateUniqueID());
$this->assertEquals(0, $results);
}
/**
* It test get the user information
*
* @covers \ProcessMaker\Model\User::scopeUserId()
* @covers \ProcessMaker\Model\User::getInformation()
* @test
*/
public function it_get_information()
{
$user = factory(User::class)->create();
// When the user exist
$results = User::getInformation($user->USR_ID);
$this->assertNotEmpty($results);
$this->assertArrayHasKey('usr_username', $results);
$this->assertArrayHasKey('usr_firstname', $results);
$this->assertArrayHasKey('usr_lastname', $results);
$this->assertArrayHasKey('usr_email', $results);
$this->assertArrayHasKey('usr_position', $results);
}
}

View File

@@ -228,9 +228,9 @@ class Cases
*/
public function getStartCasesPerType($sUIDUser = '', $typeView = null)
{
$rows[] = array('uid' => 'char', 'value' => 'char');
$tasks = array();
$arrayTaskTypeToExclude = array(
$rows[] = ['uid' => 'char', 'value' => 'char'];
$tasks = [];
$arrayTaskTypeToExclude = [
"WEBENTRYEVENT",
"END-MESSAGE-EVENT",
"START-MESSAGE-EVENT",
@@ -239,11 +239,11 @@ class Cases
"SCRIPT-TASK",
"START-TIMER-EVENT",
"INTERMEDIATE-CATCH-TIMER-EVENT"
);
];
$webEntryEvent = new WebEntryEvent();
$arrayWebEntryEvent = array();
//Set the parameter $considerShowInCase=true, to consider the WE_SHOW_IN_CASE
//configuration to filter the Start events with WebEntry.
$arrayWebEntryEvent = [];
// Set the parameter $considerShowInCase=true, to consider the WE_SHOW_IN_CASE
// configuration to filter the Start events with WebEntry.
$allWebEntryEvents = $webEntryEvent->getAllWebEntryEvents(true);
foreach ($allWebEntryEvents as $webEntryEvents) {
$arrayWebEntryEvent[] = $webEntryEvents["ACT_UID"];
@@ -300,16 +300,17 @@ class Cases
$c->addSelectColumn(TaskPeer::TAS_TITLE);
$c->addSelectColumn(TaskPeer::PRO_UID);
$c->addSelectColumn(ProcessPeer::PRO_TITLE);
$c->addSelectColumn(ProcessPeer::PRO_DESCRIPTION);
if ($typeView == 'category') {
$c->addAsColumn('PRO_CATEGORY', 'PCS.PRO_CATEGORY');
$c->addAsColumn('CATEGORY_NAME', 'PCSCAT.CATEGORY_NAME');
$c->addAlias('PCS', 'PROCESS');
$c->addAlias('PCSCAT', 'PROCESS_CATEGORY');
$aConditions = array();
$aConditions[] = array(TaskPeer::PRO_UID, 'PCS.PRO_UID');
$aConditions = [];
$aConditions[] = [TaskPeer::PRO_UID, 'PCS.PRO_UID'];
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$aConditions = array();
$aConditions[] = array('PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID');
$aConditions = [];
$aConditions[] = ['PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID'];
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
}
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
@@ -333,19 +334,21 @@ class Cases
$row['TAS_TITLE'] = $taskTitle->getTasTitle();
$row['CATEGORY_NAME'] = ($row['CATEGORY_NAME'] == '') ?
G::LoadTranslation('ID_PROCESS_NOCATEGORY') : $row['CATEGORY_NAME'];
$rows[] = array(
$rows[] = [
'uid' => $row['TAS_UID'],
'value' => $row['PRO_TITLE'] . ' (' . $taskTitleLabel . ')',
'pro_uid' => $row['PRO_UID'],
'pro_description' => $row['PRO_DESCRIPTION'],
'cat' => $row['PRO_CATEGORY'],
'catname' => $row['CATEGORY_NAME']
);
];
} else {
$rows[] = array(
$rows[] = [
'uid' => $row['TAS_UID'],
'value' => $row['PRO_TITLE'] . ' (' . $taskTitleLabel . ')',
'pro_uid' => $row['PRO_UID']
);
'pro_uid' => $row['PRO_UID'],
'pro_description' => $row['PRO_DESCRIPTION']
];
}
$rs->next();
$row = $rs->getRow();
@@ -7344,24 +7347,26 @@ class Cases
$canStart = $this->canStartCase($usrUid);
if ($canStart) {
$processList = array();
$processList = [];
$list = $this->getStartCasesPerType($usrUid, $typeView);
foreach ($list as $index => $row) {
if (!empty($row['pro_uid'])) {
if ($typeView == 'category') {
$processList[] = array(
$processList[] = [
'tas_uid' => $row['uid'],
'pro_title' => $row['value'],
'pro_uid' => $row['pro_uid'],
'pro_description' => $row['pro_description'],
'pro_category' => $row['cat'],
'category_name' => $row['catname']
);
];
} else {
$processList[] = array(
$processList[] = [
'tas_uid' => $row['uid'],
'pro_title' => $row['value'],
'pro_uid' => $row['pro_uid']
);
'pro_uid' => $row['pro_uid'],
'pro_description' => $row['pro_description']
];
}
}
}

View File

@@ -927,9 +927,14 @@ class LdapAdvanced
$arrayData['countUser']++;
if ((is_array($username) && !empty($username)) || trim($username) != '') {
$dataUserLdap = $this->getUserDataFromAttribute($username, $arrayUserLdap);
$dataUserLdap["usrRole"] = "";
if (!empty($arrayAuthSourceData['AUTH_SOURCE_DATA']['USR_ROLE'])) {
$dataUserLdap["usrRole"] = $arrayAuthSourceData['AUTH_SOURCE_DATA']['USR_ROLE'];
}
$arrayData = $this->groupSynchronizeUser(
$groupUid,
$this->getUserDataFromAttribute($username, $arrayUserLdap),
$dataUserLdap,
$arrayData
);
}
@@ -1631,7 +1636,14 @@ class LdapAdvanced
}
}
public function automaticRegister($aAuthSource, $strUser, $strPass)
/**
* Automatic register.
* @param array $authSource
* @param string $strUser
* @param string $strPass
* @return bool
*/
public function automaticRegister($authSource, $strUser, $strPass)
{
$rbac = RBAC::getSingleton();
@@ -1645,52 +1657,56 @@ class LdapAdvanced
$user = $this->searchUserByUid($strUser);
$res = 0;
$result = 0;
if (!empty($user)) {
if ($this->VerifyLogin($user['sUsername'], $strPass) === true) {
$res = 1;
$result = 1;
}
if ($res == 0 && $this->VerifyLogin($user['sDN'], $strPass) === true) {
$res = 1;
if ($result == 0 && $this->VerifyLogin($user['sDN'], $strPass) === true) {
$result = 1;
}
} else {
return $res;
return $result;
}
if ($res == 0) {
$aAuthSource = $rbac->authSourcesObj->load($this->sAuthSource);
$aAttributes = array();
if ($result == 0) {
$authSource = $rbac->authSourcesObj->load($this->sAuthSource);
$attributes = [];
if (isset($aAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'])) {
$aAttributes = $aAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'];
if (isset($authSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'])) {
$attributes = $authSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'];
}
$aData = array();
$aData['USR_USERNAME'] = $user['sUsername'];
$aData["USR_PASSWORD"] = "00000000000000000000000000000000";
$aData['USR_FIRSTNAME'] = $user['sFirstname'];
$aData['USR_LASTNAME'] = $user['sLastname'];
$aData['USR_EMAIL'] = $user['sEmail'];
$aData['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2));
$aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s');
$aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s');
$aData['USR_BIRTHDAY'] = date('Y-m-d');
$aData['USR_STATUS'] = (isset($user['USR_STATUS'])) ? (($user['USR_STATUS'] == 'ACTIVE') ? 1 : 0) : 1;
$aData['USR_AUTH_TYPE'] = strtolower($aAuthSource['AUTH_SOURCE_PROVIDER']);
$aData['UID_AUTH_SOURCE'] = $aAuthSource['AUTH_SOURCE_UID'];
$aData['USR_AUTH_USER_DN'] = $user['sDN'];
$aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR';
$usrRole = 'PROCESSMAKER_OPERATOR';
if (!empty($authSource['AUTH_SOURCE_DATA']['USR_ROLE'])) {
$usrRole = $authSource['AUTH_SOURCE_DATA']['USR_ROLE'];
}
$data = [];
$data['USR_USERNAME'] = $user['sUsername'];
$data["USR_PASSWORD"] = "00000000000000000000000000000000";
$data['USR_FIRSTNAME'] = $user['sFirstname'];
$data['USR_LASTNAME'] = $user['sLastname'];
$data['USR_EMAIL'] = $user['sEmail'];
$data['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2));
$data['USR_CREATE_DATE'] = date('Y-m-d H:i:s');
$data['USR_UPDATE_DATE'] = date('Y-m-d H:i:s');
$data['USR_BIRTHDAY'] = date('Y-m-d');
$data['USR_STATUS'] = (isset($user['USR_STATUS'])) ? (($user['USR_STATUS'] == 'ACTIVE') ? 1 : 0) : 1;
$data['USR_AUTH_TYPE'] = strtolower($authSource['AUTH_SOURCE_PROVIDER']);
$data['UID_AUTH_SOURCE'] = $authSource['AUTH_SOURCE_UID'];
$data['USR_AUTH_USER_DN'] = $user['sDN'];
$data['USR_ROLE'] = $usrRole;
if (!empty($aAttributes)) {
foreach ($aAttributes as $value) {
if (!empty($attributes)) {
foreach ($attributes as $value) {
if (isset($user[$value['attributeUser']])) {
$aData[$value['attributeUser']] = str_replace("*", "'", $user[$value['attributeUser']]);
$data[$value['attributeUser']] = str_replace("*", "'", $user[$value['attributeUser']]);
if ($value['attributeUser'] == 'USR_STATUS') {
$evalValue = $aData[$value['attributeUser']];
$evalValue = $data[$value['attributeUser']];
$statusValue = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] : 'ACTIVE';
$aData[$value['attributeUser']] = $statusValue;
$data[$value['attributeUser']] = $statusValue;
}
}
}
@@ -1698,23 +1714,23 @@ class LdapAdvanced
//req - accountexpires
if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"] != '') {
$aData["USR_DUE_DATE"] = $this->convertDateADtoPM($user["USR_DUE_DATE"]);
$data["USR_DUE_DATE"] = $this->convertDateADtoPM($user["USR_DUE_DATE"]);
}
//end
$sUserUID = $rbac->createUser($aData, 'PROCESSMAKER_OPERATOR');
$aData['USR_UID'] = $sUserUID;
$userUid = $rbac->createUser($data, $usrRole);
$data['USR_UID'] = $userUid;
require_once 'classes/model/Users.php';
$oUser = new Users();
$aData['USR_STATUS'] = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] : 'ACTIVE';
$oUser->create($aData);
$users = new Users();
$data['USR_STATUS'] = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] : 'ACTIVE';
$users->create($data);
$this->log(null, "Automatic Register for user $strUser ");
$res = 1;
$result = 1;
}
return $res;
return $result;
}
/**
@@ -2260,15 +2276,15 @@ class LdapAdvanced
}
/**
* creates an users using the data send in the array $aUsers
* creates an users using the data send in the array $user
* and then add the user to specific department
* this function is used in cron only
*
* @param array $aUser info taken from ldap
* @param array $user info taken from ldap
* @param string $depUid the department UID
* @return boolean
*/
public function createUserAndActivate($aUser, $depUid)
public function createUserAndActivate($user, $depUid)
{
$rbac = RBAC::getSingleton();
@@ -2284,41 +2300,42 @@ class LdapAdvanced
$rbac->usersRolesObj = new UsersRoles();
}
$sUsername = $aUser['sUsername'];
$sFullname = $aUser['sFullname'];
$sFirstname = $aUser['sFirstname'];
$sLastname = $aUser['sLastname'];
$sEmail = $aUser['sEmail'];
$sDn = $aUser['sDN'];
$sUsername = $user['sUsername'];
$sFullname = $user['sFullname'];
$sFirstname = $user['sFirstname'];
$sLastname = $user['sLastname'];
$sEmail = $user['sEmail'];
$sDn = $user['sDN'];
$usrRole = empty($user['usrRole']) ? 'PROCESSMAKER_OPERATOR' : $user['usrRole'];
$aData = array();
$aData['USR_USERNAME'] = $sUsername;
$aData["USR_PASSWORD"] = "00000000000000000000000000000000";
$aData['USR_FIRSTNAME'] = $sFirstname;
$aData['USR_LASTNAME'] = $sLastname;
$aData['USR_EMAIL'] = $sEmail;
$aData['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2));
$aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s');
$aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s');
$aData['USR_BIRTHDAY'] = date('Y-m-d');
$aData['USR_STATUS'] = 1;
$aData['USR_AUTH_TYPE'] = 'ldapadvanced';
$aData['UID_AUTH_SOURCE'] = $this->sAuthSource;
$aData['USR_AUTH_USER_DN'] = $sDn;
$data = [];
$data['USR_USERNAME'] = $sUsername;
$data["USR_PASSWORD"] = "00000000000000000000000000000000";
$data['USR_FIRSTNAME'] = $sFirstname;
$data['USR_LASTNAME'] = $sLastname;
$data['USR_EMAIL'] = $sEmail;
$data['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2));
$data['USR_CREATE_DATE'] = date('Y-m-d H:i:s');
$data['USR_UPDATE_DATE'] = date('Y-m-d H:i:s');
$data['USR_BIRTHDAY'] = date('Y-m-d');
$data['USR_STATUS'] = 1;
$data['USR_AUTH_TYPE'] = 'ldapadvanced';
$data['UID_AUTH_SOURCE'] = $this->sAuthSource;
$data['USR_AUTH_USER_DN'] = $sDn;
$sUserUID = $rbac->createUser($aData, "PROCESSMAKER_OPERATOR");
$userUid = $rbac->createUser($data, $usrRole);
$aData['USR_STATUS'] = 'ACTIVE';
$aData['USR_UID'] = $sUserUID;
$aData['DEP_UID'] = $depUid;
$aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR';
$data['USR_STATUS'] = 'ACTIVE';
$data['USR_UID'] = $userUid;
$data['DEP_UID'] = $depUid;
$data['USR_ROLE'] = $usrRole;
require_once 'classes/model/Users.php';
$oUser = new Users();
$oUser->create($aData);
$users = new Users();
$users->create($data);
return $sUserUID;
return $userUid;
}
public function synchronizeManagers($managersHierarchy)

View File

@@ -10493,6 +10493,12 @@ msgstr "You have set a invalid Application Number"
msgid "Invalid Case Delegation index for this user"
msgstr "Invalid Case Delegation index for this user"
# TRANSLATION
# LABEL/ID_INVALID_CASE_NUMBER
#: LABEL/ID_INVALID_CASE_NUMBER
msgid "Invalid case number"
msgstr "Invalid case number"
# TRANSLATION
# LABEL/ID_INVALID_CASE_NUMBER_RANGE
#: LABEL/ID_INVALID_CASE_NUMBER_RANGE

View File

@@ -58605,6 +58605,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_INVALID_APPLICATION_NUMBER','en','You have set a invalid Application Number','2014-01-15') ,
( 'LABEL','ID_INVALID_CASE_DELEGATION_INDEX','en','Invalid Case Delegation index for this user','2014-01-15') ,
( 'LABEL','ID_INVALID_CASE_NUMBER_RANGE','en','Invalid case number range, use e.g. 1-5, 8, 11-13','2020-12-16') ,
( 'LABEL','ID_INVALID_CASE_NUMBER','en','Invalid case number','2020-12-22') ,
( 'LABEL','ID_INVALID_DATA','en','Invalid data','2014-01-15') ,
( 'LABEL','ID_INVALID_END_HOURS','en','The following end hours rows are invalid:','2014-01-15') ,
( 'LABEL','ID_INVALID_EXTENSION','en','Invalid file extension!','2014-01-15') ,

View File

@@ -65,7 +65,7 @@ $G_TMP_MENU->AddIdRawOption(
$G_TMP_MENU->AddIdRawOption(
'CASES_SENT',
'casesListExtJs?action=sent',
G::LoadTranslation('ID_SENT'),
G::LoadTranslation('ID_MY_CASES'),
'icon-cases-outbox.png'
);
$G_TMP_MENU->AddIdRawOption(

View File

@@ -13,7 +13,7 @@
</b-form-file>
<b-form-invalid-feedback>{{$root.translation('ID_IS_REQUIRED')}}</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$root.translation('ID_CONNECTION_WITH_THE_SAME_NAME_PLEASE_SELECT_AN_OPTION')" v-else>
<b-form-group :label="$root.translation('ID_CONNECTION_WITH_THE_SAME_NAME_PLEASE_SELECT_AN_OPTION',[fileContent.AUTH_SOURCE_NAME])" v-else>
<b-form-file v-model="form.connectionSettings"
@change="change"
:state="validateState('connectionSettings')"

View File

@@ -37,7 +37,13 @@ if (isset($_GET['ux'])) {
echo '} else { window.parent.location.href = \''.$pathDerivateGmail.'\'; }';
} else {
/*----------------------------------********---------------------------------*/
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';
echo '} else {
if (parent.parent.postMessage) {
parent.parent.postMessage("redirect=todo","*");
} else {
window.parent.location.href = \'casesListExtJs\';
}
}';
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/

View File

@@ -1,4 +1,5 @@
<?php
/**
* cases_ShowDocument.php
*
@@ -50,7 +51,7 @@ if (!empty($_SESSION['GUEST_USER']) && $_SESSION['GUEST_USER'] === RBAC::GUEST_U
}
$access = $RBAC->userCanAccess('PM_FOLDERS_ALL') != 1 && defined('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION') && DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION == 0;
if ($access && $isGuestUser === false) {
if (!$oAppDocument->canDownloadInput($_SESSION['USER_LOGGED'], $_GET['a'], $docVersion)) {
if ((isset($_SESSION['USER_LOGGED']) && !$oAppDocument->canDownloadInput($_SESSION['USER_LOGGED'], $_GET['a'], $docVersion)) || !isset($_SESSION['USER_LOGGED'])) {
G::header('Location: /errors/error403.php?url=' . urlencode($_SERVER['REQUEST_URI']));
die();
}
@@ -131,4 +132,4 @@ if (!$sw_file_exists) {
G::streamFile($realPath, $bDownload, $nameFile); //download
}
}
}
}

View File

@@ -131,6 +131,8 @@ $userCanAccess = 1;
global $translation;
$pmDynaform = new PmDynaform();
ScriptVariables::add('defaultOption', $defaultOption);
ScriptVariables::add('_nodeId', isset($confDefaultOption) ? $confDefaultOption : "PM_USERS");
ScriptVariables::add('SYS_CREDENTIALS', $pmDynaform->getCredentials());
ScriptVariables::add('SYS_SERVER', System::getHttpServerHostnameRequestsFrontEnd());
ScriptVariables::add('SYS_WORKSPACE', config("system.workspace"));

View File

@@ -224,7 +224,7 @@
this.statusNameMessage = this.$root.translation("ID_INVALID_MAX_PERMITTED", [this.$root.translation('ID_ATTRIBUTE_NAME'), '50']);
return;
}
if (/^[a-zA-Z][-_0-9a-zA-Z]+$/.test(this.form.name) === false) {
if (/^[a-zA-Z][-_0-9a-zA-Z\s]+$/.test(this.form.name) === false) {
this.statusName = false;
this.statusNameMessage = this.$root.translation("ID_USE_ALPHANUMERIC_CHARACTERS_INCLUDING", ["- _"]);
return;
@@ -360,7 +360,7 @@
formToFormData(form) {
let formData = new FormData();
formData.append("UEA_ID", form.id);
formData.append("UEA_NAME", form.name);
formData.append("UEA_NAME", form.name.trim());
formData.append("UEA_ATTRIBUTE_ID", form.attributeId);
formData.append("UEA_HIDDEN", form.hidden);
formData.append("UEA_REQUIRED", form.required);

View File

@@ -845,10 +845,14 @@
});
},
getUsersList() {
if(this.filterUser.trim() === ""){
this.usersList = [];
return null;
}
let formData = new FormData();
formData.append("action", "usersList");
formData.append("USR_UID", this.form.USR_UID);
formData.append("filter", this.filterUser);
formData.append("filter", this.filterUser.trim());
return axios.post(this.$root.baseUrl() + "users/usersAjax", formData)
.then(response => {
response;

View File

@@ -1113,6 +1113,7 @@ class AbstractCases implements CasesInterface
}
if ($key === 'due_date') {
$threadTasks[$i][$key] = $row;
$threadTasks[$i]['delay'] = getDiffBetweenDates($row, date("Y-m-d H:i:s"));
// Get task color label
$threadTasks[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($row) : '';
$threadTasks[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$threadTasks[$i]['tas_color']] : '';
@@ -1122,15 +1123,18 @@ class AbstractCases implements CasesInterface
// Thread tasks
if($key === 'user_id') {
$threadTasks[$i][$key] = $row;
// Get the user tooltip information
$threadTasks[$i]['user_tooltip'] = User::getInformation($row);
}
} else {
// Thread users
if ($key === 'user_id') {
$threadUsers[$i][$key] = $row;
$user = (!empty($row)) ? User::where('USR_ID', $row)->first(): null;
$threadUsers[$i]['usr_username'] = $user ? $user->USR_USERNAME : '';
$threadUsers[$i]['usr_lastname'] = $user ? $user->USR_LASTNAME : '';
$threadUsers[$i]['usr_firstname'] = $user ? $user->USR_FIRSTNAME : '';
// Get user information
$userInfo = User::getInformation($row);
$threadUsers[$i]['usr_username'] = !empty($userInfo) ? $userInfo['usr_username'] : '';
$threadUsers[$i]['usr_lastname'] = !empty($userInfo) ? $userInfo['usr_lastname'] : '';
$threadUsers[$i]['usr_firstname'] = !empty($userInfo) ? $userInfo['usr_firstname'] : '';
}
// Thread titles
if ($key === 'del_id') {

View File

@@ -6,6 +6,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\AppNotes;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
class Participated extends AbstractCases
{
@@ -19,8 +20,8 @@ class Participated extends AbstractCases
'APPLICATION.APP_STATUS', // Status
'APPLICATION.APP_CREATE_DATE', // Start Date
'APPLICATION.APP_FINISH_DATE', // Finish Date
'USERS.USR_ID', // Current UserId
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date related to the colors
'USERS.USR_ID', // Current UserId
// Additional column for other functionalities
'APP_DELEGATION.APP_UID', // Case Uid for Open case
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
@@ -179,8 +180,11 @@ class Participated extends AbstractCases
$result[$i]['tas_title'] = $thread['TAS_TITLE'];
$result[$i]['user_id'] = $thread['USR_ID'];
$result[$i]['due_date'] = $thread['DEL_TASK_DUE_DATE'];
$result[$i]['delay'] = getDiffBetweenDates($thread['DEL_TASK_DUE_DATE'], date("Y-m-d H:i:s"));
$result[$i]['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE']) : '';
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
// Get the user tooltip information
$result[$i]['user_tooltip'] = User::getInformation($thread['USR_ID']);
$i++;
}
$item['PENDING'] = $result;
@@ -188,8 +192,11 @@ class Participated extends AbstractCases
$result[$i]['tas_title'] = $item['TAS_TITLE'];
$result[$i]['user_id'] = $item['USR_ID'];
$result[$i]['due_date'] = $item['DEL_TASK_DUE_DATE'];
$result[$i]['delay'] = getDiffBetweenDates($item['DEL_TASK_DUE_DATE'], date("Y-m-d H:i:s"));
$result[$i]['tas_color'] = (!empty($item['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($item['DEL_TASK_DUE_DATE']) : '';
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
// Get the user tooltip information
$result[$i]['user_tooltip'] = User::getInformation($item['USR_ID']);
$item['PENDING'] = $result;
}
break;
@@ -206,8 +213,11 @@ class Participated extends AbstractCases
$result[$i]['tas_title'] = $item['TAS_TITLE'];
$result[$i]['user_id'] = $item['USR_ID'];
$result[$i]['due_date'] = $item['DEL_TASK_DUE_DATE'];
$result[$i]['delay'] = getDiffBetweenDates($item['DEL_TASK_DUE_DATE'], date("Y-m-d H:i:s"));
$result[$i]['tas_color'] = (!empty($item['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($item['DEL_TASK_DUE_DATE']) : '';
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
// Get the user tooltip information
$result[$i]['user_tooltip'] = User::getInformation($item['USR_ID']);
$item['PENDING'] = $result;
break;
}

View File

@@ -19,6 +19,7 @@ class Supervising extends AbstractCases
'APPLICATION.APP_CREATE_DATE', // Start Date
'APPLICATION.APP_FINISH_DATE', // Finish Date
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date related to the colors
'USERS.USR_ID', // Current UserId
// Additional column for other functionalities
'APP_DELEGATION.APP_UID', // Case Uid for Open case
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
@@ -128,8 +129,6 @@ class Supervising extends AbstractCases
$query->joinApplication();
// Only cases in to_do
$query->caseTodo();
// Scope that return the results for an specific user
$query->userId($this->getUserId());
// Scope the specific array of processes supervising
$query->processInList($processes);
// Group by appNumber

View File

@@ -45,6 +45,19 @@ class User extends Model
return $result;
}
/**
* Scope for query to get the user by USR_ID
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param int $usrId
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeUserId($query, string $usrId)
{
return $query->where('USR_ID', '=', $usrId);
}
/**
* Return the groups from a user
*
@@ -171,6 +184,7 @@ class User extends Model
throw new Exception("Error getting the users: {$e->getMessage()}.");
}
}
/**
* Get the user id
*
@@ -191,4 +205,35 @@ class User extends Model
return $id;
}
/**
* Get user information for the tooltip
*
* @param int $usrId
*
* @return array
*/
public static function getInformation($usrId)
{
$query = User::query()->select([
'USR_USERNAME',
'USR_FIRSTNAME',
'USR_LASTNAME',
'USR_EMAIL',
'USR_POSITION'
])
->userId($usrId)
->limit(1);
$results = $query->get();
$info = [];
$results->each(function ($item) use (&$info) {
$info['usr_username'] = $item->USR_USERNAME;
$info['usr_firstname'] = $item->USR_FIRSTNAME;
$info['usr_lastname'] = $item->USR_LASTNAME;
$info['usr_email'] = $item->USR_EMAIL;
$info['usr_position'] = $item->USR_POSITION;
});
return $info;
}
}

View File

@@ -620,6 +620,8 @@ function applyMaskDateEnvironment(string $date, $mask = '')
if (!empty($date)) {
$date = new DateTime($date);
$result = $date->format($mask);
} else {
$result = $date;
}
return $result;