Merge branch 'feature/PMCORE-3049' of https://bitbucket.org/colosa/processmaker into taskmetrics
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
</template>
|
||||
<b-container fluid>
|
||||
<p>
|
||||
{{ $t("ID_ARE_YOU_SURE_DELETE_CUSTOM_CASE_LIST") }}
|
||||
{{ $t("ID_ARE_YOU_SURE_DELETE_CUSTOM_CASE_LIST", {'CUSTOM_NAME': data.name}) }}
|
||||
</p>
|
||||
</b-container>
|
||||
<div class="modal-footer">
|
||||
@@ -40,7 +40,9 @@ export default {
|
||||
name: "ModalDeleteCaseList",
|
||||
data() {
|
||||
return {
|
||||
data: null
|
||||
data: {
|
||||
name: null
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
187
resources/assets/js/admin/Modals/ModalImport.vue
Normal file
187
resources/assets/js/admin/Modals/ModalImport.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-modal
|
||||
ref="modal-import"
|
||||
hide-footer
|
||||
size="md"
|
||||
>
|
||||
<template v-slot:modal-title>
|
||||
{{ $t('ID_IMPORT_CUSTOM_CASE_LIST') }}
|
||||
</template>
|
||||
<b-container fluid>
|
||||
<div v-if="!caseListDuplicate">
|
||||
{{ $t('ID_PLEASE_ADD_THE_CUSTOM_LIST_FILE_TO_BE_UPLOADED') }}
|
||||
</div>
|
||||
<div v-if="caseListDuplicate">
|
||||
{{ message }}
|
||||
</div>
|
||||
<div>
|
||||
<b-form-file
|
||||
v-model="fileCaseList"
|
||||
:state="validFile"
|
||||
ref="file-input"
|
||||
:disabled="caseListDuplicate"
|
||||
></b-form-file>
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
</b-container>
|
||||
<div class="modal-footer">
|
||||
<div class="float-right">
|
||||
<b-button
|
||||
variant="danger"
|
||||
data-dismiss="modal"
|
||||
@click="hide"
|
||||
>
|
||||
{{ $t("ID_CANCEL") }}
|
||||
</b-button>
|
||||
<b-button
|
||||
variant="success"
|
||||
v-if="!caseListDuplicate"
|
||||
@click="importCustomCaseList"
|
||||
>
|
||||
{{ $t("ID_SAVE") }}
|
||||
</b-button>
|
||||
<b-button
|
||||
variant="info"
|
||||
v-if="caseListDuplicate"
|
||||
@click="continueImport()"
|
||||
>
|
||||
{{ $t("ID_CONTINUE") }}
|
||||
</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</b-modal>
|
||||
<!-- pmTable does not exist in the workspace -->
|
||||
<b-modal
|
||||
size="md"
|
||||
ok-only
|
||||
:ok-title="$t('ID_CLOSE')"
|
||||
ok-variant="danger"
|
||||
v-model="pmTableNoExist"
|
||||
>
|
||||
<template v-slot:modal-title>
|
||||
{{ $t('ID_IMPORT_CUSTOM_CASE_LIST') }}
|
||||
</template>
|
||||
<b-container fluid>
|
||||
<div>
|
||||
{{ message }}
|
||||
</div>
|
||||
</b-container>
|
||||
</b-modal>
|
||||
<!-- pmTable incomplete columns for custom case list -->
|
||||
<b-modal
|
||||
hide-footer
|
||||
size="md"
|
||||
v-model="pmTableNoFields"
|
||||
>
|
||||
<template v-slot:modal-title>
|
||||
{{ $t('ID_IMPORT_CUSTOM_CASE_LIST') }}
|
||||
</template>
|
||||
<b-container fluid>
|
||||
<div>
|
||||
{{ message }}
|
||||
</div>
|
||||
</b-container>
|
||||
<div class="modal-footer">
|
||||
<div class="float-right">
|
||||
<b-button
|
||||
variant="danger"
|
||||
data-dismiss="modal"
|
||||
@click="close"
|
||||
>
|
||||
{{ $t("ID_CLOSE") }}
|
||||
</b-button>
|
||||
<b-button
|
||||
variant="info"
|
||||
@click="continueImport"
|
||||
>
|
||||
{{ $t("ID_CONTINUE") }}
|
||||
</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</b-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from "./../settings/customCaseList/Api/CaseList";
|
||||
export default {
|
||||
name: "ModalImport",
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
validFile: null,
|
||||
fileCaseList: null,
|
||||
caseListDuplicate: false,
|
||||
pmTableNoFields: false,
|
||||
pmTableNoExist: false,
|
||||
message: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show() {
|
||||
this.caseListDuplicate = false;
|
||||
this.$refs["modal-import"].show();
|
||||
},
|
||||
close() {
|
||||
this.pmTableNoFields = false;
|
||||
},
|
||||
hide() {
|
||||
this.caseListDuplicate = false;
|
||||
this.$refs["modal-import"].hide();
|
||||
},
|
||||
importCustomCaseList() {
|
||||
let that = this;
|
||||
this.data.file = this.fileCaseList;
|
||||
api.importCaseList(this.data)
|
||||
.then((response) => {
|
||||
switch (response.data.status) {
|
||||
case 'tableNotExist': // pmTable does not exist
|
||||
that.pmTableNoExist = true;
|
||||
that.message = response.data.message
|
||||
that.$refs["modal-import"].hide();
|
||||
break;
|
||||
case 'duplicateName': // Custom Case List duplicate
|
||||
that.caseListDuplicate = true;
|
||||
that.message = response.data.message
|
||||
that.validFile = null;
|
||||
break;
|
||||
case 'invalidFields': // pmTable differentes columns
|
||||
that.pmTableNoFields = true;
|
||||
that.message = response.data.message
|
||||
that.$refs["modal-import"].hide();
|
||||
break;
|
||||
default: // import without error
|
||||
that.$refs["modal-import"].hide();
|
||||
that.$parent.$refs["table"].getData();
|
||||
break;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
},
|
||||
continueImport() {
|
||||
let that = this;
|
||||
this.data.file = this.fileCaseList;
|
||||
if (this.pmTableNoFields) {
|
||||
this.data.continue = 'invalidFields';
|
||||
}
|
||||
if (this.caseListDuplicate) {
|
||||
this.data.continue = 'duplicateName';
|
||||
}
|
||||
api.importCaseList(this.data)
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
that.$refs["modal-import"].hide();
|
||||
that.$parent.$refs["table"].getData();
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -56,8 +56,13 @@ class caseListApi extends Api {
|
||||
keys: {}
|
||||
});
|
||||
}
|
||||
getDefault(module){
|
||||
return Defaults[module]
|
||||
getDefault(type){
|
||||
return this.get({
|
||||
service: 'DEFAULT_COLUMNS',
|
||||
keys: {
|
||||
type: type
|
||||
}
|
||||
});
|
||||
}
|
||||
createCaseList(data) {
|
||||
return this.post({
|
||||
@@ -74,6 +79,20 @@ class caseListApi extends Api {
|
||||
data: data
|
||||
});
|
||||
}
|
||||
importCaseList(data) {
|
||||
let formData = new FormData();
|
||||
formData.append('file_content', data.file);
|
||||
if (data.continue) {
|
||||
formData.append(data.continue, 'continue');
|
||||
}
|
||||
return this.post({
|
||||
service: "IMPOR_CASE_LIST",
|
||||
data: formData,
|
||||
headers:{
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
let api = new caseListApi(Services);
|
||||
|
||||
|
||||
@@ -5,5 +5,7 @@ export default {
|
||||
CASE_LIST_PAUSED: "/caseList/paused",
|
||||
REPORT_TABLES: "/caseList/report-tables",
|
||||
CASE_LIST: "/caseList",
|
||||
PUT_CASE_LIST: "/caseList/{id}"
|
||||
DEFAULT_COLUMNS: "/caseList/{type}/default-columns",
|
||||
PUT_CASE_LIST: "/caseList/{id}",
|
||||
IMPOR_CASE_LIST: "/caseList/import"
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<b-row>
|
||||
<b-col cols="6">
|
||||
<b-row>
|
||||
<b-col>
|
||||
<b-col cols="6">
|
||||
<b-form-group
|
||||
id="nameLabel"
|
||||
:label="$t('ID_NAME')"
|
||||
@@ -28,7 +28,7 @@
|
||||
</b-form-invalid-feedback>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
<b-col>
|
||||
<b-col cols="6">
|
||||
<div :class="{ invalid: isValidTable === false }">
|
||||
<label>{{ $t("ID_PM_TABLE") }}</label>
|
||||
<multiselect
|
||||
@@ -237,18 +237,34 @@
|
||||
:checked="props.row.selected"
|
||||
:value="props.row.field"
|
||||
/>
|
||||
<b-form-checkbox
|
||||
slot="enableFilter"
|
||||
slot-scope="props"
|
||||
v-model="enabledFilterRows"
|
||||
@change="onTongleFilter(props.row.field)"
|
||||
name="check-button"
|
||||
:checked="props.row.enableFilter"
|
||||
:value="props.row.field"
|
||||
switch
|
||||
>
|
||||
</b-form-checkbox>
|
||||
|
||||
<div slot="enableFilter" slot-scope="props">
|
||||
<b-row>
|
||||
<b-col cols="6">
|
||||
<i
|
||||
ref="iconClose"
|
||||
class="fas fa-info-circle"
|
||||
:id="`popover-1-${props.row.field}`"
|
||||
></i>
|
||||
<b-popover
|
||||
:target="`popover-1-${props.row.field}`"
|
||||
placement="top"
|
||||
triggers="hover focus"
|
||||
:content="searchInfoContent(props.row)"
|
||||
></b-popover>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<b-form-checkbox
|
||||
v-model="enabledFilterRows"
|
||||
@change="onTongleFilter(props.row.field)"
|
||||
name="check-button"
|
||||
:checked="props.row.enableFilter"
|
||||
:value="props.row.field"
|
||||
switch
|
||||
>
|
||||
</b-form-checkbox>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
<div slot="action" slot-scope="props">
|
||||
<b-button
|
||||
variant="light"
|
||||
@@ -339,8 +355,8 @@ export default {
|
||||
name: this.$i18n.t("ID_NAME"),
|
||||
field: this.$i18n.t("ID_FIELD"),
|
||||
type: this.$i18n.t("ID_TYPE"),
|
||||
typeOfSearching: this.$i18n.t("ID_TYPE_OF_SEARCHING"),
|
||||
enableSearchFilter: this.$i18n.t("ID_ENABLE_SEARCH_FILTER"),
|
||||
typeSearch: this.$i18n.t("ID_TYPE_OF_SEARCHING"),
|
||||
enableFilter: this.$i18n.t("ID_ENABLE_SEARCH_FILTER"),
|
||||
action: "",
|
||||
},
|
||||
filterable: false,
|
||||
@@ -351,7 +367,7 @@ export default {
|
||||
count: "",
|
||||
},
|
||||
},
|
||||
defaultCaseList: null,
|
||||
defaultCaseList: [],
|
||||
isValidName: null,
|
||||
isValidTable: null,
|
||||
pmTable: null
|
||||
@@ -363,14 +379,36 @@ export default {
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.defaultCaseList = Api.getDefault(this.module.key);
|
||||
this.dataCaseList = this.defaultCaseList;
|
||||
this.getDefaultColumns(this.module.key);
|
||||
if(this.params.id) {
|
||||
this.editMode();
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* Prepare search popover info
|
||||
* @param {object} row
|
||||
* @returns {string}
|
||||
*/
|
||||
searchInfoContent(row) {
|
||||
let info = this.$i18n.t("ID_THE_SEARCH_WILL_BE_FROM");
|
||||
switch (row.type) {
|
||||
case 'integer':
|
||||
info += " " + this.$i18n.t("ID_A_RANGE_OF_VALUES");
|
||||
break;
|
||||
case 'string':
|
||||
info += " " + this.$i18n.t("ID_A_TEXT_SEARCH");
|
||||
break;
|
||||
case 'date':
|
||||
info += " " + this.$i18n.t("ID_DATE_TO_DATE");
|
||||
break;
|
||||
default:
|
||||
info = this.$i18n.t("ID_NO_SEARCHING_METHOD");
|
||||
}
|
||||
return info;
|
||||
},
|
||||
|
||||
/**
|
||||
* Edit mode handler
|
||||
* prepare the datato be rendered
|
||||
@@ -584,9 +622,9 @@ export default {
|
||||
Api.updateCaseList(this.params)
|
||||
.then((response) => {
|
||||
this.$emit("closeSketch");
|
||||
|
||||
})
|
||||
.catch((err) => {
|
||||
this.makeToast('danger', this.$i18n.t('ID_ERROR'), err.response.statusText);
|
||||
console.error(err);
|
||||
});
|
||||
} else {
|
||||
@@ -596,6 +634,7 @@ export default {
|
||||
|
||||
})
|
||||
.catch((err) => {
|
||||
this.makeToast('danger',this.$i18n.t('ID_ERROR') ,err.response.statusText);
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
@@ -622,7 +661,37 @@ export default {
|
||||
onTongleFilter(field){
|
||||
let objIndex = this.dataCaseList.findIndex((obj => obj.field === field));
|
||||
this.dataCaseList[objIndex].enableFilter = !this.dataCaseList[objIndex].enableFilter
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Make the toast component
|
||||
* @param {string} variant
|
||||
* @param {string} title
|
||||
* @param {string} message
|
||||
*/
|
||||
makeToast(variant = null, title, message) {
|
||||
this.$bvToast.toast(message, {
|
||||
title: `${title || variant}`,
|
||||
variant: variant,
|
||||
solid: true
|
||||
})
|
||||
},
|
||||
/**
|
||||
* Get default Columns
|
||||
* @param {string} type
|
||||
*/
|
||||
getDefaultColumns(type) {
|
||||
let that = this;
|
||||
Api.getDefault(type)
|
||||
.then((response) => {
|
||||
if (!that.params.columns) {
|
||||
that.dataCaseList = response.data;
|
||||
}
|
||||
that.defaultCaseList = response.data;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div id="people">
|
||||
<ModalDeleteCaseList ref="modal-delete-list"></ModalDeleteCaseList>
|
||||
<ModalPreview ref="modal-preview"></ModalPreview>
|
||||
<ModalImport ref="modal-import"></ModalImport>
|
||||
<button-fleft :data="newList"></button-fleft>
|
||||
<button-fleft :data="importList"></button-fleft>
|
||||
<v-server-table
|
||||
@@ -29,6 +30,7 @@ import utils from "../../../utils/utils";
|
||||
import OwnerCell from "../../../components/vuetable/OwnerCell";
|
||||
import ModalDeleteCaseList from "./../../Modals/ModalDeleteCaseList.vue";
|
||||
import ModalPreview from "./../../Modals/ModalPreview.vue";
|
||||
import ModalImport from "./../../Modals/ModalImport.vue";
|
||||
import download from "downloadjs";
|
||||
|
||||
export default {
|
||||
@@ -40,6 +42,7 @@ export default {
|
||||
OwnerCell,
|
||||
ModalDeleteCaseList,
|
||||
ModalPreview,
|
||||
ModalImport,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -69,7 +72,7 @@ export default {
|
||||
title: this.$i18n.t("Import List"),
|
||||
class: "btn-success",
|
||||
onClick: () => {
|
||||
//TODO button
|
||||
this.importCustomCaseList();
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
@@ -235,8 +238,32 @@ export default {
|
||||
*/
|
||||
downloadCaseList(data) {
|
||||
var fileName = data.name,
|
||||
typeMime = "text/plain";
|
||||
download(JSON.stringify(data), fileName + ".json", typeMime);
|
||||
typeMime = "text/plain",
|
||||
dataExport = [];
|
||||
dataExport = this.filterDataToExport(data);
|
||||
download(JSON.stringify(dataExport), fileName + ".json", typeMime);
|
||||
},
|
||||
/**
|
||||
* Filter the sensible information to export
|
||||
* @param {Array} data
|
||||
*/
|
||||
filterDataToExport(data) {
|
||||
var dataExport = [];
|
||||
dataExport.push({
|
||||
type: data['type'],
|
||||
name: data['name'],
|
||||
description: data['description'],
|
||||
tableUid: data['tableUid'],
|
||||
tableName: data['tableName'],
|
||||
columns: data['columns'],
|
||||
userId: data['userId'],
|
||||
iconList: data['iconList'],
|
||||
iconColor: data['iconColor'],
|
||||
iconColorScreen: data['iconColorScreen'],
|
||||
createDate: data['createDate'],
|
||||
updateDate: data['updateDate']
|
||||
});
|
||||
return dataExport;
|
||||
},
|
||||
/**
|
||||
* Show options in the ellipsis
|
||||
@@ -282,6 +309,14 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
importCustomCaseList() {
|
||||
this.$refs["modal-import"].show();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
<style>
|
||||
.float-right {
|
||||
padding-left: 1.5%;
|
||||
}
|
||||
</style>
|
||||
@@ -6,7 +6,11 @@
|
||||
:class="item.class"
|
||||
v-bind="item.attributes"
|
||||
>
|
||||
{{ item.title }} <b-icon icon="pie-chart-fill"></b-icon>
|
||||
{{ item.title }}
|
||||
<b-icon
|
||||
:icon="item.icon || ''"
|
||||
@click="item.onClick(item) || function() {}"
|
||||
></b-icon>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="!isItemHidden"
|
||||
@@ -50,7 +54,6 @@
|
||||
isMobileItem
|
||||
"
|
||||
>
|
||||
<sidebar-menu-badge v-if="item.badge" :badge="item.badge" />
|
||||
<div
|
||||
v-if="itemHasChild"
|
||||
class="vsm--arrow"
|
||||
@@ -141,7 +144,7 @@
|
||||
|
||||
<template #modal-footer="{ cancel }">
|
||||
<b-button size="sm" variant="danger" @click="cancel()">
|
||||
Cancel
|
||||
{{ $t("ID_CLOSE") }}
|
||||
</b-button>
|
||||
</template>
|
||||
</b-modal>
|
||||
@@ -154,6 +157,7 @@ import draggable from "vuedraggable";
|
||||
import CustomSidebarMenuLink from "./CustomSidebarMenuLink";
|
||||
import CustomSidebarMenuIcon from "./CustomSidebarMenuIcon";
|
||||
import CustomTooltip from "./../utils/CustomTooltip.vue";
|
||||
import eventBus from "./../../home/EventBus/eventBus";
|
||||
|
||||
export default {
|
||||
name: "CustomSidebarMenuItem",
|
||||
@@ -203,7 +207,7 @@ export default {
|
||||
draggable,
|
||||
CustomSidebarMenuLink,
|
||||
CustomSidebarMenuIcon,
|
||||
CustomTooltip
|
||||
CustomTooltip,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -213,7 +217,7 @@ export default {
|
||||
itemHover: false,
|
||||
exactActive: false,
|
||||
active: false,
|
||||
titleHover: '',
|
||||
titleHover: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -257,7 +261,18 @@ export default {
|
||||
return !!(this.item.child && this.item.child.length > 0);
|
||||
},
|
||||
isItemHidden() {
|
||||
return false;
|
||||
if (this.isCollapsed) {
|
||||
if (
|
||||
this.item.hidden &&
|
||||
this.item.hiddenOnCollapse === undefined
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return this.item.hiddenOnCollapse === true;
|
||||
}
|
||||
} else {
|
||||
return this.item.hidden === true;
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
@@ -362,7 +377,7 @@ export default {
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Ensurre if the link exact is active
|
||||
* Ensurre if the link exact is active
|
||||
* @param {object} item
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -374,7 +389,6 @@ export default {
|
||||
*/
|
||||
initState() {
|
||||
this.initActiveState();
|
||||
this.initShowState();
|
||||
},
|
||||
/**
|
||||
* Initalize the active state of the menu item
|
||||
@@ -384,7 +398,7 @@ export default {
|
||||
this.exactActive = this.isLinkExactActive(this.item);
|
||||
},
|
||||
/**
|
||||
* Initialize and show active state menu item
|
||||
* Initialize and show active state menu item
|
||||
*/
|
||||
initShowState() {
|
||||
if (!this.itemHasChild || this.showChild) return;
|
||||
@@ -404,9 +418,11 @@ export default {
|
||||
checkMove: function(e) {
|
||||
let aux = this.item.child.splice(e.newIndex, 1);
|
||||
this.item.child.splice(e.newIndex, 0, aux[0]);
|
||||
this.emitItemUpdate(this.item, this.item);
|
||||
eventBus.$emit("sort-menu", this.item.child);
|
||||
},
|
||||
/**
|
||||
* Click event Handler
|
||||
* Click event Handler
|
||||
* @param {object} event
|
||||
*/
|
||||
clickEvent(event) {
|
||||
@@ -476,13 +492,16 @@ export default {
|
||||
if (this.hover) return;
|
||||
if (!this.isCollapsed || !this.isFirstLevel || this.isMobileItem)
|
||||
return;
|
||||
this.$emit("unset-mobile-item", true);
|
||||
this.$parent.$emit("unset-mobile-item", true);
|
||||
setTimeout(() => {
|
||||
if (this.mobileItem !== this.item) {
|
||||
this.$emit("set-mobile-item", { item: this.item, itemEl });
|
||||
if (this.$parent.mobileItem !== this.item) {
|
||||
this.$parent.$emit("set-mobile-item", {
|
||||
item: this.item,
|
||||
itemEl,
|
||||
});
|
||||
}
|
||||
if (event.type === "click" && !this.itemHasChild) {
|
||||
this.$emit("unset-mobile-item", false);
|
||||
this.$parent.$emit("unset-mobile-item", false);
|
||||
}
|
||||
}, 0);
|
||||
},
|
||||
|
||||
@@ -214,7 +214,10 @@ export default {
|
||||
handler(newVal, oldVal) {
|
||||
this.searchTags = [];
|
||||
this.selected = [];
|
||||
this.setFilters(newVal);
|
||||
if (newVal.length) {
|
||||
this.setFilters(newVal, oldVal);
|
||||
this.searchClickHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -272,17 +275,20 @@ export default {
|
||||
* Set Filters and make the tag labels
|
||||
* @param {object} filters json to manage the query
|
||||
*/
|
||||
setFilters(filters) {
|
||||
setFilters(filters, oldVal) {
|
||||
let self = this;
|
||||
_.forEach(filters, function (item, key) {
|
||||
let component = _.find(self.filterItems, function (o) {
|
||||
return o.id === item.fieldId;
|
||||
});
|
||||
if (component) {
|
||||
self.searchTags.push(component.id);
|
||||
self.selected = component.id;
|
||||
self.itemModel[component.id] = component;
|
||||
self.itemModel[component.id].autoShow = typeof item.autoShow !== "undefined" ? item.autoShow : true
|
||||
self.searchTags.push(component.id);
|
||||
self.selected.push(component.id);
|
||||
self.itemModel[component.id] = component;
|
||||
self.itemModel[component.id].autoShow = typeof item.autoShow !== "undefined" ? item.autoShow : true;
|
||||
if (oldVal && !oldVal.length) {
|
||||
self.updateSearchTag(item);
|
||||
}
|
||||
}
|
||||
if(item.fieldId === "processName") {
|
||||
self.searchTags.push(self.processName.id);
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
<template>
|
||||
<span
|
||||
:id="data.id"
|
||||
:id="`label-${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>
|
||||
<b-tooltip :target="`label-${data.id}`" :ref="`tooltip-${data.id}`">
|
||||
{{ labelTooltip }}
|
||||
</b-tooltip>
|
||||
</span>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -29,43 +22,44 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
labelTooltip: "",
|
||||
hovering: "",
|
||||
show: false,
|
||||
menuMap: {
|
||||
CASES_INBOX: "inbox",
|
||||
CASES_DRAFT: "draft",
|
||||
CASES_PAUSED: "paused",
|
||||
CASES_SELFSERVICE: "unassigned"
|
||||
}
|
||||
}
|
||||
CASES_SELFSERVICE: "unassigned",
|
||||
todo: "inbox",
|
||||
draft: "draft",
|
||||
paused: "paused",
|
||||
unassigned: "unassigned",
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* Delay the hover event
|
||||
*/
|
||||
hoverHandler() {
|
||||
this.hovering = setTimeout(() => { this.setTooltip() }, 3000);
|
||||
this.setTooltip();
|
||||
},
|
||||
/**
|
||||
* Reset the delay and hide the tooltip
|
||||
*/
|
||||
unhoverHandler() {
|
||||
let key = `tooltip-${this.data.id}`;
|
||||
this.labelTooltip = "";
|
||||
this.show = false;
|
||||
clearTimeout(this.hovering);
|
||||
this.$refs[key].$emit("close");
|
||||
},
|
||||
/**
|
||||
* 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;
|
||||
});
|
||||
api.menu.getTooltip(that.data.id).then((response) => {
|
||||
let key = `tooltip-${that.data.id}`;
|
||||
that.labelTooltip = response.data.label;
|
||||
that.$refs[key].$emit("open");
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
<template>
|
||||
<font-awesome-icon v-if="props.sortable" :icon="icon" class="fa-pull-right"/>
|
||||
<i v-if="props.sortable" :class="icon"></i>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "VtSortControl",
|
||||
props: ['props'],
|
||||
computed: {
|
||||
icon() {
|
||||
// if not sorted return base icon
|
||||
if (!this.props.sortStatus.sorted) return 'sort';
|
||||
// return sort direction icon
|
||||
return this.props.sortStatus.asc ? 'sort-amount-up' : 'sort-amount-down';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
export default {
|
||||
name: "VtSortControl",
|
||||
props: ["props"],
|
||||
computed: {
|
||||
icon() {
|
||||
// if not sorted return base icon
|
||||
if (!this.props.sortStatus.sorted) return "fas fa-sort";
|
||||
// return sort direction icon
|
||||
return this.props.sortStatus.asc
|
||||
? "fas fa-sort-amount-up"
|
||||
: "fas fa-sort-amount-down";
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -221,8 +221,11 @@ export default {
|
||||
limit = data.limit,
|
||||
filters = {},
|
||||
start = data.page === 1 ? 0 : limit * (data.page - 1);
|
||||
paged = start + "," + limit;
|
||||
filters["paged"] = paged;
|
||||
paged = start + "," + limit ;
|
||||
filters = {
|
||||
limit: limit,
|
||||
offset: start
|
||||
};
|
||||
_.forIn(this.filters, function (item, key) {
|
||||
if(filters && item.value) {
|
||||
filters[item.filterVar] = item.value;
|
||||
|
||||
@@ -48,9 +48,15 @@
|
||||
<b-button
|
||||
v-if="props.row.STATUS === 'OPEN'"
|
||||
@click="onClick(props)"
|
||||
variant="outline-primary"
|
||||
variant="outline-success"
|
||||
>{{ $t("ID_CONTINUE") }}</b-button
|
||||
>
|
||||
<b-button
|
||||
v-if="props.row.STATUS === 'PAUSED'"
|
||||
@click="onClickUnpause(props)"
|
||||
variant="outline-primary"
|
||||
>{{ $t("ID_UNPAUSE") }}</b-button
|
||||
>
|
||||
</div>
|
||||
</v-server-table>
|
||||
</div>
|
||||
@@ -428,6 +434,9 @@ export default {
|
||||
that.dataComments.noPerms = response.data.noPerms || 0;
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.response.data) {
|
||||
that.showAlert(err.response.data.error.message, "danger");
|
||||
}
|
||||
throw new Error(err);
|
||||
});
|
||||
},
|
||||
@@ -576,6 +585,18 @@ export default {
|
||||
this.$emit("onUpdatePage", "XCase");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Unpause click handler
|
||||
*
|
||||
* @param {object} data
|
||||
*/
|
||||
onClickUnpause(data) {
|
||||
Api.cases.unpause(data.row).then((response) => {
|
||||
if (response.statusText === "OK") {
|
||||
this.$refs["vueTable"].getData();
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Claim case
|
||||
*
|
||||
|
||||
@@ -418,12 +418,10 @@ export default {
|
||||
start = data.page === 1 ? 0 : limit * (data.page - 1),
|
||||
filters = {},
|
||||
sort = "";
|
||||
paged = start + "," + limit;
|
||||
|
||||
filters = {
|
||||
paged: paged,
|
||||
limit: limit,
|
||||
offset: start
|
||||
};
|
||||
|
||||
_.forIn(this.filters, function (item, key) {
|
||||
if(filters && item.value) {
|
||||
filters[item.filterVar] = item.value;
|
||||
|
||||
4
resources/assets/js/home/EventBus/eventBus.js
Normal file
4
resources/assets/js/home/EventBus/eventBus.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import Vue from 'vue'
|
||||
const eventBus = new Vue()
|
||||
|
||||
export default eventBus
|
||||
@@ -26,7 +26,7 @@
|
||||
:defaultOption="defaultOption"
|
||||
:settings="config.setting[page]"
|
||||
:filters="filters"
|
||||
@onSubmitFilter="onSubmitFilter"
|
||||
@onSubmitFilter="onSubmitFilter"
|
||||
@onRemoveFilter="onRemoveFilter"
|
||||
@onUpdatePage="onUpdatePage"
|
||||
@onUpdateDataCase="onUpdateDataCase"
|
||||
@@ -34,15 +34,16 @@
|
||||
@onUpdateFilters="onUpdateFilters"
|
||||
@cleanDefaultOption="cleanDefaultOption"
|
||||
@updateUserSettings="updateUserSettings"
|
||||
></component>
|
||||
></component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import CustomSidebar from "./../components/menu/CustomSidebar";
|
||||
import CustomSidebarMenuItem from "./../components/menu/CustomSidebarMenuItem";
|
||||
import MyCases from "./MyCases/MyCases.vue";
|
||||
import MyDocuments from "./MyDocuments";
|
||||
import Todo from "./Inbox/Todo.vue";
|
||||
import Inbox from "./Inbox/Inbox.vue";
|
||||
import Paused from "./Paused/Paused.vue";
|
||||
import Draft from "./Draft/Draft.vue";
|
||||
import Unassigned from "./Unassigned/Unassigned.vue";
|
||||
@@ -55,7 +56,7 @@ import AdvancedSearch from "./AdvancedSearch/AdvancedSearch.vue";
|
||||
import LegacyFrame from "./LegacyFrame";
|
||||
|
||||
import api from "./../api/index";
|
||||
|
||||
import eventBus from './EventBus/eventBus'
|
||||
export default {
|
||||
name: "Home",
|
||||
components: {
|
||||
@@ -66,7 +67,7 @@ export default {
|
||||
BatchRouting,
|
||||
TaskReassignments,
|
||||
XCase,
|
||||
Todo,
|
||||
Inbox,
|
||||
Draft,
|
||||
Paused,
|
||||
Unassigned,
|
||||
@@ -91,14 +92,14 @@ export default {
|
||||
filters: null,
|
||||
config: {
|
||||
id: window.config.userId || "1",
|
||||
name: "home",
|
||||
name: "userConfig",
|
||||
setting: {}
|
||||
},
|
||||
menuMap: {
|
||||
CASES_MY_CASES: "MyCases",
|
||||
CASES_SENT: "MyCases",
|
||||
CASES_SEARCH: "advanced-search",
|
||||
CASES_INBOX: "todo",
|
||||
CASES_INBOX: "inbox",
|
||||
CASES_DRAFT: "draft",
|
||||
CASES_PAUSED: "paused",
|
||||
CASES_SELFSERVICE: "unassigned",
|
||||
@@ -110,14 +111,18 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
this.onResize();
|
||||
this.getMenu();
|
||||
this.getUserSettings();
|
||||
this.listenerIframe();
|
||||
window.setInterval(
|
||||
this.setCounter,
|
||||
parseInt(window.config.FORMATS.casesListRefreshTime) * 1000
|
||||
);
|
||||
// adding eventBus listener
|
||||
eventBus.$on('sort-menu', (data) => {
|
||||
that.updateUserSettings('customCasesList', data);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
@@ -134,7 +139,7 @@ export default {
|
||||
|
||||
eventer(messageEvent, function(e) {
|
||||
if ( e.data === "redirect=todo" || e.message === "redirect=todo"){
|
||||
that.page = "todo";
|
||||
that.page = "inbox";
|
||||
}
|
||||
if ( e.data === "update=debugger" || e.message === "update=debugger"){
|
||||
if(that.$refs["component"].updateView){
|
||||
@@ -168,10 +173,11 @@ export default {
|
||||
name: this.config.name
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data) {
|
||||
this.config = response.data;
|
||||
} else {
|
||||
if(response.data && response.data.status === 404) {
|
||||
this.createUserSettings();
|
||||
} else if (response.data) {
|
||||
this.config = response.data;
|
||||
this.getMenu();
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -183,10 +189,7 @@ export default {
|
||||
*/
|
||||
createUserSettings() {
|
||||
api.config
|
||||
.post({
|
||||
...this.configParams,
|
||||
...{setting: '{}'}
|
||||
})
|
||||
.post(this.config)
|
||||
.then((response) => {
|
||||
if (response.data) {
|
||||
this.config = response.data;
|
||||
@@ -248,9 +251,82 @@ export default {
|
||||
} else if (newData[i].href) {
|
||||
newData[i].id = "LegacyFrame";
|
||||
}
|
||||
// Tasks group need pie chart icon
|
||||
if (data[i].header && data[i].id === "FOLDERS") {
|
||||
data[i] = {
|
||||
component: CustomSidebarMenuItem,
|
||||
props: {
|
||||
isCollapsed: this.collapsed? true: false,
|
||||
item: {
|
||||
header: data[i].header,
|
||||
title: data[i].title,
|
||||
hiddenOnCollapse: data[i].hiddenOnCollapse,
|
||||
icon: 'pie-chart-fill',
|
||||
onClick: function (item) {
|
||||
// TODO click evet handler
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data[i].id === "inbox" || data[i].id === "draft"
|
||||
|| data[i].id === "paused" || data[i].id === "unassigned") {
|
||||
data[i]["child"] = this.sortCustomCasesList(
|
||||
data[i].customCasesList,
|
||||
this.config.setting[this.page] &&
|
||||
this.config.setting[this.page].customCasesList
|
||||
? this.config.setting[this.page].customCasesList
|
||||
: []
|
||||
);
|
||||
data[i]["sortable"] = data[i].customCasesList.length > 1;
|
||||
data[i]["sortIcon"] = "gear-fill";
|
||||
data[i] = {
|
||||
component: CustomSidebarMenuItem,
|
||||
props: {
|
||||
isCollapsed: this.collapsed? true: false,
|
||||
item: data[i]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
return newData;
|
||||
},
|
||||
/**
|
||||
* Sort the custom case list menu items
|
||||
* @param {array} list
|
||||
* @param {array} ref
|
||||
* @returns {array}
|
||||
*/
|
||||
sortCustomCasesList(list, ref) {
|
||||
let item,
|
||||
newList = [],
|
||||
temp = [];
|
||||
if (ref && ref.length) {
|
||||
ref.forEach(function (menu) {
|
||||
item = list.find(x => x.id === menu.id);
|
||||
if (item) {
|
||||
newList.push(item);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return list;
|
||||
}
|
||||
temp = list.filter(this.comparerById(newList));
|
||||
return [...newList, ...temp];
|
||||
|
||||
},
|
||||
/**
|
||||
* Util to compare an array by id
|
||||
* @param {array} otherArray
|
||||
* @returns {object}
|
||||
*/
|
||||
comparerById(otherArray){
|
||||
return function(current){
|
||||
return otherArray.filter(function(other){
|
||||
return other.id == current.id
|
||||
}).length == 0;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Set a default icon if the item doesn't have one
|
||||
*/
|
||||
@@ -282,8 +358,8 @@ export default {
|
||||
this.pageId = null;
|
||||
this.pageUri = item.item.href;
|
||||
this.page = item.item.id || "MyCases";
|
||||
if (this.page === this.lastPage
|
||||
&& this.$refs["component"]
|
||||
if (this.page === this.lastPage
|
||||
&& this.$refs["component"]
|
||||
&& this.$refs["component"].updateView) {
|
||||
this.$refs["component"].updateView();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<ModalReassignCase ref="modal-reassign-case"></ModalReassignCase>
|
||||
<CasesFilter
|
||||
:filters="filters"
|
||||
:title="$t('ID_CASES_STATUS_TO_DO')"
|
||||
:title="$t('ID_INBOX')"
|
||||
:icon="icon"
|
||||
@onRemoveFilter="onRemoveFilter"
|
||||
@onUpdateFilters="onUpdateFilters"
|
||||
@@ -232,7 +232,7 @@ import { Event } from 'vue-tables-2';
|
||||
import CurrentUserCell from "../../components/vuetable/CurrentUserCell.vue";
|
||||
|
||||
export default {
|
||||
name: "Todo",
|
||||
name: "Inbox",
|
||||
mixins: [defaultMixins],
|
||||
components: {
|
||||
HeaderCounter,
|
||||
@@ -463,11 +463,10 @@ export default {
|
||||
start = data.page === 1 ? 0 : limit * (data.page - 1),
|
||||
filters = {},
|
||||
sort = "";
|
||||
paged = start + "," + limit;
|
||||
|
||||
filters = {
|
||||
paged: paged,
|
||||
}
|
||||
limit: limit,
|
||||
offset: start
|
||||
};
|
||||
_.forIn(this.filters, function (item, key) {
|
||||
if(filters && item.value) {
|
||||
filters[item.filterVar] = item.value;
|
||||
@@ -368,10 +368,10 @@ export default {
|
||||
start = data.page === 1 ? 0 : limit * (data.page - 1),
|
||||
filters = {},
|
||||
sort = "";
|
||||
paged = start + "," + limit;
|
||||
filters = {
|
||||
filter: that.filterHeader,
|
||||
paged: paged,
|
||||
limit: limit,
|
||||
offset: start
|
||||
};
|
||||
_.forIn(this.filters, function(item, key) {
|
||||
if (filters && item.value) {
|
||||
|
||||
@@ -461,12 +461,10 @@ export default {
|
||||
start = data.page === 1 ? 0 : limit * (data.page - 1),
|
||||
filters = {},
|
||||
sort = "";
|
||||
paged = start + "," + limit;
|
||||
|
||||
filters = {
|
||||
paged: paged,
|
||||
limit: limit,
|
||||
offset: start
|
||||
};
|
||||
|
||||
_.forIn(this.filters, function (item, key) {
|
||||
if(filters && item.value) {
|
||||
filters[item.filterVar] = item.value;
|
||||
|
||||
@@ -427,12 +427,10 @@ export default {
|
||||
start = data.page === 1 ? 0 : limit * (data.page - 1),
|
||||
filters = {},
|
||||
sort = "";
|
||||
paged = start + "," + limit;
|
||||
|
||||
filters = {
|
||||
paged: paged,
|
||||
limit: limit,
|
||||
offset: start
|
||||
};
|
||||
|
||||
_.forIn(this.filters, function (item, key) {
|
||||
if(filters && item.value) {
|
||||
filters[item.filterVar] = item.value;
|
||||
|
||||
@@ -9,15 +9,12 @@ import VtSortControl from './../components/vuetable/extends/VtSortControl';
|
||||
import SettingsPopover from "../components/vuetable/SettingsPopover.vue";
|
||||
import Sortable from 'sortablejs';
|
||||
import "@fortawesome/fontawesome-free/css/all.css";
|
||||
import "@fortawesome/fontawesome-free/js/all.js";
|
||||
import 'bootstrap/dist/css/bootstrap-grid.css';
|
||||
import 'bootstrap/dist/css/bootstrap.min.css'
|
||||
import 'bootstrap-vue/dist/bootstrap-vue.css';
|
||||
import VueApexCharts from 'vue-apexcharts'
|
||||
import 'bootstrap-vue/dist/bootstrap-vue.css'
|
||||
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
import Home from "./Home";
|
||||
|
||||
Vue.use(VueApexCharts);
|
||||
@@ -26,7 +23,6 @@ Vue.use(VueSidebarMenu);
|
||||
Vue.use(BootstrapVue);
|
||||
Vue.use(BootstrapVueIcons);
|
||||
Vue.use(VueI18n);
|
||||
Vue.component('font-awesome-icon', FontAwesomeIcon);
|
||||
|
||||
Vue.use(ServerTable, {}, false, 'bootstrap3', {
|
||||
tableHeading: VtTableHeadingCustom,
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
width: 30px;
|
||||
text-align: center;
|
||||
border-radius: 3px;
|
||||
margin-top: 8px;
|
||||
margin-right: 0px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ class CasesMenuHighlightTest extends TestCase
|
||||
|
||||
// Check if the object is valid
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertArrayHasKey('item', $result[0]);
|
||||
$this->assertArrayHasKey('highlight', $result[0]);
|
||||
$this->assertEquals('CASES_SELFSERVICE', $result[0]['item']);
|
||||
$this->assertEquals(true, $result[0]['highlight']);
|
||||
$this->assertArrayHasKey('item', $result[7]);
|
||||
$this->assertArrayHasKey('highlight', $result[7]);
|
||||
$this->assertEquals('CASES_SELFSERVICE', $result[7]['item']);
|
||||
$this->assertEquals(true, $result[7]['highlight']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,18 @@ class CasesListTest extends TestCase
|
||||
return $delegation;
|
||||
}
|
||||
|
||||
/**
|
||||
* This test construct
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\CasesList::__construct()
|
||||
* @test
|
||||
*/
|
||||
public function it_test_construct()
|
||||
{
|
||||
$casesList = new CasesList();
|
||||
$this->assertInstanceOf(CasesList::class, $casesList);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test getAllCounters
|
||||
*
|
||||
@@ -57,4 +69,29 @@ class CasesListTest extends TestCase
|
||||
$this->assertArrayHasKey('CASES_INBOX', $result);
|
||||
$this->assertArrayHasKey('CASES_DRAFT', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test getAllCounters
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\CasesList::atLeastOne()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\BatchRouting::atLeastOne()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Canceled::atLeastOne()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Completed::atLeastOne()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::atLeastOne()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::atLeastOne()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Participated::atLeastOne()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::atLeastOne()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::atLeastOne()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_at_least_one()
|
||||
{
|
||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
|
||||
$count = new CasesList();
|
||||
$result = $count->atLeastOne($delegation->USR_UID);
|
||||
$this->assertNotEmpty($result);
|
||||
$firstItem = head($result);
|
||||
$this->assertArrayHasKey('item', $firstItem);
|
||||
$this->assertArrayHasKey('highlight', $firstItem);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
use DateInterval;
|
||||
use Datetime;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\BusinessModel\Cases\Draft;
|
||||
@@ -766,4 +768,116 @@ class DraftTest extends TestCase
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCasesRisk() method with on time filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_cases_risk_on_time()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff1Day = new DateInterval('P1D');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$process = factory(Process::class)->create();
|
||||
$user = factory(User::class)->create();
|
||||
$application = factory(Application::class, 14)->states('draft')->create([
|
||||
'APP_INIT_USER' => $user->USR_UID,
|
||||
'APP_CUR_USER' => $user->USR_UID,
|
||||
]);
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_INDEX' => 1,
|
||||
'USR_UID' => $application[0]->APP_INIT_USER,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'APP_UID' => $application[0]->APP_UID,
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $date->add($diff1Day),
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($user->USR_ID);
|
||||
$draft->setUserUid($user->USR_ID);
|
||||
$res = $draft->getCasesRisk($process->PRO_ID);
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCasesRisk() method with at risk filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_cases_risk_at_risk()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$process = factory(Process::class)->create();
|
||||
$user = factory(User::class)->create();
|
||||
$application = factory(Application::class, 14)->states('draft')->create([
|
||||
'APP_INIT_USER' => $user->USR_UID,
|
||||
'APP_CUR_USER' => $user->USR_UID,
|
||||
]);
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_INDEX' => 1,
|
||||
'USR_UID' => $application[0]->APP_INIT_USER,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'APP_UID' => $application[0]->APP_UID,
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($user->USR_ID);
|
||||
$draft->setUserUid($user->USR_ID);
|
||||
$res = $draft->getCasesRisk($process->PRO_ID, null, null, 'AT_RISK');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCasesRisk() method with overdue filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_cases_risk_overdue()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$process = factory(Process::class)->create();
|
||||
$user = factory(User::class)->create();
|
||||
$application = factory(Application::class, 14)->states('draft')->create([
|
||||
'APP_INIT_USER' => $user->USR_UID,
|
||||
'APP_CUR_USER' => $user->USR_UID,
|
||||
]);
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_INDEX' => 1,
|
||||
'USR_UID' => $application[0]->APP_INIT_USER,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'APP_UID' => $application[0]->APP_UID,
|
||||
'APP_NUMBER' => $application[0]->APP_NUMBER,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->sub($diff2Days)
|
||||
]);
|
||||
$draft = new Draft();
|
||||
$draft->setUserId($user->USR_ID);
|
||||
$draft->setUserUid($user->USR_ID);
|
||||
$res = $draft->getCasesRisk($process->PRO_ID, null, null, 'OVERDUE');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
use DateInterval;
|
||||
use Datetime;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\BusinessModel\Cases\Inbox;
|
||||
@@ -659,4 +661,98 @@ class InboxTest extends TestCase
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCasesRisk() method with on time filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_cases_risk_on_time()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff1Day = new DateInterval('P1D');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process = factory(Process::class)->create();
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_INDEX' => 2,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $date->add($diff1Day),
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$inbox = new Inbox();
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
$inbox->setUserUid($user->USR_UID);
|
||||
$res = $inbox->getCasesRisk($process->PRO_ID);
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCasesRisk() method with at risk filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_cases_risk_at_risk()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process = factory(Process::class)->create();
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_INDEX' => 2,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$inbox = new Inbox();
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
$inbox->setUserUid($user->USR_UID);
|
||||
$res = $inbox->getCasesRisk($process->PRO_ID, null, null, "AT_RISK");
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the getCasesRisk() method with overdue filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_tests_get_cases_risk_overdue()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process = factory(Process::class)->create();
|
||||
factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_INDEX' => 2,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process->PRO_ID,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->sub($diff2Days)
|
||||
]);
|
||||
$inbox = new Inbox();
|
||||
$inbox->setUserId($user->USR_ID);
|
||||
$inbox->setUserUid($user->USR_UID);
|
||||
$res = $inbox->getCasesRisk($process->PRO_ID, null, null, "OVERDUE");
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
use DateInterval;
|
||||
use Datetime;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\BusinessModel\Cases\Paused;
|
||||
@@ -653,4 +655,215 @@ class PausedTest extends TestCase
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(3, $res['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCasesRisk() method with the ontime filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_cases_risk_on_time()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff1Day = new DateInterval('P1D');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process1 = factory(Process::class)->create();
|
||||
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => '',
|
||||
'TAS_GROUP_VARIABLE' => '',
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'TAS_TYPE' => 'NORMAL'
|
||||
]);
|
||||
|
||||
$application1 = factory(Application::class)->create();
|
||||
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'DEL_PREVIOUS' => 0,
|
||||
'DEL_INDEX' => 1,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $date->add($diff1Day),
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$delegation1 = factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'DEL_PREVIOUS' => 1,
|
||||
'DEL_INDEX' => 2,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $date->add($diff1Day),
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
|
||||
factory(AppDelay::class)->create([
|
||||
'APP_DELEGATION_USER' => $user->USR_UID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'APP_NUMBER' => $delegation1->APP_NUMBER,
|
||||
'APP_DEL_INDEX' => $delegation1->DEL_INDEX,
|
||||
'APP_DISABLE_ACTION_USER' => 0,
|
||||
'APP_TYPE' => 'PAUSE'
|
||||
]);
|
||||
$this->createMultiplePaused(3, 2, $user);
|
||||
$paused = new Paused();
|
||||
$paused->setUserId($user->USR_ID);
|
||||
$paused->setUserUid($user->USR_UID);
|
||||
$res = $paused->getCasesRisk($process1->PRO_ID);
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCasesRisk() method with the at risk filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_cases_risk_at_risk()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process1 = factory(Process::class)->create();
|
||||
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => '',
|
||||
'TAS_GROUP_VARIABLE' => '',
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'TAS_TYPE' => 'NORMAL'
|
||||
]);
|
||||
|
||||
$application1 = factory(Application::class)->create();
|
||||
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'DEL_PREVIOUS' => 0,
|
||||
'DEL_INDEX' => 1,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$delegation1 = factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'DEL_PREVIOUS' => 1,
|
||||
'DEL_INDEX' => 2,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
|
||||
factory(AppDelay::class)->create([
|
||||
'APP_DELEGATION_USER' => $user->USR_UID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'APP_NUMBER' => $delegation1->APP_NUMBER,
|
||||
'APP_DEL_INDEX' => $delegation1->DEL_INDEX,
|
||||
'APP_DISABLE_ACTION_USER' => 0,
|
||||
'APP_TYPE' => 'PAUSE'
|
||||
]);
|
||||
$this->createMultiplePaused(3, 2, $user);
|
||||
$paused = new Paused();
|
||||
$paused->setUserId($user->USR_ID);
|
||||
$paused->setUserUid($user->USR_UID);
|
||||
$res = $paused->getCasesRisk($process1->PRO_ID, null, null, 'AT_RISK');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCasesRisk() method with the overdue filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_cases_risk_overdue()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process1 = factory(Process::class)->create();
|
||||
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => '',
|
||||
'TAS_GROUP_VARIABLE' => '',
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'TAS_TYPE' => 'NORMAL'
|
||||
]);
|
||||
|
||||
$application1 = factory(Application::class)->create();
|
||||
|
||||
factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'DEL_PREVIOUS' => 0,
|
||||
'DEL_INDEX' => 1,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->sub($diff2Days)
|
||||
]);
|
||||
$delegation1 = factory(Delegation::class)->create([
|
||||
'APP_UID' => $application1->APP_UID,
|
||||
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'USR_ID' => $user->USR_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'DEL_PREVIOUS' => 1,
|
||||
'DEL_INDEX' => 2,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->sub($diff2Days)
|
||||
]);
|
||||
|
||||
factory(AppDelay::class)->create([
|
||||
'APP_DELEGATION_USER' => $user->USR_UID,
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'APP_NUMBER' => $delegation1->APP_NUMBER,
|
||||
'APP_DEL_INDEX' => $delegation1->DEL_INDEX,
|
||||
'APP_DISABLE_ACTION_USER' => 0,
|
||||
'APP_TYPE' => 'PAUSE'
|
||||
]);
|
||||
$this->createMultiplePaused(3, 2, $user);
|
||||
$paused = new Paused();
|
||||
$paused->setUserId($user->USR_ID);
|
||||
$paused->setUserUid($user->USR_UID);
|
||||
$res = $paused->getCasesRisk($process1->PRO_ID, null, null, 'OVERDUE');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
use DateInterval;
|
||||
use Datetime;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\BusinessModel\Cases\Unassigned;
|
||||
@@ -723,4 +725,149 @@ class UnassignedTest extends TestCase
|
||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||
$this->assertEquals(0, $res['total']);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCasesRisk() method with ontime filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_cases_risk_on_time()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff1Day = new DateInterval('P1D');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process1 = factory(Process::class)->create([
|
||||
'CATEGORY_ID' => 2
|
||||
]);
|
||||
$application = factory(Application::class)->create([
|
||||
'APP_STATUS_ID' => 2
|
||||
]);
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||
'TAS_GROUP_VARIABLE' => '',
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
]);
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $task->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1,
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_ID' => 0,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $date->add($diff1Day),
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($user->USR_ID);
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
|
||||
$res = $unassigned->getCasesRisk($process1->PRO_ID);
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCasesRisk() method with at risk filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_cases_risk_at_risk()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process1 = factory(Process::class)->create([
|
||||
'CATEGORY_ID' => 2
|
||||
]);
|
||||
$application = factory(Application::class)->create([
|
||||
'APP_STATUS_ID' => 2
|
||||
]);
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||
'TAS_GROUP_VARIABLE' => '',
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
]);
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $task->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1,
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_ID' => 0,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($user->USR_ID);
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
|
||||
$res = $unassigned->getCasesRisk($process1->PRO_ID, null, null, 'AT_RISK');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCasesRisk() method with overdue filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getCasesRisk()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_get_cases_risk_overdue()
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
$user = factory(User::class)->create();
|
||||
$process1 = factory(Process::class)->create([
|
||||
'CATEGORY_ID' => 2
|
||||
]);
|
||||
$application = factory(Application::class)->create([
|
||||
'APP_STATUS_ID' => 2
|
||||
]);
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||
'TAS_GROUP_VARIABLE' => '',
|
||||
'PRO_UID' => $process1->PRO_UID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
]);
|
||||
factory(TaskUser::class)->create([
|
||||
'TAS_UID' => $task->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
'TU_RELATION' => 1,
|
||||
'TU_TYPE' => 1
|
||||
]);
|
||||
factory(Delegation::class)->create([
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'TAS_ID' => $task->TAS_ID,
|
||||
'PRO_ID' => $process1->PRO_ID,
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'USR_ID' => 0,
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->sub($diff2Days)
|
||||
]);
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserId($user->USR_ID);
|
||||
$unassigned->setUserUid($user->USR_UID);
|
||||
|
||||
$res = $unassigned->getCasesRisk($process1->PRO_ID, null, null, 'OVERDUE');
|
||||
$this->assertCount(1, $res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,15 +281,17 @@ class CaseListTest extends TestCase
|
||||
*/
|
||||
public function it_should_test_import()
|
||||
{
|
||||
$additionalTables = factory(AdditionalTables::class)->create();
|
||||
$data = [
|
||||
'type' => 'inbox',
|
||||
'name' => 'test1',
|
||||
'description' => 'my description',
|
||||
'tableUid' => '',
|
||||
'tableUid' => $additionalTables->ADD_TAB_UID,
|
||||
'columns' => [],
|
||||
'iconList' => 'deafult.png',
|
||||
'iconColor' => 'red',
|
||||
'iconColorScreen' => 'blue'
|
||||
'iconColorScreen' => 'blue',
|
||||
'tableName' => $additionalTables->ADD_TAB_NAME
|
||||
];
|
||||
$json = json_encode($data);
|
||||
$tempFile = sys_get_temp_dir() . '/test_' . random_int(10000, 99999);
|
||||
@@ -300,7 +302,10 @@ class CaseListTest extends TestCase
|
||||
'error' => 0
|
||||
]
|
||||
];
|
||||
$request_data = [];
|
||||
$request_data = [
|
||||
'invalidFields' => 'continue',
|
||||
'duplicateName' => 'continue'
|
||||
];
|
||||
$ownerId = 1;
|
||||
$result = CaseList::import($request_data, $ownerId);
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\unit\workflow\src\ProcessMaker\Model;
|
||||
|
||||
use DateInterval;
|
||||
use Datetime;
|
||||
use G;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -446,7 +448,16 @@ class DelegationTest extends TestCase
|
||||
*/
|
||||
public function it_return_scope_at_risk()
|
||||
{
|
||||
$table = factory(Delegation::class)->states('closed')->create();
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
|
||||
$table = factory(Delegation::class)->create([
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->add($diff2Days)
|
||||
]);
|
||||
$this->assertCount(1, $table->atRisk($table->DEL_DELEGATE_DATE)->get());
|
||||
}
|
||||
|
||||
@@ -458,7 +469,16 @@ class DelegationTest extends TestCase
|
||||
*/
|
||||
public function it_return_scope_overdue()
|
||||
{
|
||||
$table = factory(Delegation::class)->states('closed')->create();
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$diff2Days = new DateInterval('P2D');
|
||||
|
||||
$table = factory(Delegation::class)->create([
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'DEL_DELEGATE_DATE' => $currentDate,
|
||||
'DEL_RISK_DATE' => $currentDate,
|
||||
'DEL_TASK_DUE_DATE' => $date->sub($diff2Days)
|
||||
]);
|
||||
$this->assertCount(1, $table->overdue($table->DEL_DELEGATE_DATE)->get());
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class StepTriggerMapBuilder
|
||||
|
||||
$tMap->addPrimaryKey('ST_TYPE', 'StType', 'string', CreoleTypes::VARCHAR, true, 20);
|
||||
|
||||
$tMap->addColumn('ST_CONDITION', 'StCondition', 'string', CreoleTypes::VARCHAR, true, 255);
|
||||
$tMap->addColumn('ST_CONDITION', 'StCondition', 'string', CreoleTypes::LONGVARCHAR, true, null);
|
||||
|
||||
$tMap->addColumn('ST_POSITION', 'StPosition', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ abstract class BaseBpmnActivity extends BaseObject implements Persistent
|
||||
* The value for the act_loop_type field.
|
||||
* @var string
|
||||
*/
|
||||
protected $act_loop_type = 'NONE';
|
||||
protected $act_loop_type = 'EMPTY';
|
||||
|
||||
/**
|
||||
* The value for the act_test_before field.
|
||||
@@ -870,7 +870,7 @@ abstract class BaseBpmnActivity extends BaseObject implements Persistent
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->act_loop_type !== $v || $v === 'NONE') {
|
||||
if ($this->act_loop_type !== $v || $v === 'EMPTY') {
|
||||
$this->act_loop_type = $v;
|
||||
$this->modifiedColumns[] = BpmnActivityPeer::ACT_LOOP_TYPE;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ abstract class BaseStepTrigger extends BaseObject implements Persistent
|
||||
* The value for the st_condition field.
|
||||
* @var string
|
||||
*/
|
||||
protected $st_condition = '';
|
||||
protected $st_condition;
|
||||
|
||||
/**
|
||||
* The value for the st_position field.
|
||||
@@ -246,7 +246,7 @@ abstract class BaseStepTrigger extends BaseObject implements Persistent
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->st_condition !== $v || $v === '') {
|
||||
if ($this->st_condition !== $v) {
|
||||
$this->st_condition = $v;
|
||||
$this->modifiedColumns[] = StepTriggerPeer::ST_CONDITION;
|
||||
}
|
||||
|
||||
@@ -1385,7 +1385,7 @@
|
||||
<column name="TAS_UID" type="VARCHAR" size="32" required="true" primaryKey="true" default=""/>
|
||||
<column name="TRI_UID" type="VARCHAR" size="32" required="true" primaryKey="true" default=""/>
|
||||
<column name="ST_TYPE" type="VARCHAR" size="20" required="true" primaryKey="true" default=""/>
|
||||
<column name="ST_CONDITION" type="VARCHAR" size="255" required="true" default=""/>
|
||||
<column name="ST_CONDITION" type="LONGVARCHAR" required="true"/>
|
||||
<column name="ST_POSITION" type="INTEGER" required="true" default="0"/>
|
||||
<validator column="ST_TYPE">
|
||||
<rule name="validValues" value="BEFORE|AFTER"
|
||||
@@ -3815,7 +3815,7 @@
|
||||
<column name="ACT_INSTANTIATE" type="TINYINT" required="false" default="0"/>
|
||||
<column name="ACT_SCRIPT_TYPE" type="VARCHAR" size="255" required="false"/>
|
||||
<column name="ACT_SCRIPT" type="LONGVARCHAR" required="false"/>
|
||||
<column name="ACT_LOOP_TYPE" type="VARCHAR" size="20" required="true" default="NONE"/>
|
||||
<column name="ACT_LOOP_TYPE" type="VARCHAR" size="20" required="true" default="EMPTY"/>
|
||||
<column name="ACT_TEST_BEFORE" type="TINYINT" required="false" default="0"/>
|
||||
<column name="ACT_LOOP_MAXIMUM" type="INTEGER" required="false" default="0"/>
|
||||
<column name="ACT_LOOP_CONDITION" type="VARCHAR" size="100" required="false"/>
|
||||
|
||||
@@ -1693,6 +1693,18 @@ msgstr "You can open only files with the .html extension"
|
||||
msgid "3 days at least"
|
||||
msgstr "3 days at least"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_A_RANGE_OF_VALUES
|
||||
#: LABEL/ID_A_RANGE_OF_VALUES
|
||||
msgid "a range of values"
|
||||
msgstr "a range of values"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_A_TEXT_SEARCH
|
||||
#: LABEL/ID_A_TEXT_SEARCH
|
||||
msgid "a Text Search"
|
||||
msgstr "a Text Search"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_ABE_ANSWER_SUBMITTED
|
||||
#: LABEL/ID_ABE_ANSWER_SUBMITTED
|
||||
@@ -3515,6 +3527,12 @@ msgstr "No actions available for this case."
|
||||
msgid "Case Demo"
|
||||
msgstr "Case Demo"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_CASELIST_CAN_NOT_BE_IMPORTED_THE_PMTABLE_NOT_EXIST
|
||||
#: LABEL/ID_CASELIST_CAN_NOT_BE_IMPORTED_THE_PMTABLE_NOT_EXIST
|
||||
msgid "Custom Case List {0} can not be imported because the PM Table does not exist in this Workspace."
|
||||
msgstr "Custom Case List {0} can not be imported because the PM Table does not exist in this Workspace."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_CASE_DELETE_SUCCESFULLY
|
||||
#: LABEL/ID_CASE_DELETE_SUCCESFULLY
|
||||
@@ -5819,6 +5837,12 @@ msgstr "The value '{0}' is not a valid date for the format '{1}'."
|
||||
msgid "Date Created"
|
||||
msgstr "Date Created"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_DATE_TO_DATE
|
||||
#: LABEL/ID_DATE_TO_DATE
|
||||
msgid "Date to Date"
|
||||
msgstr "Date to Date"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_DAY
|
||||
#: LABEL/ID_DAY
|
||||
@@ -10043,6 +10067,12 @@ msgstr "Group already exists. You need set an action to continue. Available acti
|
||||
msgid "Project already exists. Set an action to continue. Available actions: [{0}]."
|
||||
msgstr "Project already exists. Set an action to continue. Available actions: [{0}]."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_IMPORTING_CASELIST_WITH_THE_SAME_NAME_SELECT_OPTION
|
||||
#: LABEL/ID_IMPORTING_CASELIST_WITH_THE_SAME_NAME_SELECT_OPTION
|
||||
msgid "You are about importing a Case List with the same name {0}, please select an option."
|
||||
msgstr "You are about importing a Case List with the same name {0}, please select an option."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_IMPORTING_ERROR
|
||||
#: LABEL/ID_IMPORTING_ERROR
|
||||
@@ -20315,6 +20345,12 @@ msgstr "License installed successfully"
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_NO_SEARCHING_METHOD
|
||||
#: LABEL/ID_NO_SEARCHING_METHOD
|
||||
msgid "No searching method"
|
||||
msgstr "No searching method"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_NODELETEOPTIONALL
|
||||
#: LABEL/ID_NODELETEOPTIONALL
|
||||
@@ -21929,6 +21965,12 @@ msgstr "The PM Table associated with this DynaForm could not be found."
|
||||
msgid "The data from this case was saved in the database, but it was not saved in the PM Table, which it couldn't be found."
|
||||
msgstr "The data from this case was saved in the database, but it was not saved in the PM Table, which it couldn't be found."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_PMTABLE_NOT_HAVE_ALL_CASELIST_FIELDS_WOULD_YOU_LIKE_CONTINUE
|
||||
#: LABEL/ID_PMTABLE_NOT_HAVE_ALL_CASELIST_FIELDS_WOULD_YOU_LIKE_CONTINUE
|
||||
msgid "The PM Table {0} does not have all the Custom Case List fields for file {1}. Would you like continue?"
|
||||
msgstr "The PM Table {0} does not have all the Custom Case List fields for file {1}. Would you like continue?"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_PMTABLE_NOT_IMPORT_HAS_ERRORS
|
||||
#: LABEL/ID_PMTABLE_NOT_IMPORT_HAS_ERRORS
|
||||
@@ -26309,6 +26351,12 @@ msgstr "Please complete the reassign reason."
|
||||
msgid "The report table is regenerating please come back in a few minutes."
|
||||
msgstr "The report table is regenerating please come back in a few minutes."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_THE_SEARCH_WILL_BE_FROM
|
||||
#: LABEL/ID_THE_SEARCH_WILL_BE_FROM
|
||||
msgid "The search will be from"
|
||||
msgstr "The search will be from"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED
|
||||
#: LABEL/ID_THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED
|
||||
|
||||
@@ -57082,6 +57082,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ESTABLISHING_CON_HOST','en','Establishing connection to host','2014-01-15') ,
|
||||
( 'LABEL','HTML_FILES','en','You can open only files with the .html extension','2014-01-15') ,
|
||||
( 'LABEL','ID_3DAYSMINIMUM','en','3 days at least','2014-01-15') ,
|
||||
( 'LABEL','ID_A_RANGE_OF_VALUES','en','a range of values','2021-08-16') ,
|
||||
( 'LABEL','ID_A_TEXT_SEARCH','en','a Text Search','2021-08-16') ,
|
||||
( 'LABEL','ID_ABE_ANSWER_SUBMITTED','en','The answer has been submitted. Thank you.','2017-06-19') ,
|
||||
( 'LABEL','ID_ABE_CASE_NOTE_ANSWER','en','Answer: {optionLabel}','2018-11-20') ,
|
||||
( 'LABEL','ID_ABE_CASE_NOTE_COMMENT','en','Comment: {emailBody}','2018-11-20') ,
|
||||
@@ -57392,6 +57394,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_CASE','en','Case','2014-01-15') ,
|
||||
( 'LABEL','ID_CASECANCEL','en','No actions available for this case.','2014-01-15') ,
|
||||
( 'LABEL','ID_CASEDEMO','en','Case Demo','2014-01-15') ,
|
||||
( 'LABEL','ID_CASELIST_CAN_NOT_BE_IMPORTED_THE_PMTABLE_NOT_EXIST','en','Custom Case List {0} can not be imported because the PM Table does not exist in this Workspace.','2021-08-20') ,
|
||||
( 'LABEL','ID_CASE_DELETE_SUCCESFULLY','en','The Case was deleted successfully.','2020-01-08') ,
|
||||
( 'LABEL','ID_CASE_UID','en','Case Uid','2021-04-04') ,
|
||||
( 'LABEL','ID_CASES','en','HOME','2014-01-15') ,
|
||||
@@ -57793,6 +57796,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_DATE_LABEL','en','Date','2014-01-15') ,
|
||||
( 'LABEL','ID_DATE_NOT_VALID','en','The value ''{0}'' is not a valid date for the format ''{1}''.','2014-05-29') ,
|
||||
( 'LABEL','ID_DATE_UPDATED','en','Date Updated','2021-07-26') ,
|
||||
( 'LABEL','ID_DATE_TO_DATE','en','Date to Date','2021-07-26') ,
|
||||
( 'LABEL','ID_DAY','en','Day','2014-01-15') ,
|
||||
( 'LABEL','ID_DAYS','en','Days','2014-01-15') ,
|
||||
( 'LABEL','ID_DAY_DAYS','en','Day(s)','2020-10-02') ,
|
||||
@@ -58523,6 +58527,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_IMPORTER_FILE_PROCESSMAKER_PROJECT_VERSION_IS_MISSING','en','ProcessMaker Project version is missing on file source.','2014-05-20') ,
|
||||
( 'LABEL','ID_IMPORTER_GROUP_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE','en','Group already exists. You need set an action to continue. Available actions: [{0}].','2014-10-21') ,
|
||||
( 'LABEL','ID_IMPORTER_PROJECT_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE','en','Project already exists. Set an action to continue. Available actions: [{0}].','2014-10-21') ,
|
||||
( 'LABEL','ID_IMPORTING_CASELIST_WITH_THE_SAME_NAME_SELECT_OPTION','en','You are about importing a Case List with the same name {0}, please select an option.','2021-08-20') ,
|
||||
( 'LABEL','ID_IMPORTING_ERROR','en','Importing Error','2014-01-15') ,
|
||||
( 'LABEL','ID_IMPORTING_USERS','en','Importing Users...','2015-09-15') ,
|
||||
( 'LABEL','ID_IMPORT_ALREADY_EXISTS','en','The process you are trying to import already exists. Please select one of the following options to continue:','2014-10-21') ,
|
||||
@@ -60276,6 +60281,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_NEXT_TASK','en','Next Task/Event','2016-07-29') ,
|
||||
( 'LABEL','ID_NLIC','en','License installed successfully','2014-12-02') ,
|
||||
( 'LABEL','ID_NO','en','No','2014-01-15') ,
|
||||
( 'LABEL','ID_NO_SEARCHING_METHOD','en','No searching method','2021-08-16') ,
|
||||
( 'LABEL','ID_NODELETEOPTIONALL','en','You must add all the days that you have selected in work days, otherwise you should leave at least an "-- ALL --" option.','2014-01-15') ,
|
||||
( 'LABEL','ID_NONE','en','None','2014-01-15') ,
|
||||
( 'LABEL','ID_NONEC','en','@# Replace the value with no change','2014-01-15') ,
|
||||
@@ -60553,6 +60559,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_PMTABLE_INVALID_NAME','en','Could not create the table with the name "{0}" because it is a reserved word.','2014-01-15') ,
|
||||
( 'LABEL','ID_PMTABLE_NOT_FOUND','en','The PM Table associated with this DynaForm could not be found.','2014-11-12') ,
|
||||
( 'LABEL','ID_PMTABLE_NOT_FOUNDED_SAVED_DATA','en','The data from this case was saved in the database, but it was not saved in the PM Table, which it couldn''t be found.','2014-11-12') ,
|
||||
( 'LABEL','ID_PMTABLE_NOT_HAVE_ALL_CASELIST_FIELDS_WOULD_YOU_LIKE_CONTINUE','en','The PM Table {0} does not have all the Custom Case List fields for file {1}. Would you like continue?','2014-11-12') ,
|
||||
( 'LABEL','ID_PMTABLE_NOT_IMPORT_HAS_ERRORS','en','File "{0}" was not imported has errors:','2016-02-18') ,
|
||||
( 'LABEL','ID_PMTABLE_PRIMARY_KEY_FIELD_IS_MISSING_IN_ATTRIBUTE','en','The primary key field {0} of the PM Table is missing in the attribute {1}.','2014-05-20') ,
|
||||
( 'LABEL','ID_PMTABLE_REQUIRED','en','It is required to select a PM table','2014-10-27') ,
|
||||
@@ -61340,6 +61347,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_THE_PHP_FILES_EXECUTION_WAS_DISABLED','en','The PHP files execution was disabled please contact the system administrator.','2018-04-20') ,
|
||||
( 'LABEL','ID_THE_REASON_REASSIGN_USER_EMPTY','en','Please complete the reassign reason.','2016-10-20') ,
|
||||
( 'LABEL','ID_THE_REPORT_TABLE_IS_REGENERATING_PLEASE_COME_BACK_IN_A_FEW_MINUTES','en','The report table is regenerating please come back in a few minutes.','2020-06-01') ,
|
||||
( 'LABEL','ID_THE_SEARCH_WILL_BE_FROM','en','The search will be from','2021-08-16') ,
|
||||
( 'LABEL','ID_THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED','en','The upload of PHP files was disabled please contact the system administrator.','2018-04-20') ,
|
||||
( 'LABEL','ID_THE_USER_ROLES_FOR_ATTRIBUTE_HAS_BEEN_DELETED_PLEASE_CONFIRM','en','The user roles for attribute {0} has been modified, if you proceed to save this attribute, all information for users stored in the attribute will be deleted for the removed role, please confirm.','2020-12-15') ,
|
||||
( 'LABEL','ID_THE_USERNAME_EMAIL_IS_INCORRECT','en','The username or email is incorrect','2018-01-18') ,
|
||||
|
||||
@@ -650,7 +650,7 @@ CREATE TABLE `STEP_TRIGGER`
|
||||
`TAS_UID` VARCHAR(32) default '' NOT NULL,
|
||||
`TRI_UID` VARCHAR(32) default '' NOT NULL,
|
||||
`ST_TYPE` VARCHAR(20) default '' NOT NULL,
|
||||
`ST_CONDITION` VARCHAR(255) default '' NOT NULL,
|
||||
`ST_CONDITION` MEDIUMTEXT NOT NULL,
|
||||
`ST_POSITION` INTEGER default 0 NOT NULL,
|
||||
PRIMARY KEY (`STEP_UID`,`TAS_UID`,`TRI_UID`,`ST_TYPE`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
|
||||
@@ -1918,7 +1918,7 @@ CREATE TABLE `BPMN_ACTIVITY`
|
||||
`ACT_INSTANTIATE` TINYINT default 0,
|
||||
`ACT_SCRIPT_TYPE` VARCHAR(255),
|
||||
`ACT_SCRIPT` MEDIUMTEXT,
|
||||
`ACT_LOOP_TYPE` VARCHAR(20) default 'NONE' NOT NULL,
|
||||
`ACT_LOOP_TYPE` VARCHAR(20) default 'EMPTY' NOT NULL,
|
||||
`ACT_TEST_BEFORE` TINYINT default 0,
|
||||
`ACT_LOOP_MAXIMUM` INTEGER default 0,
|
||||
`ACT_LOOP_CONDITION` VARCHAR(100),
|
||||
|
||||
@@ -1,27 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\BusinessModel\Cases\CasesList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
|
||||
// Get the self service query for the current user
|
||||
$query = Delegation::getSelfServiceQuery($_SESSION['USER_LOGGED']);
|
||||
|
||||
// Mutate query and execute
|
||||
if (!is_string($query)) {
|
||||
$query->limit(1);
|
||||
$items = $query->get();
|
||||
$atLeastOne = $items->count() > 0;
|
||||
} else {
|
||||
$query .= " LIMIT 1";
|
||||
$items = DB::select($query);
|
||||
$atLeastOne = !empty($items);
|
||||
}
|
||||
|
||||
// Initializing the response variable
|
||||
// Get the user logged
|
||||
$usrUid = $_SESSION['USER_LOGGED'];
|
||||
// Instance the class
|
||||
$casesList = new CasesList();
|
||||
$response = [];
|
||||
|
||||
// The scope for the first version of this feature is only for unassigned list, so, this value is currently fixed
|
||||
$response[] = ['item' => 'CASES_SELFSERVICE', 'highlight' => $atLeastOne];
|
||||
// Get highlight for all task list
|
||||
$response = $casesList->atLeastOne($usrUid);
|
||||
|
||||
// Print the response in JSON format
|
||||
header('Content-Type: application/json');
|
||||
|
||||
@@ -882,7 +882,7 @@ class Cases
|
||||
public function participation($usrUid, $caseNumber, $index)
|
||||
{
|
||||
$userId = User::getId($usrUid);
|
||||
$query = Delegation::query()->select(['APP_NUMBER'])->case($caseNumber)->index($index)->threadOpen();
|
||||
$query = Delegation::query()->select(['APP_NUMBER'])->case($caseNumber)->index($index)->openAndPause();
|
||||
$query1 = clone $query;
|
||||
$result = $query->userId($userId)->limit(1)->get()->values()->toArray();
|
||||
$permission = empty($result) ? false : true;
|
||||
@@ -1050,7 +1050,8 @@ class Cases
|
||||
}
|
||||
|
||||
// Check if the case is unassigned
|
||||
if ($this->isUnassignedPauseCase($appUid, $index)) {
|
||||
$classCases = new ClassesCases();
|
||||
if ($classCases->isUnassignedPauseCase($appUid, $index)) {
|
||||
throw new Exception(G::LoadTranslation("ID_CASE_NOT_PAUSED", [G::LoadTranslation("ID_UNASSIGNED_STATUS")]));
|
||||
}
|
||||
|
||||
|
||||
@@ -1480,6 +1480,16 @@ class AbstractCases implements CasesInterface
|
||||
throw new Exception("Method '" . __FUNCTION__ . "' should be implemented in the extended class '" . get_class($this) . "'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get true if the user has at least one case
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
throw new Exception("Method '" . __FUNCTION__ . "' should be implemented in the extended class '" . get_class($this) . "'.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list counter
|
||||
*
|
||||
@@ -1583,4 +1593,78 @@ class AbstractCases implements CasesInterface
|
||||
}
|
||||
return $query->get()->values()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cases risk by process
|
||||
*
|
||||
* @param int $processId
|
||||
* @param string $dateFrom
|
||||
* @param string $dateTo
|
||||
* @param string $riskStatus
|
||||
* @param int $topCases
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCasesRisk($processId, $dateFrom = null, $dateTo = null, $riskStatus = 'ON_TIME', $topCases = null)
|
||||
{
|
||||
$date = new DateTime('now');
|
||||
$currentDate = $date->format('Y-m-d H:i:s');
|
||||
$query = Delegation::selectRaw('
|
||||
APP_DELEGATION.APP_NUMBER as number_case,
|
||||
APP_DELEGATION.DEL_DELEGATE_DATE as delegated,
|
||||
APP_DELEGATION.DEL_RISK_DATE as at_risk,
|
||||
APP_DELEGATION.DEL_TASK_DUE_DATE as due_date,
|
||||
APP_DELEGATION.APP_UID as app_uid,
|
||||
APP_DELEGATION.DEL_INDEX as del_index,
|
||||
APP_DELEGATION.TAS_UID as tas_uid
|
||||
');
|
||||
$listArray = explode("\\", get_class($this));
|
||||
$list = end($listArray);
|
||||
switch ($list) {
|
||||
case 'Inbox':
|
||||
$query->inbox($this->getUserId());
|
||||
break;
|
||||
case 'Draft':
|
||||
$query->draft($this->getUserId());
|
||||
break;
|
||||
case 'Paused':
|
||||
$query->paused($this->getUserId());
|
||||
break;
|
||||
case 'Unassigned':
|
||||
$query->selfService($this->getUserUid());
|
||||
break;
|
||||
}
|
||||
$query->joinProcess();
|
||||
$query->processInList([$processId]);
|
||||
|
||||
if (!is_null($dateFrom)) {
|
||||
$query->where('APP_DELEGATION.DEL_DELEGATE_DATE', '>=', $dateFrom);
|
||||
}
|
||||
if (!is_null($dateTo)) {
|
||||
$query->where('APP_DELEGATION.DEL_DELEGATE_DATE', '<=', $dateTo);
|
||||
}
|
||||
if (!is_null($topCases)) {
|
||||
$query->orderBy('APP_DELEGATION.DEL_DELEGATE_DATE', 'ASC')->limit($topCases);
|
||||
}
|
||||
$value = 'due_date';
|
||||
switch ($riskStatus) {
|
||||
case 'ON_TIME':
|
||||
$query->onTime($currentDate);
|
||||
$value = 'at_risk';
|
||||
break;
|
||||
case 'AT_RISK':
|
||||
$query->atRisk($currentDate);
|
||||
break;
|
||||
case 'OVERDUE':
|
||||
$query->overdue($currentDate);
|
||||
break;
|
||||
}
|
||||
$res = $query->get()->values()->toArray();
|
||||
foreach ($res as $key => $values) {
|
||||
$riskDate = new DateTime($values[$value]);
|
||||
$days = ['days' => $date->diff($riskDate)->days];
|
||||
$res[$key] = $days + $res[$key];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,15 @@ class BatchRouting extends AbstractCases
|
||||
// Return the number of rows
|
||||
return $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
// This class does not require this value
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -61,4 +61,15 @@ class Canceled extends AbstractCases
|
||||
// Return the number of rows
|
||||
return $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
// This class does not require this value
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class CasesList
|
||||
'inbox' => 'CASES_INBOX',
|
||||
'participated' => 'CASES_SENT',
|
||||
'paused' => 'CASES_PAUSED',
|
||||
'unassigned' => 'CASES_SELFSERVICE',
|
||||
];
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
@@ -83,4 +84,28 @@ class CasesList
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @param string $usrUid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function atLeastOne(string $usrUid)
|
||||
{
|
||||
// Get the usrId key
|
||||
$usrId = User::getId($usrUid);
|
||||
// Get the classes
|
||||
$list = $this->mapList;
|
||||
$response = [];
|
||||
foreach ($list as $listObject => $item) {
|
||||
$this->$listObject->setUserUid($usrUid);
|
||||
$this->$listObject->setUserId($usrId);
|
||||
$atLeastOne = $this->$listObject->atLeastOne($usrUid);
|
||||
$response[] = ['item' => $item, 'highlight' => $atLeastOne];
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,18 @@ class Completed extends AbstractCases
|
||||
$participated->setParticipatedStatus('COMPLETED');
|
||||
$participated->setUserUid($this->getUserUid());
|
||||
$participated->setUserId($this->getUserId());
|
||||
$count = $participated->getCounter();
|
||||
|
||||
return $count;
|
||||
return $participated->getCounter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
// This class does not require this value
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,24 @@ class Draft extends AbstractCases
|
||||
return $query->count(['APPLICATION.APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
$query = Application::query()->select(['APPLICATION.APP_NUMBER']);
|
||||
// Add the initial scope for draft cases for specific user
|
||||
$query->draft($this->getUserUid());
|
||||
// Get only one case
|
||||
$query->limit(1);
|
||||
// Get result
|
||||
$items = $query->get();
|
||||
|
||||
return $items->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count how many cases the user has in DRAFT, needs to apply filters
|
||||
*
|
||||
|
||||
@@ -165,6 +165,24 @@ class Inbox extends AbstractCases
|
||||
return $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
$query = Delegation::query()->select(['APP_DELEGATION.APP_NUMBER']);
|
||||
// Scope that sets the queries for List Inbox for specific user
|
||||
$query->inbox($this->getUserId());
|
||||
// Get only one case
|
||||
$query->limit(1);
|
||||
// Get the result
|
||||
$items = $query->get();
|
||||
|
||||
return $items->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count how many cases the user has in TO_DO, needs to apply filters
|
||||
*
|
||||
|
||||
@@ -266,6 +266,17 @@ class Participated extends AbstractCases
|
||||
return $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
// This class does not require this value
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count how many cases the user has Participation, needs to apply filters
|
||||
*
|
||||
|
||||
@@ -159,6 +159,24 @@ class Paused extends AbstractCases
|
||||
return $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
$query = Delegation::query()->select(['APP_DELEGATION.APP_NUMBER']);
|
||||
// Scope that set the paused cases
|
||||
$query->paused($this->getUserId());
|
||||
// Get only one case
|
||||
$query->limit(1);
|
||||
// Get result
|
||||
$items = $query->get();
|
||||
|
||||
return $items->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count how many cases the user has in PAUSED, needs to apply filters
|
||||
*
|
||||
|
||||
@@ -172,7 +172,7 @@ class Search extends AbstractCases
|
||||
switch ($status) {
|
||||
case 'DRAFT':
|
||||
case 'TO_DO':
|
||||
$taskPending = Delegation::getPendingThreads($item['APP_NUMBER']);
|
||||
$taskPending = Delegation::getPendingThreads($item['APP_NUMBER'], false);
|
||||
break;
|
||||
case 'COMPLETED':
|
||||
case 'CANCELLED':
|
||||
@@ -215,6 +215,17 @@ class Search extends AbstractCases
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
// This class does not require this value
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of rows corresponding to the advanced search, needs to apply filters
|
||||
*
|
||||
|
||||
@@ -203,6 +203,17 @@ class Supervising extends AbstractCases
|
||||
return $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
// This class does not require this value
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count how many cases the user has in Supervising, needs to apply filters
|
||||
*
|
||||
|
||||
@@ -167,6 +167,24 @@ class Unassigned extends AbstractCases
|
||||
return $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count if the user has at least one case in the list
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function atLeastOne()
|
||||
{
|
||||
$query = Delegation::query()->select(['APP_DELEGATION.APP_NUMBER']);
|
||||
// Add the initial scope for self-service cases
|
||||
$query->selfService($this->getUserUid());
|
||||
// Get only one case
|
||||
$query->limit(1);
|
||||
// Get result
|
||||
$items = $query->get();
|
||||
|
||||
return $items->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count how many cases the user has in SELF_SERVICE, needs to apply filters
|
||||
*
|
||||
|
||||
@@ -355,6 +355,24 @@ class Application extends Model
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope the Draft cases
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $user
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeDraft($query, $user)
|
||||
{
|
||||
// Filter the status draft
|
||||
$query->statusId(Application::STATUS_DRAFT);
|
||||
// Filter the creator
|
||||
$query->creator($user);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Applications by PRO_UID, ordered by APP_NUMBER.
|
||||
*
|
||||
|
||||
@@ -7,6 +7,7 @@ use G;
|
||||
use ProcessMaker\BusinessModel\Table;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\AdditionalTables;
|
||||
use ProcessMaker\Model\Fields;
|
||||
use ProcessMaker\Model\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
@@ -246,7 +247,8 @@ class CaseList extends Model
|
||||
->leftJoin('USERS', 'USERS.USR_ID', '=', 'CASE_LIST.USR_ID')
|
||||
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
|
||||
->select([
|
||||
'CASE_LIST.*'
|
||||
'CASE_LIST.*',
|
||||
'ADDITIONAL_TABLES.ADD_TAB_NAME'
|
||||
])
|
||||
->get()
|
||||
->first();
|
||||
@@ -256,6 +258,7 @@ class CaseList extends Model
|
||||
|
||||
$result = CaseList::getAliasFromColumnName($model->toArray());
|
||||
$result['columns'] = json_decode($result['columns']);
|
||||
$result['tableName'] = $model->ADD_TAB_NAME;
|
||||
|
||||
//clean invalid items
|
||||
unset($result['id']);
|
||||
@@ -275,21 +278,77 @@ class CaseList extends Model
|
||||
|
||||
/**
|
||||
* The import requires a $ _FILES content in json format to create a record.
|
||||
* @param array $request_data
|
||||
* @param array $requestData
|
||||
* @param int $ownerId
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function import(array $request_data, int $ownerId)
|
||||
public static function import(array $requestData, int $ownerId)
|
||||
{
|
||||
if ($_FILES['file_content']['error'] !== UPLOAD_ERR_OK ||
|
||||
$_FILES['file_content']['tmp_name'] === '') {
|
||||
throw new Exception(G::LoadTranslation('ID_ERROR_UPLOADING_FILENAME'));
|
||||
throw new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR'));
|
||||
}
|
||||
$content = file_get_contents($_FILES['file_content']['tmp_name']);
|
||||
try {
|
||||
$array = json_decode($content, true);
|
||||
$caseList = CaseList::createSetting($array, $ownerId);
|
||||
|
||||
$tableName = $array['tableName'];
|
||||
unset($array['tableName']);
|
||||
|
||||
//the pmtable not exist
|
||||
$table = AdditionalTables::where('ADD_TAB_NAME', '=', $tableName)
|
||||
->get()
|
||||
->first();
|
||||
if ($table === null) {
|
||||
return [
|
||||
'status' => 'tableNotExist',
|
||||
'message' => G::LoadTranslation('ID_CASELIST_CAN_NOT_BE_IMPORTED_THE_PMTABLE_NOT_EXIST', [$_FILES['file_content']['name']])
|
||||
];
|
||||
}
|
||||
$array['tableUid'] = $table->ADD_TAB_UID;
|
||||
|
||||
//the fields have differences between the import file and the current table
|
||||
$requestData['invalidFields'] = $requestData['invalidFields'] ?? '';
|
||||
if ($requestData['invalidFields'] !== 'continue') {
|
||||
$fields = Fields::where('ADD_TAB_UID', '=', $array['tableUid'])
|
||||
->whereNotIn('FLD_NAME', self::$excludeColumns)
|
||||
->select('FLD_NAME')
|
||||
->get()
|
||||
->transform(function ($object) {
|
||||
return $object->FLD_NAME;
|
||||
})
|
||||
->toArray();
|
||||
foreach ($array['columns'] as $value) {
|
||||
if (!in_array($value['field'], $fields)) {
|
||||
return [
|
||||
'status' => 'invalidFields',
|
||||
'message' => G::LoadTranslation('ID_PMTABLE_NOT_HAVE_ALL_CASELIST_FIELDS_WOULD_YOU_LIKE_CONTINUE', [$tableName, $_FILES['file_content']['name']])
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//the name of the case list already exist
|
||||
$list = CaseList::where('CAL_NAME', '=', $array['name'])
|
||||
->get()
|
||||
->first();
|
||||
$requestData['duplicateName'] = $requestData['duplicateName'] ?? '';
|
||||
if ($requestData['duplicateName'] !== 'continue') {
|
||||
if ($list !== null) {
|
||||
return [
|
||||
'status' => 'duplicateName',
|
||||
'message' => G::LoadTranslation('ID_IMPORTING_CASELIST_WITH_THE_SAME_NAME_SELECT_OPTION', [$array['name']])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($requestData['duplicateName'] === 'continue' && $list !== null) {
|
||||
$caseList = CaseList::updateSetting($list->CAL_ID, $array, $ownerId);
|
||||
} else {
|
||||
$caseList = CaseList::createSetting($array, $ownerId);
|
||||
}
|
||||
|
||||
$result = CaseList::getAliasFromColumnName($caseList->toArray());
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -388,7 +388,7 @@ class Delegation extends Model
|
||||
*/
|
||||
public function scopeAtRisk($query, $now)
|
||||
{
|
||||
return $query->where('DEL_RISK_DATE', '>=', $now)->where('DEL_TASK_DUE_DATE', '>=', $now);
|
||||
return $query->where('DEL_RISK_DATE', '<=', $now)->where('DEL_TASK_DUE_DATE', '>=', $now);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,7 +401,7 @@ class Delegation extends Model
|
||||
*/
|
||||
public function scopeOverdue($query, $now)
|
||||
{
|
||||
return $query->where('DEL_TASK_DUE_DATE', '>', $now);
|
||||
return $query->where('DEL_TASK_DUE_DATE', '<', $now);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1989,8 +1989,8 @@ class Delegation extends Model
|
||||
]);
|
||||
// Join with task
|
||||
$query->joinTask();
|
||||
// Get the open threads
|
||||
$query->threadOpen();
|
||||
// Get the open and paused threads
|
||||
$query->openAndPause();
|
||||
// Related to the specific case number
|
||||
$query->case($appNumber);
|
||||
// Get the results
|
||||
|
||||
@@ -34,10 +34,14 @@ class UserConfig extends Model
|
||||
if (empty($userConfig)) {
|
||||
return null;
|
||||
}
|
||||
$setting = json_decode($userConfig->USC_SETTING);
|
||||
if (empty($setting)) {
|
||||
$setting = new stdClass();
|
||||
}
|
||||
return [
|
||||
"id" => $userConfig->USR_ID,
|
||||
"name" => $userConfig->USC_NAME,
|
||||
"setting" => json_decode($userConfig->USC_SETTING)
|
||||
"setting" => $setting
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1316,7 +1316,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$diagramData = array_change_key_case($projectData["diagrams"][0], CASE_UPPER);
|
||||
|
||||
if ($generateUid) {
|
||||
$result[1]["old_uid"] = $diagramData["DIA_UID"];
|
||||
$result[1]["old_uid"] = isset($diagramData["DIA_UID"]) ? $diagramData["DIA_UID"] : '';
|
||||
$diagramData["DIA_UID"] = Util\Common::generateUID();
|
||||
$result[1]["new_uid"] = $diagramData["DIA_UID"];
|
||||
$result[1]["object"] = "diagram";
|
||||
@@ -1408,13 +1408,15 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
try {
|
||||
unset($arrayObjectData["BOU_UID"]);
|
||||
|
||||
if ($arrayObjectData["BOU_CONTAINER"] == "bpmnPool" ||
|
||||
if (isset($arrayObjectData["BOU_CONTAINER"])) {
|
||||
if ($arrayObjectData["BOU_CONTAINER"] == "bpmnPool" ||
|
||||
$arrayObjectData["BOU_CONTAINER"] == "bpmnLane" ||
|
||||
$arrayObjectData["BOU_CONTAINER"] == "bpmnActivity"
|
||||
) {
|
||||
foreach ($arrayUid as $value) {
|
||||
if ($arrayObjectData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$arrayObjectData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
) {
|
||||
foreach ($arrayUid as $value) {
|
||||
if ($arrayObjectData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$arrayObjectData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1615,13 +1617,13 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
unset($activityData["_EXTENDED"], $activityData["BOU_ELEMENT_ID"]);
|
||||
$activityData = Util\ArrayUtil::boolToIntValues($activityData);
|
||||
|
||||
$activity = $bwp->getActivity($activityData["ACT_UID"]);
|
||||
$activity = $bwp->getActivity(isset($activityData["ACT_UID"]) ? $activityData["ACT_UID"] : '');
|
||||
if ($forceInsert || is_null($activity)) {
|
||||
if ($generateUid) {
|
||||
//Generate and update UID
|
||||
$activityData = $bwp->updateBoundByArrayUid($activityData, $result);
|
||||
|
||||
$uidOld = $activityData["ACT_UID"];
|
||||
$uidOld = isset($activityData["ACT_UID"]) ? $activityData["ACT_UID"] : '';
|
||||
$activityData["ACT_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
|
||||
@@ -6,6 +6,7 @@ use Exception;
|
||||
use G;
|
||||
use Luracast\Restler\RestException;
|
||||
use Menu;
|
||||
use ProcessMaker\BusinessModel\Cases\CasesList;
|
||||
use ProcessMaker\BusinessModel\Cases\Draft;
|
||||
use ProcessMaker\BusinessModel\Cases\Filter;
|
||||
use ProcessMaker\BusinessModel\Cases\Inbox;
|
||||
@@ -574,6 +575,7 @@ class Home extends Api
|
||||
$option->header = true;
|
||||
$option->title = $menuInstance->Labels[$i];
|
||||
$option->hiddenOnCollapse = true;
|
||||
$option->id = $menuInstance->Id[$i];
|
||||
} else {
|
||||
$option->href = $menuInstance->Options[$i];
|
||||
$option->id = $menuInstance->Id[$i];
|
||||
@@ -581,12 +583,6 @@ class Home extends Api
|
||||
$option->icon = $menuInstance->Icons[$i];
|
||||
}
|
||||
|
||||
// Add additional attributes for some options
|
||||
if (in_array($menuInstance->Id[$i], $optionsWithCounter)) {
|
||||
$option->badge = new stdClass();
|
||||
$option->badge->text = '0';
|
||||
$option->badge->class = 'badge-custom';
|
||||
}
|
||||
if ($menuInstance->Id[$i] === 'CASES_SEARCH') {
|
||||
// Get advanced search filters for the current user
|
||||
$filters = Filter::getByUser($this->getUserId());
|
||||
@@ -626,11 +622,7 @@ class Home extends Api
|
||||
"id" => $value['id'],
|
||||
"title" => $value['name'],
|
||||
"description" => $value['description'],
|
||||
"icon" => $value['iconList'],
|
||||
"badge" => [
|
||||
"text" => "0",
|
||||
"class" => "badge-custom"
|
||||
]
|
||||
"icon" => $value['iconList']
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -795,7 +787,7 @@ class Home extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tasks counters for todo, draft, paused and unassigned
|
||||
* Get the tasks counters for all task list: todo, draft, paused and unassigned
|
||||
*
|
||||
* @url GET /tasks/counter
|
||||
*
|
||||
@@ -833,6 +825,26 @@ class Home extends Api
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tasks highlight for all task list
|
||||
*
|
||||
* @url GET /tasks/highlight
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_CASES}
|
||||
*/
|
||||
public function getHighlight()
|
||||
{
|
||||
$usrUid = $this->getUserId();
|
||||
$casesList = new CasesList();
|
||||
$result = [];
|
||||
$result = $casesList->atLeastOne($usrUid);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all tasks, paged optionally, can be sent a text to filter results by "TAS_TITLE"
|
||||
*
|
||||
@@ -904,7 +916,10 @@ class Home extends Api
|
||||
{
|
||||
$setting = UserConfig::getSetting($id, $name);
|
||||
if (is_null($setting)) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, G::LoadTranslation('ID_DOES_NOT_EXIST'));
|
||||
$setting = [
|
||||
"status" => 404,
|
||||
"message" => G::LoadTranslation('ID_DOES_NOT_EXIST')
|
||||
];
|
||||
}
|
||||
return $setting;
|
||||
}
|
||||
|
||||
@@ -157,4 +157,46 @@ class Metrics extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get total cases risk
|
||||
*
|
||||
* @url GET /cases-risk
|
||||
*
|
||||
* @param string $caseList
|
||||
* @param int $process
|
||||
* @param string $dateFrom
|
||||
* @param string $dateTo
|
||||
* @param string $riskStatus
|
||||
* @param int $topCases
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getCasesRiskByProcess($caseList = 'inbox', $process, $dateFrom = null, $dateTo = null, $riskStatus = 'ON_TIME', $topCases = null)
|
||||
{
|
||||
try {
|
||||
$usrId = $this->getUserId();
|
||||
switch ($caseList) {
|
||||
case 'inbox':
|
||||
$list = new Inbox();
|
||||
break;
|
||||
case 'draft':
|
||||
$list = new Draft();
|
||||
break;
|
||||
case 'paused':
|
||||
$list = new Paused();
|
||||
break;
|
||||
case 'unassigned':
|
||||
$list = new Unassigned();
|
||||
break;
|
||||
}
|
||||
$list->setUserId($usrId);
|
||||
$result = $list->getCasesRisk($process, $dateFrom, $dateTo, $riskStatus, $topCases);
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user