23
database/factories/StepSupervisorFactory.php
Normal file
23
database/factories/StepSupervisorFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Factories\Factory;
|
||||
|
||||
class StepSupervisorFactory extends Factory
|
||||
{
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'STEP_UID' => $this->faker->regexify("/[a-zA-Z]{32}/"),
|
||||
'PRO_UID' => function () {
|
||||
return \ProcessMaker\Model\Process::factory()->create()->PRO_UID;
|
||||
},
|
||||
'STEP_TYPE_OBJ' => 'DYNAFORM',
|
||||
'STEP_UID_OBJ' => function () {
|
||||
return \ProcessMaker\Model\Dynaform::factory()->create()->DYN_UID;
|
||||
},
|
||||
'STEP_POSITION' => 1
|
||||
];
|
||||
}
|
||||
}
|
||||
66
resources/assets/js/api/Cases.js
Normal file → Executable file
66
resources/assets/js/api/Cases.js
Normal file → Executable file
@@ -239,6 +239,21 @@ export let cases = {
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Get the list of users to re-assign
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
getUsersToReassign(data) {
|
||||
return Api.get({
|
||||
service: "GET_USERS_TO_REASSIGN",
|
||||
data: {},
|
||||
keys: {
|
||||
task_uid: data.TAS_UID,
|
||||
app_uid: data.APP_UID
|
||||
}
|
||||
});
|
||||
},
|
||||
reassingCase(data) {
|
||||
return Api.update({
|
||||
service: "REASSIGN_CASE",
|
||||
@@ -254,6 +269,25 @@ export let cases = {
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Reassign a case to a new user
|
||||
* @param {*} data
|
||||
*/
|
||||
reassingCaseSupervisor(data) {
|
||||
return Api.update({
|
||||
service: "REASSIGN_CASE",
|
||||
data: {
|
||||
usr_uid_target: data.userSelected,
|
||||
del_index: data.DEL_INDEX,
|
||||
reason: data.reasonReassign,
|
||||
sendMail: data.notifyUser,
|
||||
usr_uid_source: data.USR_UID
|
||||
},
|
||||
keys: {
|
||||
app_uid: data.APP_UID
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Claim case with endpoint
|
||||
* @param {*} data
|
||||
@@ -270,6 +304,38 @@ export let cases = {
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Assign case with endpoint
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
assignCase(data) {
|
||||
return Api.update({
|
||||
service: "ASSIGN_CASE",
|
||||
data: {
|
||||
reason: data.reasonReassign,
|
||||
sendMail: data.notifyUser,
|
||||
index: data.DEL_INDEX
|
||||
},
|
||||
keys: {
|
||||
app_uid: data.APP_UID,
|
||||
usr_uid: data.userSelected
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Verify if the user is Supervisor
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
getIsSupervisor(data) {
|
||||
return Api.get({
|
||||
service: "IS_SUPERVISOR",
|
||||
keys: {
|
||||
app_num: data
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Service to jump a case by it's number
|
||||
* @param {object} dt
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
export default {
|
||||
ASSIGN_CASE: "/cases/{app_uid}/{usr_uid}/assign",
|
||||
IS_SUPERVISOR: "/cases/{app_num}/supervisor",
|
||||
AUTHENTICATE_USER: "/oauth2/token",
|
||||
USER_DATA: "/light/user/data",
|
||||
GET_MAIN_MENU_COUNTERS: "/light/counters",
|
||||
@@ -10,6 +12,7 @@
|
||||
GET_LISTS_PAUSED: "/light/paused",
|
||||
GET_LISTS_COMPLETED: "/light/completed",
|
||||
GET_USERS_PICTURES: "/light/users/data",
|
||||
GET_USERS_TO_REASSIGN: "/cases/{task_uid}/{app_uid}/userstoreassign",
|
||||
FORMS_ARRAY: "/light/project/{pro_uid}/activity/{act_uid}/steps",
|
||||
GET_NEW_CASES: "/case/start-cases?type_view=category",
|
||||
GET_HISTORY_CASES: "/light/history/{app_uid}",
|
||||
|
||||
@@ -10,12 +10,20 @@
|
||||
>
|
||||
{{ dataAlert.message }}
|
||||
</b-alert>
|
||||
<p class="">
|
||||
<p class="d-flex">
|
||||
<div class="mr-2 d-flex justify-content-between">
|
||||
<div class="d-flex">
|
||||
<h5 class="v-search-title">{{ $t("ID_CASE_DETAILS") }}</h5>
|
||||
<div class="pm-in-text-icon">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
</div>
|
||||
</div>
|
||||
<button-fleft :data="newCase"></button-fleft>
|
||||
</div>
|
||||
<b-icon icon="arrow-left"></b-icon>
|
||||
<button type="button" class="btn btn-link" @click="$emit('onLastPage')">
|
||||
{{ $t("ID_BACK") }}
|
||||
</button>
|
||||
<button-fleft :data="newCase"></button-fleft>
|
||||
</p>
|
||||
<modal-new-request ref="newRequest"></modal-new-request>
|
||||
</div>
|
||||
@@ -46,7 +54,7 @@
|
||||
</div>
|
||||
<div slot="actions" slot-scope="props">
|
||||
<b-button
|
||||
v-if="props.row.STATUS === 'OPEN'"
|
||||
v-if="props.row.STATUS === 'OPEN' && !supervisor || !flagSupervising"
|
||||
@click="onClick(props)"
|
||||
variant="outline-success"
|
||||
>{{ $t("ID_CONTINUE") }}</b-button
|
||||
@@ -57,9 +65,35 @@
|
||||
variant="outline-primary"
|
||||
>{{ $t("ID_UNPAUSE") }}</b-button
|
||||
>
|
||||
<b-button
|
||||
v-if="props.row.USR_UID === '' && props.row.STATUS !== 'CLOSED' && supervisor && flagSupervising"
|
||||
@click="onClickAssign(props.row)"
|
||||
variant="primary"
|
||||
>
|
||||
<i class="fa fa-users"></i>
|
||||
{{ $t("ID_ASSIGN") }}
|
||||
</b-button>
|
||||
<b-button
|
||||
v-if="props.row.USR_UID !== '' && props.row.STATUS !== 'CLOSED' && supervisor && flagSupervising"
|
||||
@click="onClickReassign(props.row)"
|
||||
variant="success"
|
||||
>
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
{{ $t("ID_REASSIGN") }}
|
||||
</b-button>
|
||||
</div>
|
||||
</v-server-table>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<b-button
|
||||
v-if="supervisor && flagSupervising"
|
||||
@click="onClickReview(dataCaseReview)"
|
||||
variant="primary"
|
||||
>
|
||||
<i class="far fa-edit"></i>
|
||||
{{ $t("ID_REVIEW_CASE") }}
|
||||
</b-button>
|
||||
</div>
|
||||
<TabsCaseDetail
|
||||
ref="tabsCaseDetail"
|
||||
:dataCaseStatus="dataCaseStatusTab"
|
||||
@@ -105,6 +139,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<ModalClaimCase ref="modal-claim-case" @claimCatch="claimCatch"></ModalClaimCase>
|
||||
<ModalReassignCase ref="modal-reassign-case" @claimCatch="claimCatch"></ModalReassignCase>
|
||||
<ModalAssignCase ref="modal-assign-case" @claimCatch="claimCatch"></ModalAssignCase>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -117,9 +154,11 @@ import CaseComment from "../components/home/caseDetail/CaseComment";
|
||||
import CaseComments from "../components/home/caseDetail/CaseComments";
|
||||
import TabsCaseDetail from "../home/TabsCaseDetail.vue";
|
||||
import ButtonFleft from "../components/home/ButtonFleft.vue";
|
||||
import ModalAssignCase from "./modal/ModalAssignCase.vue";
|
||||
import ModalCancelCase from "../home/modal/ModalCancelCase.vue";
|
||||
import ModalNewRequest from "./ModalNewRequest.vue";
|
||||
import ModalClaimCase from "./modal/ModalClaimCase.vue";
|
||||
import ModalReassignCase from "./modal/ModalReassignCase.vue";
|
||||
import TaskCell from "../components/vuetable/TaskCell.vue";
|
||||
import CurrentUserCell from "../components/vuetable/CurrentUserCell.vue"
|
||||
import utils from "./../utils/utils";
|
||||
@@ -135,10 +174,12 @@ export default {
|
||||
AttachedDocumentsEdit,
|
||||
CaseComment,
|
||||
CaseComments,
|
||||
ModalAssignCase,
|
||||
ModalCancelCase,
|
||||
ButtonFleft,
|
||||
ModalNewRequest,
|
||||
ModalClaimCase,
|
||||
ModalReassignCase,
|
||||
TaskCell,
|
||||
CurrentUserCell
|
||||
},
|
||||
@@ -222,7 +263,11 @@ export default {
|
||||
dataComments: {
|
||||
title: "Comments",
|
||||
items: []
|
||||
}
|
||||
},
|
||||
dataCaseReview: {},
|
||||
app_num: this.$parent.dataCase.APP_NUMBER,
|
||||
supervisor: false,
|
||||
flagSupervising: false
|
||||
};
|
||||
},
|
||||
|
||||
@@ -234,6 +279,7 @@ export default {
|
||||
//set dataCase
|
||||
this.dataCase = this.$parent.dataCase;
|
||||
this.$el.getElementsByClassName("VuePagination__count")[0].remove();
|
||||
this.changeFlagSupervising(this.dataCase.FLAG);
|
||||
this.getDataCaseSummary();
|
||||
this.getInputDocuments();
|
||||
this.getOutputDocuments();
|
||||
@@ -498,6 +544,8 @@ export default {
|
||||
.pendingtask(that.$parent.dataCase)
|
||||
.then((response) => {
|
||||
dt = that.formatDataResponse(response.data);
|
||||
this.dataCaseReview = dt[0];
|
||||
this.supervisor = that.isSupervisor();
|
||||
resolutionFunc({
|
||||
data: dt,
|
||||
count: response.data.length,
|
||||
@@ -530,7 +578,8 @@ export default {
|
||||
PRO_UID: v.PRO_UID,
|
||||
TAS_UID: v.TAS_UID,
|
||||
UNASSIGNED: v.UNASSIGNED,
|
||||
USR_ID: v.USR_ID
|
||||
USR_ID: v.USR_ID,
|
||||
USR_UID: v.USR_UID
|
||||
});
|
||||
});
|
||||
return data;
|
||||
@@ -598,6 +647,21 @@ export default {
|
||||
this.$emit("onUpdatePage", "XCase");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Review case Click handler
|
||||
*
|
||||
* @param {object} data
|
||||
*/
|
||||
onClickReview(data) {
|
||||
this.$emit("onUpdateDataCase", {
|
||||
APP_UID: data.APP_UID,
|
||||
DEL_INDEX: data.DEL_INDEX,
|
||||
PRO_UID: data.PRO_UID,
|
||||
TAS_UID: data.TAS_UID,
|
||||
ACTION: "to_revise"
|
||||
});
|
||||
this.$emit("onUpdatePage", "XCase");
|
||||
},
|
||||
/**
|
||||
* Unpause click handler
|
||||
*
|
||||
@@ -614,6 +678,56 @@ export default {
|
||||
.catch((error) => {
|
||||
that.showAlert(error.response.data.error.message, 'danger');
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Assign click handler
|
||||
*
|
||||
* @param {object} item
|
||||
*/
|
||||
onClickAssign(item) {
|
||||
let that = this;
|
||||
Api.cases.open(_.extend({ ACTION: "assign" }, item)).then(() => {
|
||||
Api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
|
||||
that.$refs["modal-assign-case"].data = item;
|
||||
that.$refs["modal-assign-case"].show();
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Reassign click handler
|
||||
*
|
||||
* @param {object} item
|
||||
*/
|
||||
onClickReassign(item) {
|
||||
let that = this;
|
||||
item.FLAG = this.flagSupervising;
|
||||
Api.cases.open(_.extend({ ACTION: "reassign" }, item)).then(() => {
|
||||
Api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
|
||||
that.$refs["modal-reassign-case"].data = item;
|
||||
that.$refs["modal-reassign-case"].show();
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Is supervisor
|
||||
*
|
||||
* @return {bool} response
|
||||
*/
|
||||
isSupervisor() {
|
||||
Api.cases.getIsSupervisor(this.app_num).then((response) => {
|
||||
let res = false;
|
||||
if (response.statusText === "OK" || response.status === 200) {
|
||||
this.supervisor = response.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* Change the flag supervisor
|
||||
*
|
||||
* @param {string} data
|
||||
*/
|
||||
changeFlagSupervising(data) {
|
||||
this.flagSupervising = (data === 'SUPERVISING');
|
||||
},
|
||||
/**
|
||||
* Claim case
|
||||
@@ -662,4 +776,12 @@ export default {
|
||||
padding-left: 50px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
.pm-in-text-icon {
|
||||
font-size: 1.4rem;
|
||||
padding-right: 10px;
|
||||
line-height: 40px;
|
||||
}
|
||||
.table td, .table th {
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
@@ -192,6 +192,9 @@ export default {
|
||||
if ( e.data === "redirect=todo" || e.message === "redirect=todo"){
|
||||
that.OnClickSidebarItem(that.getItemMenuByValue("page","inbox"));
|
||||
}
|
||||
if ( e.data === "redirect=MyCases" || e.message === "redirect=MyCases"){
|
||||
that.OnClickSidebarItem(that.getItemMenuByValue("page","MyCases"));
|
||||
}
|
||||
if ( e.data === "update=debugger" || e.message === "update=debugger"){
|
||||
if(that.$refs["component"].updateView){
|
||||
that.$refs["component"].updateView();
|
||||
@@ -616,6 +619,9 @@ export default {
|
||||
*/
|
||||
getItemMenuByValue(key, value) {
|
||||
let obj = _.find(this.menu, function(o) {
|
||||
if(o[key] == value){
|
||||
return true;
|
||||
}
|
||||
if(o.component){
|
||||
return o.props.item[key] == value;
|
||||
}
|
||||
@@ -624,6 +630,9 @@ export default {
|
||||
if(obj.component){
|
||||
return obj.props;
|
||||
}
|
||||
if(obj.page){
|
||||
return {item : obj};
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -358,6 +358,7 @@ export default {
|
||||
PRO_UID: item.PRO_UID,
|
||||
TAS_UID: item.TAS_UID,
|
||||
APP_NUMBER: item.CASE_NUMBER,
|
||||
FLAG: this.filterHeader,
|
||||
ACTION:
|
||||
that.filterHeader === "SUPERVISING"
|
||||
? "to_revise"
|
||||
|
||||
190
resources/assets/js/home/modal/ModalAssignCase.vue
Executable file
190
resources/assets/js/home/modal/ModalAssignCase.vue
Executable file
@@ -0,0 +1,190 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-modal
|
||||
ref="modal-assign-case"
|
||||
hide-footer
|
||||
size="lg"
|
||||
>
|
||||
<template v-slot:modal-title>
|
||||
{{ $t('ID_ASSIGN_CASE') }}
|
||||
<i class="fas fa-users"></i>
|
||||
</template>
|
||||
<b-alert
|
||||
:show="dataAlert.dismissCountDown"
|
||||
dismissible
|
||||
:variant="dataAlert.variant"
|
||||
@dismissed="dataAlert.dismissCountDown = 0"
|
||||
@dismiss-count-down="countDownChanged"
|
||||
>
|
||||
{{ dataAlert.message }}
|
||||
</b-alert>
|
||||
<b-container fluid>
|
||||
<b-row class="my-1">
|
||||
<b-col sm="3">
|
||||
<label for="selectUser">{{ $t('ID_SELECT_USER') }}</label>
|
||||
</b-col>
|
||||
<b-col sm="9">
|
||||
<b-form-select v-model="userSelected" :options="users"></b-form-select>
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
<b-row class="my-1">
|
||||
<b-col sm="3">
|
||||
<label for="reasonAssign">{{ $t('ID_REASON') }}</label>
|
||||
</b-col>
|
||||
<b-col sm="9">
|
||||
<b-form-textarea
|
||||
id="reasonAssign"
|
||||
v-model="reasonAssign"
|
||||
rows="3"
|
||||
max-rows="6"
|
||||
></b-form-textarea>
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
<b-row class="my-1">
|
||||
<b-col sm="3">
|
||||
<label for="notifyUser">{{ $t('ID_NOTIFY_USERS_CASE') }}</label>
|
||||
</b-col>
|
||||
<b-col sm="9">
|
||||
<b-form-checkbox v-model="notifyUser" id="notifyUser" name="notifyUser" switch>
|
||||
</b-form-checkbox>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</b-container>
|
||||
<div class="modal-footer">
|
||||
<div class="float-right">
|
||||
<b-button
|
||||
variant="danger"
|
||||
data-dismiss="modal"
|
||||
@click="cancel"
|
||||
>
|
||||
{{ $t("ID_CANCEL") }}
|
||||
</b-button>
|
||||
<b-button
|
||||
variant="success"
|
||||
@click="assignCase"
|
||||
>
|
||||
{{ $t("ID_ASSIGN") }}
|
||||
</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</b-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from "../../api/index";
|
||||
import utils from "../../utils/utils";
|
||||
|
||||
export default {
|
||||
name: "ModalAssignCase",
|
||||
components: {},
|
||||
props: {},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
dataAlert: {
|
||||
dismissSecs: 5,
|
||||
dismissCountDown: 0,
|
||||
message: "",
|
||||
variant: "danger",
|
||||
},
|
||||
data: null,
|
||||
locale: 'en-US',
|
||||
users: [],
|
||||
reasonAssign: null,
|
||||
userSelected: null,
|
||||
notifyUser: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
classBtn(cls) {
|
||||
return "btn v-btn-request " + cls;
|
||||
},
|
||||
/**
|
||||
* Show modal
|
||||
*/
|
||||
show() {
|
||||
this.users = [];
|
||||
this.getUsers();
|
||||
this.$refs["modal-assign-case"].show();
|
||||
},
|
||||
/**
|
||||
* Button cancel
|
||||
*/
|
||||
cancel() {
|
||||
this.$refs["modal-assign-case"].hide();
|
||||
},
|
||||
/**
|
||||
* Service to get users
|
||||
*/
|
||||
getUsers() {
|
||||
let that = this;
|
||||
api.cases.getUsersToReassign(this.data).then((response) => {
|
||||
var users = response.data.data,
|
||||
i;
|
||||
if (response.statusText == "OK" || response.status === 200) {
|
||||
for (i = 0; i < users.length; i += 1) {
|
||||
that.users.push({
|
||||
value: users[i].USR_UID,
|
||||
text: utils.userNameDisplayFormat({
|
||||
userName: users[i].USR_USERNAME || "",
|
||||
firstName: users[i].USR_FIRSTNAME || "",
|
||||
lastName: users[i].USR_LASTNAME || "",
|
||||
format: window.config.FORMATS.format || null
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Service assign case, using reassign api service
|
||||
*/
|
||||
assignCase() {
|
||||
let that = this;
|
||||
this.data.userSelected = this.userSelected;
|
||||
this.data.reasonAssign = this.reasonAssign;
|
||||
this.data.notifyUser = this.notifyUser;
|
||||
api.cases.assignCase(this.data).then((response) => {
|
||||
if (response.statusText == "OK" || response.status === 200) {
|
||||
that.$refs["modal-assign-case"].hide();
|
||||
if (that.$parent.$refs["vueTable"] !== undefined) {
|
||||
that.$parent.$refs["vueTable"].getData();
|
||||
}
|
||||
if (that.$parent.$refs["vueListView"] !== undefined) {
|
||||
that.$parent.$refs["vueListView"].getData();
|
||||
}
|
||||
if (that.$parent.$refs["vueCardView"] !== undefined) {
|
||||
that.$parent.$refs["vueCardView"].getData();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
if(e.response.data && e.response.data.error){
|
||||
that.showAlert(e.response.data.error.message, "danger");
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Show the alert message
|
||||
* @param {string} message - message to be displayed in the body
|
||||
* @param {string} type - alert type
|
||||
*/
|
||||
showAlert(message, type) {
|
||||
this.dataAlert.message = message;
|
||||
this.dataAlert.variant = type || "info";
|
||||
this.dataAlert.dismissCountDown = this.dataAlert.dismissSecs;
|
||||
},
|
||||
/**
|
||||
* Updates the alert dismiss value to update
|
||||
* dismissCountDown and decrease
|
||||
* @param {mumber}
|
||||
*/
|
||||
countDownChanged(dismissCountDown) {
|
||||
this.dataAlert.dismissCountDown = dismissCountDown;
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
69
resources/assets/js/home/modal/ModalReassignCase.vue
Normal file → Executable file
69
resources/assets/js/home/modal/ModalReassignCase.vue
Normal file → Executable file
@@ -7,7 +7,7 @@
|
||||
>
|
||||
<template v-slot:modal-title>
|
||||
{{ $t('ID_REASSIGN_CASE') }}
|
||||
<i class="fas fa-undo"></i>
|
||||
<i :class="icon"></i>
|
||||
</template>
|
||||
<b-alert
|
||||
:show="dataAlert.dismissCountDown"
|
||||
@@ -78,7 +78,7 @@ import api from "./../../api/index";
|
||||
import utils from "../../utils/utils";
|
||||
|
||||
export default {
|
||||
name: "ModalPauseCase",
|
||||
name: "ModalReassignCase",
|
||||
components: {},
|
||||
props: {},
|
||||
mounted() {},
|
||||
@@ -95,7 +95,8 @@ export default {
|
||||
users: [],
|
||||
reasonReassign: null,
|
||||
userSelected: null,
|
||||
notifyUser: false
|
||||
notifyUser: false,
|
||||
icon: "fas fa-undo"
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -106,8 +107,12 @@ export default {
|
||||
* Show modal
|
||||
*/
|
||||
show() {
|
||||
this.users = [];
|
||||
this.getUsersReassign();
|
||||
this.$refs["modal-reassign-case"].show();
|
||||
if (this.data.FLAG){
|
||||
this.icon = "fas fa-exchange-alt";
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Button cancel
|
||||
@@ -120,7 +125,7 @@ export default {
|
||||
*/
|
||||
getUsersReassign() {
|
||||
let that = this;
|
||||
api.cases.getUserReassign(this.data).then((response) => {
|
||||
api.cases.getUsersToReassign(this.data).then((response) => {
|
||||
var users = response.data.data,
|
||||
i;
|
||||
if (response.statusText == "OK" || response.status === 200) {
|
||||
@@ -145,26 +150,48 @@ export default {
|
||||
let that = this;
|
||||
this.data.userSelected = this.userSelected;
|
||||
this.data.reasonReassign = this.reasonReassign;
|
||||
this.notifyUser = this.notifyUser;
|
||||
api.cases.reassingCase(this.data).then((response) => {
|
||||
if (response.statusText == "OK" || response.status === 200) {
|
||||
that.$refs["modal-reassign-case"].hide();
|
||||
if (that.$parent.$refs["vueTable"] !== undefined) {
|
||||
that.$parent.$refs["vueTable"].getData();
|
||||
this.data.notifyUser = this.notifyUser;
|
||||
if (!this.data.FLAG){
|
||||
api.cases.reassingCase(this.data).then((response) => {
|
||||
if (response.statusText == "OK" || response.status === 200) {
|
||||
that.$refs["modal-reassign-case"].hide();
|
||||
if (that.$parent.$refs["vueTable"] !== undefined) {
|
||||
that.$parent.$refs["vueTable"].getData();
|
||||
}
|
||||
if (that.$parent.$refs["vueListView"] !== undefined) {
|
||||
that.$parent.$refs["vueListView"].getData();
|
||||
}
|
||||
if (that.$parent.$refs["vueCardView"] !== undefined) {
|
||||
that.$parent.$refs["vueCardView"].getData();
|
||||
}
|
||||
}
|
||||
if (that.$parent.$refs["vueListView"] !== undefined) {
|
||||
that.$parent.$refs["vueListView"].getData();
|
||||
})
|
||||
.catch((e) => {
|
||||
if(e.response.data && e.response.data.error){
|
||||
that.showAlert(e.response.data.error.message, "danger");
|
||||
}
|
||||
if (that.$parent.$refs["vueCardView"] !== undefined) {
|
||||
that.$parent.$refs["vueCardView"].getData();
|
||||
});
|
||||
} else {
|
||||
api.cases.reassingCaseSupervisor(this.data).then((response) => {
|
||||
if (response.statusText == "OK" || response.status === 200) {
|
||||
that.$refs["modal-reassign-case"].hide();
|
||||
if (that.$parent.$refs["vueTable"] !== undefined) {
|
||||
that.$parent.$refs["vueTable"].getData();
|
||||
}
|
||||
if (that.$parent.$refs["vueListView"] !== undefined) {
|
||||
that.$parent.$refs["vueListView"].getData();
|
||||
}
|
||||
if (that.$parent.$refs["vueCardView"] !== undefined) {
|
||||
that.$parent.$refs["vueCardView"].getData();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
if(e.response.data && e.response.data.error){
|
||||
that.showAlert(e.response.data.error.message, "danger");
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
if(e.response.data && e.response.data.error){
|
||||
that.showAlert(e.response.data.error.message, "danger");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Show the alert message
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Faker\Factory;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\Dynaform;
|
||||
use ProcessMaker\Model\InputDocument;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\StepSupervisor;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
@@ -1203,6 +1206,39 @@ class PmDynaformTest extends TestCase
|
||||
// Session variable for "USER_LOGGED" should be empty
|
||||
$this->assertTrue(empty($_SESSION['USER_LOGGED']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @covers PmDynaform::navigationBarForStepsToRevise
|
||||
*/
|
||||
public function it_should_test_navigationBarForStepsToRevise()
|
||||
{
|
||||
//definition data
|
||||
$dynaform = Dynaform::factory()->create();
|
||||
$inputDocument = InputDocument::factory()->create();
|
||||
$application = Application::factory()->create([
|
||||
'PRO_UID' => $dynaform->PRO_UID
|
||||
]);
|
||||
StepSupervisor::factory()->create([
|
||||
'PRO_UID' => $application->PRO_UID,
|
||||
'STEP_TYPE_OBJ' => 'DYNAFORM',
|
||||
'STEP_UID_OBJ' => $dynaform->DYN_UID
|
||||
]);
|
||||
StepSupervisor::factory()->create([
|
||||
'PRO_UID' => $application->PRO_UID,
|
||||
'STEP_TYPE_OBJ' => 'DYNAFORM',
|
||||
'STEP_UID_OBJ' => $dynaform->DYN_UID
|
||||
]);
|
||||
StepSupervisor::factory()->create([
|
||||
'PRO_UID' => $application->PRO_UID,
|
||||
'STEP_TYPE_OBJ' => 'INPUT_DOCUMENT',
|
||||
'STEP_UID_OBJ' => $inputDocument->INP_DOC_UID
|
||||
]);
|
||||
|
||||
//assertion
|
||||
$result = PmDynaform::navigationBarForStepsToRevise($application->APP_UID, $dynaform->DYN_UID, 2);
|
||||
$this->assertNotEmpty($result);
|
||||
}
|
||||
}
|
||||
|
||||
// Dummy function used for the coverture
|
||||
|
||||
@@ -8,10 +8,16 @@ use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\Model\AppDelay;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Dynaform;
|
||||
use ProcessMaker\Model\Documents;
|
||||
use ProcessMaker\Model\GroupUser;
|
||||
use ProcessMaker\Model\Groupwf;
|
||||
use ProcessMaker\Model\InputDocument;
|
||||
use ProcessMaker\Model\ListUnassigned;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\ProcessUser;
|
||||
use ProcessMaker\Model\Step;
|
||||
use ProcessMaker\Model\StepSupervisor;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\Triggers;
|
||||
use ProcessMaker\Model\User;
|
||||
@@ -434,4 +440,156 @@ class CasesTest extends TestCase
|
||||
$this->assertArrayHasKey('PRO_UID', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the response true of supervisor function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::isSupervisor()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_supervisor_true()
|
||||
{
|
||||
$process = Process::factory()->create();
|
||||
ProcessUser::factory()->create([
|
||||
'PU_TYPE' => 'SUPERVISOR',
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'USR_UID' => $process->PRO_CREATE_USER
|
||||
]);
|
||||
$application = Application::factory()->create([
|
||||
'PRO_UID' => $process->PRO_UID
|
||||
]);
|
||||
Delegation::factory()->create([
|
||||
'APP_UID' => $application->APP_UID,
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'PRO_ID' => $process->PRO_ID
|
||||
]);
|
||||
|
||||
$process = Process::factory()->create();
|
||||
|
||||
$cases = new Cases();
|
||||
$result = $cases->isSupervisor($process->PRO_CREATE_USER, $application->APP_NUMBER);
|
||||
|
||||
// Asserts
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the response false of supervisor function
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::isSupervisor()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_supervisor_false()
|
||||
{
|
||||
$process = Process::factory()->create();
|
||||
$application = Application::factory()->create([
|
||||
'PRO_UID' => $process->PRO_UID
|
||||
]);
|
||||
Delegation::factory()->create([
|
||||
'APP_UID' => $application->APP_UID,
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'PRO_ID' => $process->PRO_ID
|
||||
]);
|
||||
|
||||
$cases = new Cases();
|
||||
$result = $cases->isSupervisor($process->PRO_CREATE_USER, $application->APP_NUMBER);
|
||||
|
||||
// Asserts
|
||||
$this->assertNotTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests get users to reassign
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::usersToReassign()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_users_to_reassign()
|
||||
{
|
||||
$process = Process::factory()->create();
|
||||
$task = Task::factory()->create([
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||
'TAS_GROUP_VARIABLE' => '@@arrayOfusers'
|
||||
]);
|
||||
$users = User::factory(3)->create();
|
||||
$groupwf = Groupwf::factory()->create();
|
||||
|
||||
GroupUser::factory()->create([
|
||||
'GRP_UID' => $groupwf->GRP_UID,
|
||||
'GRP_ID' => $groupwf->GRP_ID,
|
||||
'USR_UID' => $users[1]->USR_UID
|
||||
]);
|
||||
GroupUser::factory()->create([
|
||||
'GRP_UID' => $groupwf->GRP_UID,
|
||||
'GRP_ID' => $groupwf->GRP_ID,
|
||||
'USR_UID' => $users[2]->USR_UID
|
||||
]);
|
||||
|
||||
$application = Application::factory()->create([
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'APP_DATA' => serialize(['arrayOfusers' => [$groupwf->GRP_UID, $users[0]->USR_UID]])
|
||||
]);
|
||||
|
||||
$cases = new Cases();
|
||||
$result = $cases->usersToReassign($users[0]['USR_UID'], $task->TAS_UID, $application->APP_UID);
|
||||
// Asserts
|
||||
$this->assertCount(3, $result['data']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method getStepsToRevise.
|
||||
* @test
|
||||
* @covers ProcessMaker\BusinessModel\Cases::getStepsToRevise
|
||||
*/
|
||||
public function it_should_test_getStepsToRevise()
|
||||
{
|
||||
//definition data
|
||||
$dynaform = Dynaform::factory()->create();
|
||||
$application = Application::factory()->create([
|
||||
'PRO_UID' => $dynaform->PRO_UID
|
||||
]);
|
||||
$stepSupervisor = StepSupervisor::factory()->create([
|
||||
'PRO_UID' => $application->PRO_UID,
|
||||
'STEP_TYPE_OBJ' => 'DYNAFORM',
|
||||
'STEP_UID_OBJ' => $dynaform->DYN_UID
|
||||
]);
|
||||
|
||||
//assertion
|
||||
$cases = new Cases();
|
||||
$result = $cases->getStepsToRevise($application->APP_UID, 'DYNAFORM');
|
||||
$this->assertEquals($stepSupervisor->PRO_UID, $result[0]['PRO_UID']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method getAllUrlStepsToRevise.
|
||||
* @test
|
||||
* @covers ProcessMaker\BusinessModel\Cases::getAllUrlStepsToRevise
|
||||
*/
|
||||
public function it_should_test_getAllUrlStepsToRevise()
|
||||
{
|
||||
//definition data
|
||||
$dynaform = Dynaform::factory()->create();
|
||||
$inputDocument = InputDocument::factory()->create();
|
||||
$application = Application::factory()->create([
|
||||
'PRO_UID' => $dynaform->PRO_UID
|
||||
]);
|
||||
$stepSupervisor = StepSupervisor::factory()->create([
|
||||
'PRO_UID' => $application->PRO_UID,
|
||||
'STEP_TYPE_OBJ' => 'DYNAFORM',
|
||||
'STEP_UID_OBJ' => $dynaform->DYN_UID
|
||||
]);
|
||||
$stepSupervisor = StepSupervisor::factory()->create([
|
||||
'PRO_UID' => $application->PRO_UID,
|
||||
'STEP_TYPE_OBJ' => 'INPUT_DOCUMENT',
|
||||
'STEP_UID_OBJ' => $inputDocument->INP_DOC_UID
|
||||
]);
|
||||
|
||||
//assertion
|
||||
$cases = new Cases();
|
||||
$result = $cases->getAllUrlStepsToRevise($application->APP_UID, 2);
|
||||
$this->assertEquals($dynaform->DYN_UID, $result[0]['uid']);
|
||||
$this->assertEquals($inputDocument->INP_DOC_UID, $result[1]['uid']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1377,8 +1377,16 @@ class PmDynaform
|
||||
exit();
|
||||
}
|
||||
|
||||
public function printEditSupervisor()
|
||||
/**
|
||||
* Print edit supervisor forms.
|
||||
* @param array $param
|
||||
*/
|
||||
public function printEditSupervisor(array $param = [])
|
||||
{
|
||||
$navbar = '';
|
||||
if (isset($param['DEL_INDEX'])) {
|
||||
$navbar = self::navigationBarForStepsToRevise($this->fields["APP_UID"], $this->fields["CURRENT_DYNAFORM"], $param['DEL_INDEX']);
|
||||
}
|
||||
ob_clean();
|
||||
$json = G::json_decode($this->record["DYN_CONTENT"]);
|
||||
$this->jsonr($json);
|
||||
@@ -1405,6 +1413,7 @@ class PmDynaform
|
||||
" . $this->getTheStringVariableForGoogleMaps() . "
|
||||
</script>
|
||||
<script type=\"text/javascript\" src=\"/jscore/cases/core/pmDynaform.js\"></script>
|
||||
{$navbar}
|
||||
<div>
|
||||
" . $this->getSessionMessageForSupervisor() . "
|
||||
<div style=\"display: none;\">
|
||||
@@ -2629,4 +2638,54 @@ class PmDynaform
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get html navigation bar for steps to revise.
|
||||
* @param string $appUid
|
||||
* @param string $uid
|
||||
* @param int $delIndex
|
||||
* @return string
|
||||
*/
|
||||
public static function navigationBarForStepsToRevise(string $appUid, string $uid, int $delIndex): string
|
||||
{
|
||||
$navbar = '';
|
||||
$cases = new Cases();
|
||||
$steps = $cases->getAllUrlStepsToRevise($appUid, $delIndex);
|
||||
$n = count($steps);
|
||||
foreach ($steps as $key => $step) {
|
||||
if ($step['uid'] === $uid) {
|
||||
$previousLabel = '';
|
||||
$previousUrl = '';
|
||||
$nextLabel = '';
|
||||
$nextUrl = '';
|
||||
if ($key - 1 >= 0) {
|
||||
$previousLabel = G::LoadTranslation('ID_PREVIOUS');
|
||||
$previousUrl = $steps[$key - 1]['url'];
|
||||
}
|
||||
if ($key + 1 < $n) {
|
||||
$nextLabel = G::LoadTranslation('ID_NEXT');
|
||||
$nextUrl = $steps[$key + 1]['url'];
|
||||
}
|
||||
if (empty($nextUrl)) {
|
||||
$nextLabel = G::LoadTranslation('ID_FINISH');
|
||||
$nextUrl = 'javascript:if(window.parent && window.parent.parent){window.parent.parent.postMessage("redirect=MyCases","*");}';
|
||||
}
|
||||
//this condition modify the next Url for submit action
|
||||
if ($step['type'] === 'DYNAFORM') {
|
||||
$nextUrl = 'javascript:document.querySelector(".pmdynaform-container .pmdynaform-form").submit();';
|
||||
}
|
||||
$navbar = "<div style='width:100%;padding:0px 10px 0px 10px;margin:15px 0px 0px 0px;'>" .
|
||||
" <img src='/images/bulletButtonLeft.gif' style='float:left;'> " .
|
||||
" <a href='{$previousUrl}' style='float:left;font-size:12px;line-height:1;margin:0px 0px 1px 5px;text-decoration:none;!important;'>" .
|
||||
" {$previousLabel}" .
|
||||
" </a>" .
|
||||
" <img src='/images/bulletButton.gif' style='float:right;'> " .
|
||||
" <a href='{$nextUrl}' style='float:right;font-size:12px;line-height:1;margin:0px 5px 1px 0px;text-decoration:none;!important;'>" .
|
||||
" {$nextLabel}" .
|
||||
" </a>" .
|
||||
"</div>";
|
||||
}
|
||||
}
|
||||
return $navbar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ use ProcessMaker\Core\JobsManager;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
|
||||
class WsBase
|
||||
{
|
||||
@@ -2989,15 +2990,31 @@ class WsBase
|
||||
}
|
||||
|
||||
$tasUid = $aRow['TAS_UID'];
|
||||
$derivation = new Derivation();
|
||||
$userList = $derivation->getAllUsersFromAnyTask($tasUid, true);
|
||||
$task = Task::where('TAS_UID', '=', $tasUid)->first();
|
||||
$type = $task->TAS_ASSIGN_TYPE;
|
||||
$variable = $task->TAS_GROUP_VARIABLE;
|
||||
|
||||
if ($type === 'SELF_SERVICE' && $variable !== '') {
|
||||
$cases = new BmCases();
|
||||
$usersToReasign = $cases->usersToReassign($sessionId, $tasUid, $caseId)['data'];
|
||||
$userList = [];
|
||||
foreach ($usersToReasign as $user){
|
||||
$userList[] = $user['USR_UID'];
|
||||
}
|
||||
} else {
|
||||
$derivation = new Derivation();
|
||||
$userList = $derivation->getAllUsersFromAnyTask($tasUid, true);
|
||||
}
|
||||
|
||||
if (!in_array($userIdTarget, $userList)) {
|
||||
$result = new WsResponse(34, G::loadTranslation('ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS'));
|
||||
|
||||
$g->sessionVarRestore();
|
||||
|
||||
return $result;
|
||||
$bmCase = new BmCases();
|
||||
if (!$bmCase->isSupervisor($userIdTarget, $rows['APP_NUMBER'])){
|
||||
$result = new WsResponse(34, G::loadTranslation('ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS'));
|
||||
|
||||
$g->sessionVarRestore();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2419,6 +2419,12 @@ msgstr "Array of variables is empty"
|
||||
msgid "Assign"
|
||||
msgstr "Assign"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_ASSIGN_CASE
|
||||
#: LABEL/ID_ASSIGN_CASE
|
||||
msgid "Assign Case"
|
||||
msgstr "Assign Case"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_ASSIGNED_FIEDS
|
||||
#: LABEL/ID_ASSIGNED_FIEDS
|
||||
@@ -2527,6 +2533,12 @@ msgstr "Assign group to"
|
||||
msgid "Assign Manager To Department"
|
||||
msgstr "Assign Manager To Department"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_ASSIGN_NOTIFICATION
|
||||
#: LABEL/ID_ASSIGN_NOTIFICATION
|
||||
msgid "You were assigned to case #{0}."
|
||||
msgstr "You were assigned to case #{0}."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_ASSIGN_ROLE
|
||||
#: LABEL/ID_ASSIGN_ROLE
|
||||
@@ -4019,6 +4031,12 @@ msgstr "The case {0}: {1} with {2}: {3} does not exist."
|
||||
msgid "Case Description"
|
||||
msgstr "Case Description"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_CASE_DETAILS
|
||||
#: LABEL/ID_CASE_DETAILS
|
||||
msgid "Case Details"
|
||||
msgstr "Case Details"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_CASE_DOES_NOT_EXIST
|
||||
#: LABEL/ID_CASE_DOES_NOT_EXIST
|
||||
@@ -24011,6 +24029,12 @@ msgstr "Resume"
|
||||
msgid "Return"
|
||||
msgstr "Return"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_REVIEW_CASE
|
||||
#: LABEL/ID_REVIEW_CASE
|
||||
msgid "Review Case"
|
||||
msgstr "Review Case"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_RIGHT
|
||||
#: LABEL/ID_RIGHT
|
||||
|
||||
@@ -57205,6 +57205,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_ARE_YOU_SURE_UNPAUSE_TASK','en','Are you sure want to unpause the task?','2021-01-26') ,
|
||||
( 'LABEL','ID_ARRAY_VARIABLES_EMPTY','en','Array of variables is empty','2014-01-15') ,
|
||||
( 'LABEL','ID_ASSIGN','en','Assign','2014-01-15') ,
|
||||
( 'LABEL','ID_ASSIGN_CASE','en','Assign Case','2022-11-04') ,
|
||||
( 'LABEL','ID_ASSIGNED_FIEDS','en','ASSIGNED FIELDS','2014-01-15') ,
|
||||
( 'LABEL','ID_ASSIGNED_GROUPS','en','ASSIGNED GROUPS','2014-01-15') ,
|
||||
( 'LABEL','ID_ASSIGNED_MEMBERS','en','MEMBERS','2014-01-15') ,
|
||||
@@ -57225,6 +57226,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_ASSIGN_GROUP_TASK','en','Assign Group Task','2015-02-20') ,
|
||||
( 'LABEL','ID_ASSIGN_GROUP_TO','en','Assign group to','2014-01-15') ,
|
||||
( 'LABEL','ID_ASSIGN_MANAGER_TO_DEPARTAMENT','en','Assign Manager To Department','2014-10-21') ,
|
||||
( 'LABEL','ID_ASSIGN_NOTIFICATION','en','You were assigned to case #{0}.','2022-12-08') ,
|
||||
( 'LABEL','ID_ASSIGN_ROLE','en','Assign user','2014-01-15') ,
|
||||
( 'LABEL','ID_ASSIGN_RULES','en','Error: There is a problem with the next tasks of this process. One of them has manual assignment. Manual assignment shouldn''t be used with sub-processes','2015-02-24') ,
|
||||
( 'LABEL','ID_ASSIGN_SCREEN','en','Assign Screen','2014-01-15') ,
|
||||
@@ -57403,6 +57405,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( '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_DETAILS','en','Case Details','2022-10-25') ,
|
||||
( 'LABEL','ID_CASE_UID','en','Case Uid','2021-04-04') ,
|
||||
( 'LABEL','ID_CASE_THREAD_TITLE','en','Case Thread Title','2021-08-27') ,
|
||||
( 'LABEL','ID_CASE_THREAD_TITLE_NAME','en','Case Thread Title Name','2021-09-29') ,
|
||||
@@ -60923,6 +60926,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_RESTORING_CASE','en','Restoring case','2015-09-15') ,
|
||||
( 'LABEL','ID_RESULT','en','Result','2014-01-15') ,
|
||||
( 'LABEL','ID_RESUME','en','Resume','2014-01-15') ,
|
||||
( 'LABEL','ID_REVIEW_CASE','en','Review Case','2022-11-10') ,
|
||||
( 'LABEL','ID_RETURN_ADVANCED_SEARCH','en','Return','2019-07-17') ,
|
||||
( 'LABEL','ID_RIGHT','en','right','2014-09-18') ,
|
||||
( 'LABEL','ID_RIGHT_MARGIN','en','Right Margin','2014-01-15') ,
|
||||
|
||||
@@ -1,29 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* cases_SaveData.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
//validate the data post
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
||||
|
||||
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
|
||||
|
||||
@@ -210,6 +188,21 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
|
||||
//Define the STEP_POSITION
|
||||
$ex = isset($_GET['ex']) ? $_GET['ex'] : 0;
|
||||
//go to the next step
|
||||
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] );
|
||||
G::header( 'Location: cases_StepToRevise?type=DYNAFORM&ex=' . $ex . '&PRO_UID=' . $_SESSION['PROCESS'] . '&DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&position=' . $aNextStep['POSITION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] );
|
||||
$nextSteps = $oCase->getNextSupervisorStep($_SESSION['PROCESS'], $_SESSION['STEP_POSITION']);
|
||||
$url = '';
|
||||
$steps = (new BusinessModelCases())->getAllUrlStepsToRevise($_SESSION['APPLICATION'], $_SESSION['INDEX']);
|
||||
$n = count($steps);
|
||||
foreach ($steps as $key => $step) {
|
||||
if ($step['uid'] === $nextSteps['UID'] && $key + 1 < $n) {
|
||||
$nextUrl = $steps[$key + 1]['url'];
|
||||
$url = $nextUrl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($url)) {
|
||||
die('<script type="text/javascript">'
|
||||
. 'if(window.parent && window.parent.parent){window.parent.parent.postMessage("redirect=MyCases","*");}'
|
||||
. '</script>');
|
||||
}
|
||||
G::header('Location:' . $url);
|
||||
die();
|
||||
@@ -1,28 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* cases_Step.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
// die("first");
|
||||
/* Permissions */
|
||||
|
||||
$filter = new InputFilter();
|
||||
$_GET = $filter->xssFilterHard($_GET, "url");
|
||||
@@ -151,7 +127,7 @@ if ($_GET['DYN_UID'] != '') {
|
||||
$FieldsPmDynaform["CURRENT_DYNAFORM"] = $_GET['DYN_UID'];
|
||||
$a = new PmDynaform($FieldsPmDynaform);
|
||||
if ($a->isResponsive()) {
|
||||
$a->printEditSupervisor();
|
||||
$a->printEditSupervisor(['DEL_INDEX' => $_GET['DEL_INDEX']]);
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['DYN_UID'], '', $Fields['APP_DATA'], 'cases_SaveDataSupervisor?UID=' . $_GET['DYN_UID'] . '&ex=' . $_GET['ex']);
|
||||
}
|
||||
|
||||
@@ -1,28 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* cases_Step.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
//die("second");
|
||||
/* Permissions */
|
||||
|
||||
$filter = new InputFilter();
|
||||
$_GET = $filter->xssFilterHard($_GET, "url");
|
||||
@@ -119,13 +95,8 @@ if (! isset($_GET['INP_DOC_UID'])) {
|
||||
$Fields['MESSAGE2'] = G::LoadTranslation('ID_PLEASE_SELECT_FILE');
|
||||
$docName = $Fields['INP_DOC_TITLE'];
|
||||
$oHeadPublisher->addScriptCode('var documentName=\'Reviewing Input Document<br>' . $docName . '\';');
|
||||
// $G_PUBLISH->AddContent('xmlform', 'xmlform', $sXmlForm, '', $Fields, 'cases_SupervisorSaveDocument?UID=' .
|
||||
//$_GET['INP_DOC_UID'] . '&APP_UID=' . $_GET['APP_UID'] . '&position=' . $_GET['position']);
|
||||
$G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocumentsToRevise', 'cases/cases_ToReviseInputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['INP_DOC_UID']), array_merge(array('DOC_UID' => $_GET['INP_DOC_UID']
|
||||
), $Fields));
|
||||
//$aFields
|
||||
// $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList',
|
||||
//$oCase->getInputDocumentsCriteria($_SESSION['APPLICATION']));//$aFields
|
||||
$G_PUBLISH->AddContent('view','cases/paged-table-inputDocumentsToReviseNavBar');
|
||||
$G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocumentsToRevise', 'cases/cases_ToReviseInputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['INP_DOC_UID']), array_merge(['DOC_UID' => $_GET['INP_DOC_UID']], $Fields));
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
|
||||
@@ -473,7 +473,7 @@ a:hover {
|
||||
}
|
||||
|
||||
.card-body {
|
||||
background-color: #5aa4c4;
|
||||
background-color: #0099DC;
|
||||
color: #fff;
|
||||
-ms-flex: 1 1 auto;
|
||||
flex: 1 1 auto;
|
||||
|
||||
244
workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
Normal file → Executable file
244
workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
Normal file → Executable file
@@ -53,9 +53,13 @@ use ProcessMaker\Model\AppNotes as Notes;
|
||||
use ProcessMaker\Model\AppTimeoutAction;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Documents;
|
||||
use ProcessMaker\Model\Groupwf;
|
||||
use ProcessMaker\Model\GroupUser;
|
||||
use ProcessMaker\Model\ListUnassigned;
|
||||
use ProcessMaker\Model\Triggers;
|
||||
use ProcessMaker\Model\ProcessUser;
|
||||
use ProcessMaker\Model\StepSupervisor;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Services\Api;
|
||||
@@ -904,6 +908,26 @@ class Cases
|
||||
return $permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Review if the user is supervisor
|
||||
*
|
||||
* @param string $usrUid
|
||||
* @param int $caseNumber
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSupervisor(string $usrUid, int $caseNumber)
|
||||
{
|
||||
$result = [];
|
||||
$user = new BmUser();
|
||||
if ($user->checkPermission($usrUid, 'PM_SUPERVISOR')) {
|
||||
$processes = ProcessUser::getProcessesOfSupervisor($usrUid);
|
||||
$query = Delegation::query()->select(['APP_NUMBER'])->case($caseNumber)->processInList($processes);
|
||||
$result = $query->get()->values()->toArray();
|
||||
}
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reassign Case
|
||||
*
|
||||
@@ -911,7 +935,7 @@ class Cases
|
||||
* @param string $usrUid Unique id of User
|
||||
* @param int $delIndex
|
||||
* @param string $userSource Unique id of User Source
|
||||
* @param string $userTarget $userUidTarget id of User Target
|
||||
* @param string $userTarget id of User Target
|
||||
* @param string $reason
|
||||
* @param boolean $sendMail
|
||||
*
|
||||
@@ -939,11 +963,20 @@ class Cases
|
||||
|
||||
/** Add the note */
|
||||
if (!empty($reason)) {
|
||||
$noteContent = $reason;
|
||||
// Define the Case for register a case note
|
||||
$cases = new BmCases();
|
||||
$response = $cases->addNote($appUid, $usrUid, $noteContent, $sendMail);
|
||||
$this->sendMail($appUid, $usrUid, $reason, $sendMail, $userTarget);
|
||||
}
|
||||
|
||||
// Log
|
||||
$message = 'Reassign case';
|
||||
$context = $data = [
|
||||
"appUid" => $appUid,
|
||||
"usrUidSupervisor" => $usrUid,
|
||||
"userSource" => $userSource,
|
||||
"userTarget" => $userTarget,
|
||||
"reason" => $reason,
|
||||
"delIndex" => $delIndex
|
||||
];
|
||||
Log::channel(':ReassignCase')->info($message, Bootstrap::context($context));
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -1120,13 +1153,15 @@ class Cases
|
||||
* @param string $appUid
|
||||
* @param integer $index
|
||||
* @param string $userUid
|
||||
* @param string $action
|
||||
* @param string $reason
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function putClaimCase($appUid, $index, $userUid)
|
||||
public function putClaimCase($appUid, $index, $userUid, $action, $reason = '')
|
||||
{
|
||||
// Validate the parameters
|
||||
Validator::isString($appUid, '$appUid');
|
||||
@@ -1139,19 +1174,33 @@ class Cases
|
||||
$appDelegation = new AppDelegation();
|
||||
$delegation = $appDelegation->load($appUid, $index);
|
||||
if (empty($delegation['USR_UID'])) {
|
||||
$case = new ClassesCases();
|
||||
$case->loadCase($appUid);
|
||||
$classesCase = new ClassesCases();
|
||||
$case = $classesCase->loadCase($appUid);
|
||||
|
||||
//Review if the user can be claim the case
|
||||
if (!$case->isSelfService($userUid, $delegation['TAS_UID'], $appUid)) {
|
||||
$message = preg_replace("#<br\s*/?>#i", "", G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
|
||||
throw new Exception($message);
|
||||
if (!$classesCase->isSelfService($userUid, $delegation['TAS_UID'], $appUid)) {
|
||||
if (!$this->isSupervisor($userUid, $case['APP_NUMBER'])){
|
||||
$message = preg_replace("#<br\s*/?>#i", "", G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
|
||||
throw new Exception($message);
|
||||
}
|
||||
}
|
||||
|
||||
$case->setCatchUser($appUid, $index, $userUid);
|
||||
$classesCase->setCatchUser($appUid, $index, $userUid);
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation("ID_CASE_USER_INVALID_CLAIM_CASE", [$userUid]));
|
||||
}
|
||||
|
||||
$usrUidSupervisor = (Server::getUserId() === $userUid) ? '' : Server::getUserId();
|
||||
|
||||
// Log
|
||||
$message = $action . ' case';
|
||||
$context = $data = [
|
||||
"appUid" => $appUid,
|
||||
"usrUidSupervisor" => $usrUidSupervisor,
|
||||
"userTarget" => $userUid,
|
||||
"reason" => $reason,
|
||||
"delIndex" => $index
|
||||
];
|
||||
Log::channel(':' . $action . 'Case')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2741,6 +2790,70 @@ class Cases
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Users to reassign
|
||||
*
|
||||
* @param string $userUid Unique id of User (User logged)
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $appUid Unique id of Application
|
||||
*
|
||||
* @return array Return Users to reassign
|
||||
* @throws Exception
|
||||
*/
|
||||
public function usersToReassign(
|
||||
$userUid,
|
||||
$taskUid,
|
||||
$appUid
|
||||
) {
|
||||
$task = Task::where('TAS_UID', '=', $taskUid)->first();
|
||||
$type = $task->TAS_ASSIGN_TYPE;
|
||||
$variable = $task->TAS_GROUP_VARIABLE;
|
||||
$result = [];
|
||||
|
||||
if ($type === 'SELF_SERVICE' && $variable !== '') {
|
||||
$variable = substr($variable, 2);
|
||||
$fields = ModelApplication::where('APP_UID', '=', $appUid)->first();
|
||||
$data = ClassesCases::unserializeData($fields->APP_DATA);
|
||||
|
||||
$row = [];
|
||||
|
||||
if (!empty($data[$variable])) {
|
||||
foreach ($data[$variable] as $uid) {
|
||||
$group = Groupwf::where('GRP_UID', '=', $uid)->first();
|
||||
if (!empty($group)) {
|
||||
$usersOfGroup = GroupUser::where('GRP_UID', '=', $uid)->get()->toArray();
|
||||
foreach ($usersOfGroup as $data) {
|
||||
$row[] = $data['USR_UID'];
|
||||
}
|
||||
} else {
|
||||
$row[] = $uid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$users = [];
|
||||
foreach ($row as $data) {
|
||||
$obj = User::where('USR_UID', '=', $data)->Active()->first();
|
||||
if (!is_null($obj) && $obj->USR_USERNAME !== "") {
|
||||
$users[] = $obj;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($users as $user) {
|
||||
$result[] = [
|
||||
"USR_UID" => $user->USR_UID,
|
||||
"USR_USERNAME" => $user->USR_USERNAME,
|
||||
"USR_FIRSTNAME" => $user->USR_FIRSTNAME,
|
||||
"USR_LASTNAME"=> $user->USR_LASTNAME
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
$result = $this->getUsersToReassign($userUid, $taskUid)['data'];
|
||||
}
|
||||
return ['data' => $result];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Users to reassign
|
||||
*
|
||||
@@ -3944,6 +4057,47 @@ class Cases
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send mail to notify and Add a case note
|
||||
*
|
||||
* @param string $appUid
|
||||
* @param string $userUid
|
||||
* @param string $note
|
||||
* @param bool $sendMail
|
||||
* @param string $toUser
|
||||
*
|
||||
*/
|
||||
public function sendMail($appUid, $userUid, $note, $sendMail = false, $toUser = '')
|
||||
{
|
||||
|
||||
$appNumber = ModelApplication::getCaseNumber($appUid);
|
||||
|
||||
// Register the note
|
||||
$attributes = [
|
||||
"APP_UID" => $appUid,
|
||||
"APP_NUMBER" => $appNumber,
|
||||
"USR_UID" => $userUid,
|
||||
"NOTE_DATE" => date("Y-m-d H:i:s"),
|
||||
"NOTE_CONTENT" => $note,
|
||||
"NOTE_TYPE" => "USER",
|
||||
"NOTE_AVAILABILITY" => "PUBLIC",
|
||||
"NOTE_RECIPIENTS" => ""
|
||||
];
|
||||
$newNote = Notes::create($attributes);
|
||||
|
||||
// Send the email
|
||||
if ($sendMail) {
|
||||
// Get the FK
|
||||
$noteId = $newNote->NOTE_ID;
|
||||
|
||||
$note = G::LoadTranslation('ID_ASSIGN_NOTIFICATION', [$appNumber]) . '<br />' . G::LoadTranslation('ID_REASON') . ': ' . stripslashes($note);
|
||||
|
||||
// Send the notification
|
||||
$appNote = new AppNotes();
|
||||
$appNote->sendNoteNotification($appUid, $userUid, $note, $toUser, '', 0, $noteId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload file related to the case notes
|
||||
*
|
||||
@@ -4300,4 +4454,68 @@ class Cases
|
||||
// Return results
|
||||
return $dynaForms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get objects that they have send it.
|
||||
* @param string $appUid
|
||||
* @param string $typeObject
|
||||
* @return array
|
||||
*/
|
||||
public function getStepsToRevise(string $appUid, string $typeObject): array
|
||||
{
|
||||
$application = ModelApplication::where('APP_UID', '=', $appUid)
|
||||
->first();
|
||||
$result = StepSupervisor::where('PRO_UID', '=', $application['PRO_UID'])->
|
||||
where('STEP_TYPE_OBJ', '=', $typeObject)->
|
||||
orderBy('STEP_POSITION', 'ASC')->
|
||||
get()->
|
||||
toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all url steps to revise.
|
||||
* @param string $appUid
|
||||
* @param int $delIndex
|
||||
* @return array
|
||||
*/
|
||||
public function getAllUrlStepsToRevise(string $appUid, int $delIndex): array
|
||||
{
|
||||
$result = [];
|
||||
$dynaformStep = $this->getStepsToRevise($appUid, 'DYNAFORM');
|
||||
$inputDocumentStep = $this->getStepsToRevise($appUid, 'INPUT_DOCUMENT');
|
||||
$objects = array_merge($dynaformStep, $inputDocumentStep);
|
||||
usort($objects, function ($a, $b) {
|
||||
return $a['STEP_POSITION'] > $b['STEP_POSITION'];
|
||||
});
|
||||
$i = 0;
|
||||
$endPoint = '';
|
||||
$uidName = '';
|
||||
foreach ($objects as $step) {
|
||||
if ($step['STEP_TYPE_OBJ'] === 'DYNAFORM') {
|
||||
$endPoint = 'cases_StepToRevise';
|
||||
$uidName = 'DYN_UID';
|
||||
}
|
||||
if ($step['STEP_TYPE_OBJ'] === 'INPUT_DOCUMENT') {
|
||||
$endPoint = 'cases_StepToReviseInputs';
|
||||
$uidName = 'INP_DOC_UID';
|
||||
}
|
||||
$url = "{$endPoint}?"
|
||||
. "type={$step['STEP_TYPE_OBJ']}&"
|
||||
. "ex={$i}&"
|
||||
. "PRO_UID={$step["PRO_UID"]}&"
|
||||
. "{$uidName}={$step['STEP_UID_OBJ']}&"
|
||||
. "APP_UID={$appUid}&"
|
||||
. "position={$step['STEP_POSITION']}&"
|
||||
. "DEL_INDEX={$delIndex}";
|
||||
$result[] = [
|
||||
'uid' => $step['STEP_UID_OBJ'],
|
||||
'type' => $step['STEP_TYPE_OBJ'],
|
||||
'url' => $url
|
||||
];
|
||||
$i++;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
17
workflow/engine/src/ProcessMaker/Model/StepSupervisor.php
Normal file
17
workflow/engine/src/ProcessMaker/Model/StepSupervisor.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use App\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StepSupervisor extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'STEP_SUPERVISOR';
|
||||
protected $primaryKey = 'STEP_UID';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
83
workflow/engine/src/ProcessMaker/Services/Api/Cases.php
Normal file → Executable file
83
workflow/engine/src/ProcessMaker/Services/Api/Cases.php
Normal file → Executable file
@@ -1031,7 +1031,88 @@ class Cases extends Api
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new BmCases();
|
||||
$cases->putClaimCase($appUid, $index, $userUid);
|
||||
$cases->putClaimCase($appUid, $index, $userUid, 'Claim');
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if current user is a supervisor
|
||||
*
|
||||
* @url GET /:appNumber/supervisor
|
||||
*
|
||||
* @param int $appNumber
|
||||
*
|
||||
* @return boolean
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_CASES}
|
||||
*/
|
||||
public function isSupervisor(int $appNumber)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new BmCases();
|
||||
return $cases->isSupervisor($userUid, $appNumber);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign Case
|
||||
*
|
||||
* @url PUT /:appUid/:usrUid/assign
|
||||
*
|
||||
* @param string $appUid {@min 1}{@max 32}
|
||||
* @param string $usrUid {@min 1}{@max 32}
|
||||
* @param int $index {@from body}
|
||||
* @param string $reason {@from body}
|
||||
* @param bool $sendMail {@from body}
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_CASES}
|
||||
*/
|
||||
public function doPutAssignCase($appUid, $usrUid, $index, $reason = '', $sendMail = false)
|
||||
{
|
||||
try {
|
||||
$cases = new BmCases();
|
||||
$cases->putClaimCase($appUid, $index, $usrUid, 'Assign', $reason);
|
||||
|
||||
/** Add the note */
|
||||
if (!empty($reason)) {
|
||||
$currentUserUid = $this->getUserId();
|
||||
$cases->sendMail($appUid, $currentUserUid, $reason, $sendMail, $usrUid);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get users to reassign or assign
|
||||
*
|
||||
* @url GET /:task_uid/:app_uid/userstoreassign
|
||||
*
|
||||
* @param string $task_uid
|
||||
* @param string $app_uid
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_CASES}
|
||||
*/
|
||||
public function usersToReasign($task_uid, $app_uid)
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new BmCases();
|
||||
return $cases->usersToReassign($usr_uid, $task_uid, $app_uid);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
@@ -531,7 +531,8 @@ Ext.onReady(function(){
|
||||
},
|
||||
iconCls: 'ICON_STEPS',
|
||||
toggleHandler: togglePreview,
|
||||
disabled: true
|
||||
disabled: true,
|
||||
hidden: true
|
||||
}, {
|
||||
id: 'informationMenu',
|
||||
text: _('ID_INFORMATION'),
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
$navbar = PmDynaform::navigationBarForStepsToRevise($_GET['APP_UID'], $_GET['INP_DOC_UID'], $_GET['DEL_INDEX']);
|
||||
|
||||
echo '<div class="pagedTableDefault" style="border:none;margin:0px;padding:0px;margin-right:20px;margin-top:-3px;">'
|
||||
. '<div class="headerContent" style="border:none;margin:0px;padding:0px;">'
|
||||
. '<div class="tableOption" style="border:none;margin:0px;padding:0px;">'
|
||||
. $navbar
|
||||
. '</div>'
|
||||
. '</div>'
|
||||
. '</div>';
|
||||
Reference in New Issue
Block a user