Merge branch 'feature/PMCORE-3049' of https://bitbucket.org/colosa/processmaker into feature/PMCORE-3078

This commit is contained in:
Henry Jordan
2021-07-13 15:23:36 +00:00
34 changed files with 1176 additions and 247 deletions

View File

@@ -7,7 +7,7 @@ use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\TaskScheduler::class, function (Faker $faker) {
return [
'id' => G::generateUniqueID(),
'id' => $faker->unique()->numberBetween(5000),
'title' => $faker->title,
'startingTime' => $faker->dateTime(),
'endingTime' => $faker->dateTime(),

5
package-lock.json generated
View File

@@ -9698,6 +9698,11 @@
"is-plain-obj": "^1.0.0"
}
},
"sortablejs": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.13.0.tgz",
"integrity": "sha512-RBJirPY0spWCrU5yCmWM1eFs/XgX2J5c6b275/YyxFRgnzPhKl/TDeU2hNR8Dt7ITq66NRPM4UlOt+e5O4CFHg=="
},
"source-list-map": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",

View File

@@ -37,6 +37,7 @@
"npm-font-open-sans": "^1.1.0",
"popper.js": "^1.12",
"promise-polyfill": "8.1.3",
"sortablejs": "^1.13.0",
"uiv": "^0.28.0",
"vue": "^2.6.12",
"vue-awesome-swiper": "^3.1.3",
@@ -55,6 +56,7 @@
"vue-split-panel": "^1.0.4",
"vue-tables-2": "^2.1.46",
"vue-upload-component": "^2.8.20",
"vuedraggable": "^2.24.3",
"vuejs-auto-complete": "^0.9.0",
"vuejs-datepicker": "^1.5.4",
"vuejs-paginate": "^2.0.1",

View File

@@ -21,9 +21,11 @@
<script>
import api from "./../../api/index";
import CustomSidebarMenuItem from "./CustomSidebarMenuItem";
export default {
name: "CustomSidebar",
props: ["menu"],
data() {
return {
collapsed: false,
@@ -61,8 +63,8 @@ export default {
onItemClick(event, item, node) {
this.$emit("OnClickSidebarItem", { item });
},
/**
* On resize event handler id the windows is resized
/**
* On resize event handler id the windows is resized
* collase and isMobile proerty will be updated
*/
onResize() {
@@ -74,7 +76,7 @@ export default {
this.collapsed = false;
}
}
},
}
};
</script>

View File

@@ -0,0 +1,26 @@
<template>
<component
:is="icon.element ? icon.element : 'i'"
class="vsm--icon"
:class="
typeof icon === 'string' || icon instanceof String
? icon
: icon.class
"
v-bind="icon.attributes"
>
{{ icon.text }}
</component>
</template>
<script>
export default {
name: "CustomSidebarMenuIcon",
props: {
icon: {
type: [String, Object],
default: "",
},
},
};
</script>

View File

@@ -0,0 +1,497 @@
<template>
<div id="my-container">
<div
v-if="item.header && !isItemHidden"
class="vsm--header"
:class="item.class"
v-bind="item.attributes"
>
{{ item.title }} <b-icon icon="pie-chart-fill"></b-icon>
</div>
<div
v-else-if="!isItemHidden"
class="vsm--item"
:class="[{ 'vsm--item_open': show }]"
@mouseover="mouseOverEvent"
@mouseout="mouseOutEvent"
>
<custom-sidebar-menu-link
:item="item"
:class="itemLinkClass"
:attributes="item.attributes"
@click.native="clickEvent"
>
<custom-sidebar-menu-icon
v-if="item.icon && !isMobileItem"
:icon="item.icon"
/>
<transition name="fade-animation" :appear="isMobileItem">
<template
v-if="
(isCollapsed && !isFirstLevel) ||
!isCollapsed ||
isMobileItem
"
>
<span class="vsm--title">
{{ item.title }}
<b-icon
v-if="item.sortable"
:icon="item.sortIcon"
@click="onClickSortSettings"
></b-icon>
</span>
</template>
</transition>
<template
v-if="
(isCollapsed && !isFirstLevel) ||
!isCollapsed ||
isMobileItem
"
>
<sidebar-menu-badge v-if="item.badge" :badge="item.badge" />
<div
v-if="itemHasChild"
class="vsm--arrow"
:class="[
{ 'vsm--arrow_open': show },
{ 'vsm--arrow_slot': $slots['dropdown-icon'] },
]"
>
<slot name="dropdown-icon" />
</div>
</template>
</custom-sidebar-menu-link>
<template v-if="itemHasChild">
<template
v-if="
(isCollapsed && !isFirstLevel) ||
!isCollapsed ||
isMobileItem
"
>
<transition
:appear="isMobileItem"
name="expand"
@enter="expandEnter"
@afterEnter="expandAfterEnter"
@beforeLeave="expandBeforeLeave"
>
<div
v-if="show"
class="vsm--dropdown"
:class="isMobileItem && 'vsm--dropdown_mobile-item'"
:style="isMobileItem && mobileItemStyle.dropdown"
>
<div class="vsm--list">
<custom-sidebar-menu-item
v-for="(subItem, index) in item.child"
:key="index"
:item="subItem"
:level="level + 1"
:show-child="showChild"
:rtl="rtl"
:is-collapsed="isCollapsed"
>
<slot
slot="dropdown-icon"
name="dropdown-icon"
/>
</custom-sidebar-menu-item>
</div>
</div>
</transition>
</template>
</template>
<b-modal
ref="modal"
v-if="item.sortable"
id="my-modal"
static
title="Custom Case List Order"
>
<draggable
:list="item.child"
:disabled="!enabled"
class="list-group"
ghost-class="ghost"
@end="checkMove"
@start="dragging = true"
handle=".handle"
>
<div
class="list-group-item"
v-for="element in item.child"
:key="element.title"
>
<b-row>
<b-col
><b-icon icon="check-circle"></b-icon>
</b-col>
<b-col cols="9">{{ element.title }}</b-col>
<b-col
><i class="fa fa-align-justify handle"></i
></b-col>
</b-row>
</div>
</draggable>
<template #modal-footer="{ ok, cancel, hide }">
<b-button size="sm" variant="danger" @click="cancel()">
Cancel
</b-button>
</template>
</b-modal>
</div>
</div>
</template>
<script>
import draggable from "vuedraggable";
import CustomSidebarMenuLink from "./CustomSidebarMenuLink";
import CustomSidebarMenuIcon from "./CustomSidebarMenuIcon";
export default {
name: "CustomSidebarMenuItem",
props: {
item: {
type: Object,
required: true,
},
level: {
type: Number,
default: 1,
},
isMobileItem: {
type: Boolean,
default: false,
},
mobileItem: {
type: Object,
default: null,
},
activeShow: {
type: Object,
default: null,
},
showChild: {
type: Boolean,
default: false,
},
showOneChild: {
type: Boolean,
default: false,
},
rtl: {
type: Boolean,
default: false,
},
disableHover: {
type: Boolean,
default: false,
},
mobileItemStyle: {
type: Object,
default: null,
},
},
components: {
draggable,
CustomSidebarMenuLink,
CustomSidebarMenuIcon,
},
data() {
return {
enabled: true,
dragging: false,
itemShow: false,
itemHover: false,
exactActive: false,
active: false,
};
},
computed: {
isCollapsed() {
return this.$parent.isCollapsed;
},
itemLinkClass() {
return [
"vsm--link",
!this.isMobileItem ? `vsm--link_level-${this.level}` : "",
{ "vsm--link_mobile-item": this.isMobileItem },
{ "vsm--link_hover": this.hover },
{ "vsm--link_active": this.active },
{ "vsm--link_exact-active": this.exactActive },
{ "vsm--link_disabled": this.item.disabled },
this.item.class,
];
},
draggingInfo() {
return this.dragging ? "under drag" : "";
},
show: {
get() {
if (!this.itemHasChild) return false;
if (this.showChild || this.isMobileItem) return true;
return this.itemShow;
},
set(show) {
if (this.showOneChild) {
show
? this.emitActiveShow(this.item)
: this.emitActiveShow(null);
}
this.itemShow = show;
},
},
isFirstLevel() {
return this.level === 1;
},
itemHasChild() {
return !!(this.item.child && this.item.child.length > 0);
},
isItemHidden() {
return false;
},
},
watch: {
$route() {
setTimeout(() => {
if (this.item.header || this.item.component) return;
this.initState();
}, 1);
},
item(newItem, item) {
this.emitItemUpdate(newItem, item);
},
activeShow() {
this.itemShow = this.item === this.activeShow;
},
},
created() {
this.initState();
},
methods: {
/**
* Match the route to ensure the correct location
* @param {string} href
* @param {string} exactPath
* @return {boolean}
*/
matchRoute({ href, exactPath }) {
if (!href) return false;
if (this.$router) {
const { route } = this.$router.resolve(href);
return exactPath
? route.path === this.$route.path
: this.matchExactRoute(href);
} else {
return exactPath
? href === window.location.pathname
: this.matchExactRoute(href);
}
},
/**
* Match the exact route with the current location
* @param {string} href
* @return {boolean}
*/
matchExactRoute(href) {
if (!href) return false;
if (this.$router) {
const { route } = this.$router.resolve(href);
return route.fullPath === this.$route.fullPath;
} else {
return (
href ===
window.location.pathname +
window.location.search +
window.location.hash
);
}
},
/**
* Check if the child is active
* @param {object} child
* @return {boolean}
*/
isChildActive(child) {
if (!child) return false;
return child.some((item) => {
return this.isLinkActive(item);
});
},
/**
* Validate if the Alias is active
* @param {object} item
* @return {boobleam}
*/
isAliasActive(item) {
if (item.alias) {
const current = this.$router
? this.$route.fullPath
: window.location.pathname +
window.location.search +
window.location.hash;
if (Array.isArray(item.alias)) {
return item.alias.some((alias) => {
return pathToRegexp(alias).test(current);
});
} else {
return pathToRegexp(item.alias).test(current);
}
}
return false;
},
/**
* Validate if the link is active
* @param {object} item
* @return {boolean}
*/
isLinkActive(item) {
return (
this.matchRoute(item) ||
this.isChildActive(item.child) ||
this.isAliasActive(item)
);
},
/**
* Ensurre if the link exact is active
* @param {object} item
* @return {boolean}
*/
isLinkExactActive(item) {
return this.matchExactRoute(item.href);
},
/**
* Initialize the state of the menu item
*/
initState() {
this.initActiveState();
this.initShowState();
},
/**
* Initalize the active state of the menu item
*/
initActiveState() {
this.active = this.isLinkActive(this.item);
this.exactActive = this.isLinkExactActive(this.item);
},
/**
* Initialize and show active state menu item
*/
initShowState() {
if (!this.itemHasChild || this.showChild) return;
if (
(this.showOneChild && this.active && !this.show) ||
(this.active && !this.show)
) {
this.show = true;
} else if (this.showOneChild && !this.active && this.show) {
this.show = false;
}
},
/**
* Handler to check if the item is moving
* @param {object} e
*/
checkMove: function(e) {
let aux = this.item.child.splice(e.newIndex, 1);
this.item.child.splice(e.newIndex, 0, aux[0]);
},
/**
* Click event Handler
* @param {object} event
*/
clickEvent(event) {
if (this.item.disabled) return;
if (!this.item.href) {
event.preventDefault();
}
this.emitItemClick(event, this.item, this);
this.emitMobileItem(event, event.currentTarget.offsetParent);
if (!this.itemHasChild || this.showChild || this.isMobileItem)
return;
if (!this.item.href || this.exactActive) {
this.show = !this.show;
}
},
/**
* Mouse over event handler
* @param {object} event
*/
mouseOverEvent(event) {
if (this.item.disabled) return;
event.stopPropagation();
this.itemHover = true;
if (!this.disableHover) {
this.emitMobileItem(event, event.currentTarget);
}
},
/**
* Mouse out event handler
* @param {object} event
*/
mouseOutEvent(event) {
event.stopPropagation();
this.itemHover = false;
},
/**
* Expand sidebar menu item handler
* @param {object} el
*/
expandEnter(el) {
el.style.height = el.scrollHeight + "px";
},
/**
* Expand after enter menu item handler
* @param {object} el
*/
expandAfterEnter(el) {
el.style.height = "auto";
},
/**
* Expand before leace handler
* @param {object} el
*/
expandBeforeLeave(el) {
if (this.isCollapsed && this.isFirstLevel) {
el.style.display = "none";
return;
}
el.style.height = el.scrollHeight + "px";
},
/**
* Emit Mobile item handler
* @param {object} event
* @param {object} itemEl
*/
emitMobileItem(event, itemEl) {
if (this.hover) return;
if (!this.isCollapsed || !this.isFirstLevel || this.isMobileItem)
return;
this.$emit("unset-mobile-item", true);
setTimeout(() => {
if (this.mobileItem !== this.item) {
this.$emit("set-mobile-item", { item: this.item, itemEl });
}
if (event.type === "click" && !this.itemHasChild) {
this.$emit("unset-mobile-item", false);
}
}, 0);
},
/**
* Click Sort settings event handler
* @param {object} event
*/
onClickSortSettings(event) {
event.preventDefault();
event.stopPropagation();
this.$refs["modal"].show();
},
},
inject: ["emitActiveShow", "emitItemClick", "emitItemUpdate"],
};
</script>

View File

@@ -0,0 +1,42 @@
<template>
<component
:is="tag"
v-bind="[isRouterLink ? { to: href } : { href: href }, attributes]"
:tabindex="item.disabled && -1"
:target="target"
>
<slot />
</component>
</template>
<script>
export default {
name: "CustomSidebarMenuLink",
props: {
item: {
type: Object,
required: true
},
attributes: {
type: Object,
default: null
},
},
computed: {
isRouterLink() {
return !!this.$router && this.item.href && !this.item.external;
},
tag() {
return this.isRouterLink ? "router-link" : "a";
},
href() {
if (!this.item.href) return "#";
return this.item.href;
},
target() {
if (this.item.external) return "_blank";
return "_self";
}
}
};
</script>

View File

@@ -5,48 +5,14 @@
class="v-inline"
v-show="showActions"
>
<div class="buttonGroup" @focus="hidebuttonsAction()">
<div class="buttonGroup">
<b-button
v-if="data.showClaim"
v-for="item in data.buttons"
:key="item.name"
variant="outline-info"
@click="claimCase"
@click="executeFunction(item.fn)"
>
<i class="fas fa-briefcase"></i>
</b-button>
<b-button
v-if="data.showOpen"
variant="outline-info"
@click="openCase"
>
<i class="far fa-edit"></i>
</b-button>
<b-button
v-show="data.showPlay"
variant="outline-info"
@click="unPauseCase"
>
<i class="far fa-play-circle"></i>
</b-button>
<b-button
v-show="data.showPause"
variant="outline-info"
@click="pauseCase"
>
<i class="far fa-pause-circle"></i>
</b-button>
<b-button
v-show="data.showReassign"
variant="outline-info"
@click="reassingCase"
>
<i class="fas fa-redo"></i>
</b-button>
<b-button
v-show="data.showNote"
variant="outline-info"
@click="openCaseNote"
>
<i class="far fa-comments"></i>
<i :class="item.icon"></i>
</b-button>
</div>
</div>
@@ -71,6 +37,14 @@ export default {
}
},
methods: {
/**
* Callback function from parent
*/
executeFunction(fn) {
if (fn) {
fn();
}
},
/**
* Show the action buttons by row
*/
@@ -95,54 +69,6 @@ export default {
this.$parent.$parent.$parent.$children[i].$el.style.opacity = 1
}
},
/**
* Call the event to reassign a case
*/
reassingCase() {
this.hideActionButtons();
console.log("Action Reassing Case");
console.log(this.data);
},
/**
* Call the event to open a case
*/
openCase() {
this.hideActionButtons();
console.log("Action Open Case");
console.log(this.data);
},
/**
* Call the event to unpause a case
*/
unPauseCase() {
this.hideActionButtons();
console.log("Action Unpause Case");
console.log(this.data);
},
/**
* Call the event to pause a case
*/
pauseCase() {
this.hideActionButtons();
console.log("Action Pause Case");
console.log(this.data);
},
/**
* Call the event to open case note
*/
openCaseNote() {
this.hideActionButtons();
console.log("Action Case Note");
console.log(this.data);
},
/**
* Call the event to claim a case
*/
claimCase() {
this.hideActionButtons();
console.log("Action Claim Case");
console.log(this.data);
}
}
}
</script>

View File

@@ -123,7 +123,10 @@ export default {
"PAUSED": this.$i18n.t("ID_PAUSED"),
"UNASSIGNED": this.$i18n.t("ID_UNASSIGNED")
},
dataEllipsis: null,
dataEllipsis: {
buttons: {}
},
showEllipsis: false
};
},
created() {
@@ -131,7 +134,6 @@ export default {
},
mounted() {
this.openDefaultCase();
this.setDataEllipsis();
},
watch: {},
computed: {
@@ -329,33 +331,28 @@ export default {
this.$refs["vueTable"].getData();
},
/**
* set data by default in the ellipsis component
*/
setDataEllipsis() {
this.dataEllipsis = {
showNote: false,
showReassign: false,
showPause: false,
showPlay: false,
showOpen: false,
showClaim: false
}
},
/**
*
* Show options in the ellipsis
*/
updateDataEllipsis(data) {
this.dataEllipsis = {
APP_UID: data.APP_UID || "",
PRO_UID: data.PRO_UID || "",
showOpen: true,
showNote: true,
showPlay: false,
showReassign: false,
showPause: false,
showClaim: false
};
}
let that = this;
this.showEllipsis = !this.showEllipsis;
if (this.showEllipsis) {
this.dataEllipsis = {
buttons: {
open: {
name: "open",
icon: "far fa-edit",
fn: function() {console.log(data.APP_UID);}
},
note: {
name: "case note",
icon: "far fa-comments",
fn: function() {console.log("comments");}
},
}
}
}
},
},
};
</script>

View File

@@ -142,7 +142,10 @@ export default {
"PAUSED": this.$i18n.t("ID_PAUSED"),
"UNASSIGNED": this.$i18n.t("ID_UNASSIGNED")
},
dataEllipsis: null,
dataEllipsis: {
buttons: {}
},
showEllipsis: false
};
},
created() {
@@ -151,7 +154,6 @@ export default {
mounted() {
// force to open case
this.openDefaultCase();
this.setDataEllipsis();
},
watch: {},
computed: {
@@ -360,33 +362,33 @@ export default {
this.$refs["vueTable"].getData();
},
/**
* set data by default in the ellipsis component
*/
setDataEllipsis() {
this.dataEllipsis = {
showNote: false,
showReassign: false,
showPause: false,
showPlay: false,
showOpen: false,
showClaim: false
}
},
/**
*
* Show options in the ellipsis
*/
updateDataEllipsis(data) {
this.dataEllipsis = {
APP_UID: data.APP_UID || "",
PRO_UID: data.PRO_UID || "",
showOpen: false,
showNote: true,
showPlay: true,
showReassign: true,
showPause: false,
showClaim: false
};
}
let that = this;
this.showEllipsis = !this.showEllipsis;
if (this.showEllipsis) {
this.dataEllipsis = {
buttons: {
note: {
name: "case note",
icon: "far fa-comments",
fn: function() {console.log("comments");}
},
play: {
name: "play case",
icon: "far fa-play-circle",
fn: function() {console.log("play case");}
},
reassign: {
name: "reassign case",
icon: "fas fa-redo",
fn: function() {console.log("reassign case");}
}
}
}
}
},
},
};
</script>

View File

@@ -139,7 +139,10 @@ export default {
"PAUSED": this.$i18n.t("ID_PAUSED"),
"UNASSIGNED": this.$i18n.t("ID_UNASSIGNED")
},
dataEllipsis: null
dataEllipsis: {
buttons: {}
},
showEllipsis: false
};
},
created() {
@@ -148,7 +151,6 @@ export default {
mounted() {
// force to open case
this.openDefaultCase();
this.setDataEllipsis();
},
watch: {},
computed: {
@@ -354,33 +356,33 @@ export default {
this.$refs["vueTable"].getData();
},
/**
* set data by default in the ellipsis component
*/
setDataEllipsis() {
this.dataEllipsis = {
showNote: false,
showReassign: false,
showPause: false,
showPlay: false,
showOpen: false,
showClaim: false
}
},
/**
*
* Show options in the ellipsis
*/
updateDataEllipsis(data) {
this.dataEllipsis = {
APP_UID: data.APP_UID || "",
PRO_UID: data.PRO_UID || "",
showOpen: true,
showNote: true,
showPlay: false,
showReassign: true,
showPause: true,
showClaim: false
};
}
let that = this;
this.showEllipsis = !this.showEllipsis;
if (this.showEllipsis) {
this.dataEllipsis = {
buttons: {
open: {
name: "open",
icon: "far fa-edit",
fn: function() {console.log(data.APP_UID);}
},
note: {
name: "case note",
icon: "far fa-comments",
fn: function() {console.log("comments");}
},
pause: {
name: "pause case",
icon: "far fa-pause-circle",
fn: function() {console.log("pause case");}
}
}
}
}
},
},
};
</script>

View File

@@ -140,12 +140,14 @@ export default {
"PAUSED": this.$i18n.t("ID_PAUSED"),
"UNASSIGNED": this.$i18n.t("ID_UNASSIGNED")
},
dataEllipsis: null,
dataEllipsis: {
buttons: {}
},
showEllipsis: false
};
},
mounted() {
this.initFilters();
this.setDataEllipsis();
},
watch: {},
computed: {
@@ -338,29 +340,39 @@ export default {
*/
setDataEllipsis() {
this.dataEllipsis = {
showNote: false,
showReassign: false,
showPause: false,
showPlay: false,
showOpen: false,
showClaim: false
showNote: true,
showPause: true,
showClaim: true
}
},
/**
*
* Show options in the ellipsis
*/
updateDataEllipsis(data) {
this.dataEllipsis = {
APP_UID: data.APP_UID || "",
PRO_UID: data.PRO_UID || "",
showOpen: false,
showNote: true,
showPlay: false,
showReassign: false,
showPause: true,
showClaim: true
};
}
let that = this;
this.showEllipsis = !this.showEllipsis;
if (this.showEllipsis) {
this.dataEllipsis = {
buttons: {
note: {
name: "case note",
icon: "far fa-comments",
fn: function() {console.log("comments");}
},
pause: {
name: "pause case",
icon: "far fa-pause-circle",
fn: function() {console.log("pause case");}
},
claim: {
name: "claim case",
icon: "fas fa-briefcase",
fn: function() {console.log("claim case");}
}
}
}
}
},
},
};
</script>

View File

@@ -4,6 +4,7 @@ import VueSidebarMenu from "vue-sidebar-menu";
import VueI18n from 'vue-i18n';
import { BootstrapVue, BootstrapVueIcons } from 'bootstrap-vue';
import { ServerTable, Event, ClientTable} from 'vue-tables-2';
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';
@@ -16,6 +17,7 @@ Vue.use(VueSidebarMenu);
Vue.use(BootstrapVue);
Vue.use(BootstrapVueIcons);
Vue.use(VueI18n);
Vue.use(ServerTable, {}, false, 'bootstrap3', {});
Vue.use(ClientTable, {}, false, 'bootstrap3', {});
window.ProcessMaker = {

View File

@@ -156,6 +156,49 @@ class DraftTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_filter_by_specific_cases()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$draft = new Draft();
$draft->setUserId($cases['USR_ID']);
$draft->setCasesNumbers([$cases['APP_NUMBER']]);
$draft->setOrderByColumn('APP_NUMBER');
$res = $draft->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Draft::filters()
* @test
*/
public function it_filter_by_range_cases()
{
// Create factories related to the draft cases
$cases = $this->createDraft();
// Create new Draft object
$draft = new Draft();
$draft->setUserId($cases['USR_ID']);
$rangeOfCases = $cases['APP_NUMBER'] . "-" . $cases['APP_NUMBER'];
$draft->setRangeCasesFromTo([$rangeOfCases]);
$draft->setOrderByColumn('APP_NUMBER');
$res = $draft->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with taskId filter
*

View File

@@ -150,6 +150,49 @@ class InboxTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_filter_by_specific_cases()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
$inbox->setUserId($cases->USR_ID);
$inbox->setCasesNumbers([$cases->APP_NUMBER]);
$inbox->setOrderByColumn('APP_NUMBER');
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
* @test
*/
public function it_filter_by_range_cases()
{
// Create factories related to the to_do cases
$cases = $this->createInbox();
// Create new Inbox object
$inbox = new Inbox();
$inbox->setUserId($cases->USR_ID);
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
$inbox->setRangeCasesFromTo([$rangeOfCases]);
$inbox->setOrderByColumn('APP_NUMBER');
$res = $inbox->getData();
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with taskId filter
*

View File

@@ -116,6 +116,7 @@ class ParticipatedTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCaseStatus()
* @test
*/
public function it_filter_by_started_by_me()
@@ -128,6 +129,8 @@ class ParticipatedTest extends TestCase
$participated->setUserUid($cases->USR_UID);
// Set the user ID
$participated->setUserId($cases->USR_ID);
// Get only the TO_DO
$participated->setCaseStatus(2);
// Set the filter STARTED
$participated->setParticipatedStatus('STARTED');
// Set OrderBYColumn value
@@ -172,6 +175,7 @@ class ParticipatedTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setProcessId()
* @test
*/
public function it_filter_by_process()
@@ -196,12 +200,76 @@ class ParticipatedTest extends TestCase
$this->assertEquals(2, count($res));
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCasesNumbers()
* @test
*/
public function it_filter_by_specific_cases()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the filter
$participated->setFilterCases('STARTED');
// Set the user UID
$participated->setUserUid($cases['USR_UID']);
// Set the user ID
$participated->setUserId($cases['USR_ID']);
// Set the case numbers
$participated->setCasesNumbers([$cases['APP_NUMBER']]);
// Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(2, count($res));
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setRangeCasesFromTo()
* @test
*/
public function it_filter_by_range_cases()
{
// Create factories related to the participated cases
$cases = $this->createParticipated();
// Create new Participated object
$participated = new Participated();
// Set the filter
$participated->setFilterCases('STARTED');
// Set the user UID
$participated->setUserUid($cases['USR_UID']);
// Set the user ID
$participated->setUserId($cases['USR_ID']);
// Set the range of case numbers
$rangeOfCases = $cases['APP_NUMBER'] . "-" . $cases['APP_NUMBER'];
$participated->setRangeCasesFromTo([$rangeOfCases]);
// Set OrderBYColumn value
$participated->setOrderByColumn('APP_NUMBER');
// Call to getData method
$res = $participated->getData();
// This assert that the expected numbers of results are returned
$this->assertEquals(2, count($res));
}
/**
* It tests the getData method with processId filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Participated::setCaseTitle()
* @test
*/
public function it_filter_by_thread_title()

View File

@@ -241,6 +241,32 @@ class PausedTest extends TestCase
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with case number filter
*
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
* @test
*/
public function it_filter_by_specific_cases()
{
// Create factories related to the paused cases
$cases = $this->createPaused();
//Create new Paused object
$paused = new Paused();
//Set the user UID
$paused->setUserUid($cases->USR_UID);
//Set the user ID
$paused->setUserId($cases->USR_ID);
//Set app number
$paused->setCasesNumbers([$cases->APP_NUMBER]);
//Call to getData method
$res = $paused->getData();
//This asserts there are results for the filtered app number
$this->assertNotEmpty($res);
}
/**
* It tests the getData method with taskId filter
*

View File

@@ -351,11 +351,11 @@ class SupervisingTest extends TestCase
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
//Set the user ID
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
//Call the getData method
// Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(3, $res);
@@ -373,11 +373,11 @@ class SupervisingTest extends TestCase
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
// Set the user UID
$Supervising->setUserUid($user->USR_UID);
//Set the user ID
// Set the user ID
$Supervising->setUserId($user->USR_ID);
//Call the getData method
// Call the getData method
$res = $Supervising->getData();
// Asserts the result
$this->assertEmpty($res);
@@ -394,13 +394,13 @@ class SupervisingTest extends TestCase
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
//Set the user ID
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
//Call the getCounter method
// Call the getCounter method
$res = $Supervising->getCounter();
//Assert the counter
// Assert the counter
$this->assertEquals(3, $res);
}
@@ -410,6 +410,7 @@ class SupervisingTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseNumber()
* @test
*/
public function it_filter_by_app_number()
@@ -417,16 +418,74 @@ class SupervisingTest extends TestCase
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
//Set the user UID
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
//Set the user ID
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
// Set the case number
$Supervising->setCaseNumber($cases->APP_NUMBER);
//Call the getData method
// Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(1, $res);
//Asserts that the result contains the app number searched
// Asserts that the result contains the app number searched
$this->assertContains($cases->APP_NUMBER, $res[0]);
}
/**
* Tests the filter by APP_NUMBER
*
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseNumber()
* @test
*/
public function it_filter_by_specific_cases()
{
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
// Set the case numbers
$Supervising->setCasesNumbers([$cases->APP_NUMBER]);
// Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(1, $res);
// Asserts that the result contains the app number searched
$this->assertContains($cases->APP_NUMBER, $res[0]);
}
/**
* Tests the filter by APP_NUMBER
*
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setRangeCasesFromTo()
* @test
*/
public function it_filter_by_range_cases()
{
$cases = $this->createSupervising();
// Instance the Supervising object
$Supervising = new Supervising();
// Set the user UID
$Supervising->setUserUid($cases->USR_UID);
// Set the user ID
$Supervising->setUserId($cases->USR_ID);
// Set the range of case numbers
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
$Supervising->setRangeCasesFromTo([$rangeOfCases]);
// Call the getData method
$res = $Supervising->getData();
// Asserts the result contains 3 registers
$this->assertCount(1, $res);
// Asserts that the result contains the app number searched
$this->assertContains($cases->APP_NUMBER, $res[0]);
}
@@ -436,6 +495,7 @@ class SupervisingTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setProcessId()
* @test
*/
public function it_filter_by_process()
@@ -460,6 +520,7 @@ class SupervisingTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setTaskId()
* @test
*/
public function it_filter_by_task()
@@ -484,6 +545,7 @@ class SupervisingTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setCaseTitle()
* @test
*/
public function it_filter_by_thread_title()
@@ -515,6 +577,7 @@ class SupervisingTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getData()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::getColumnsView()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::filters()
* @covers \ProcessMaker\BusinessModel\Cases\Supervising::setOrderByColumn()
* @test
*/
public function it_order_by_column()

View File

@@ -4368,6 +4368,21 @@ class WorkspaceTools
$con->commit();
CLI::logging("-> Populating APP_ASSIGN_SELF_SERVICE_VALUE.TAS_ID Done \n");
// Populating PROCESS.CATEGORY_ID
CLI::logging("-> Populating PROCESS.CATEGORY_ID \n");
$con->begin();
$stmt = $con->createStatement();
$rs = $stmt->executeQuery("UPDATE PROCESS
INNER JOIN (
SELECT PROCESS_CATEGORY.CATEGORY_UID, PROCESS_CATEGORY.CATEGORY_ID
FROM PROCESS_CATEGORY
) AS CAT
ON (PROCESS.PRO_CATEGORY = CAT.CATEGORY_UID)
SET PROCESS.CATEGORY_ID = CAT.CATEGORY_ID
WHERE PROCESS.CATEGORY_ID = 0");
$con->commit();
CLI::logging("-> Populating PROCESS.CATEGORY_ID Done \n");
// Populating PROCESS_VARIABLES.PRO_ID
CLI::logging("-> Populating PROCESS_VARIABLES.PRO_ID \n");
$con->begin();

View File

@@ -45,7 +45,7 @@ $G_TMP_MENU->AddIdRawOption(
'CASES_SELFSERVICE',
'casesListExtJs?action=selfservice',
G::LoadTranslation('ID_UNASSIGNED'),
'fas fa-crosshairs'
'fas fa-users'
);

View File

@@ -16273,7 +16273,7 @@
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.1.1",
"version": "16.1.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.1.tgz",
"integrity": "sha512-wz/+HFg/3SBayHWAlZXARcnDTl3VOChrfW9YnxvAweiuyKX/7IGx1ad/4yJHmwhgWlOVYMAbTiI7GV8G33PfGQ==",
"dev": true,

View File

@@ -16273,7 +16273,7 @@
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.1.1",
"version": "16.1.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.1.tgz",
"integrity": "sha512-wz/+HFg/3SBayHWAlZXARcnDTl3VOChrfW9YnxvAweiuyKX/7IGx1ad/4yJHmwhgWlOVYMAbTiI7GV8G33PfGQ==",
"dev": true,

View File

@@ -16273,7 +16273,7 @@
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.1.1",
"version": "16.1.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.1.tgz",
"integrity": "sha512-wz/+HFg/3SBayHWAlZXARcnDTl3VOChrfW9YnxvAweiuyKX/7IGx1ad/4yJHmwhgWlOVYMAbTiI7GV8G33PfGQ==",
"dev": true,

View File

@@ -1260,6 +1260,10 @@ class AbstractCases implements CasesInterface
if (!empty($properties['caseNumber'])) {
$this->setCaseNumber($properties['caseNumber']);
}
// Add a filter with specific cases or range of cases like '1, 3-5, 8, 10-15'
if (!empty($properties['filterCases'])) {
$this->setFilterCases($properties['filterCases']);
}
// Filter by case title
if (!empty($properties['caseTitle'])) {
$this->setCaseTitle($properties['caseTitle']);
@@ -1290,10 +1294,6 @@ class AbstractCases implements CasesInterface
$this->setFinishCaseTo($properties['finishCaseTo']);
}
/** Apply filters related to SEARCH */
// Add a filter with specific cases or range of cases like '1, 3-5, 8, 10-15'
if (get_class($this) === Search::class && !empty($properties['filterCases'])) {
$this->setFilterCases($properties['filterCases']);
}
// Filter by more than one case statuses like ['DRAFT', 'TO_DO']
if (get_class($this) === Search::class && !empty($properties['caseStatuses'])) {
$this->setCaseStatuses($properties['caseStatuses']);

View File

@@ -47,6 +47,18 @@ class Draft extends AbstractCases
if ($this->getCaseNumber()) {
$query->case($this->getCaseNumber());
}
// Filter only cases by specific cases like [1,3,5]
if (!empty($this->getCasesNumbers()) && empty($this->getRangeCasesFromTo())) {
$query->specificCases($this->getCasesNumbers());
}
// Filter only cases by range of cases like ['1-5', '10-15']
if (!empty($this->getRangeCasesFromTo()) && empty($this->getCasesNumbers())) {
$query->rangeOfCases($this->getRangeCasesFromTo());
}
// Filter cases mixed by range of cases and specific cases like '1,3-5,8'
if (!empty($this->getCasesNumbers()) && !empty($this->getRangeCasesFromTo())) {
$query->casesOrRangeOfCases($this->getCasesNumbers(), $this->getRangeCasesFromTo());
}
// Specific case title
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());

View File

@@ -50,6 +50,18 @@ class Inbox extends AbstractCases
if ($this->getCaseNumber()) {
$query->case($this->getCaseNumber());
}
// Filter only cases by specific cases like [1,3,5]
if (!empty($this->getCasesNumbers()) && empty($this->getRangeCasesFromTo())) {
$query->specificCases($this->getCasesNumbers());
}
// Filter only cases by range of cases like ['1-5', '10-15']
if (!empty($this->getRangeCasesFromTo()) && empty($this->getCasesNumbers())) {
$query->rangeOfCases($this->getRangeCasesFromTo());
}
// Filter cases mixed by range of cases and specific cases like '1,3-5,8'
if (!empty($this->getCasesNumbers()) && !empty($this->getRangeCasesFromTo())) {
$query->casesOrRangeOfCases($this->getCasesNumbers(), $this->getRangeCasesFromTo());
}
// Specific case title
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());

View File

@@ -52,6 +52,18 @@ class Participated extends AbstractCases
if ($this->getCaseNumber()) {
$query->case($this->getCaseNumber());
}
// Filter only cases by specific cases like [1,3,5]
if (!empty($this->getCasesNumbers()) && empty($this->getRangeCasesFromTo())) {
$query->specificCases($this->getCasesNumbers());
}
// Filter only cases by range of cases like ['1-5', '10-15']
if (!empty($this->getRangeCasesFromTo()) && empty($this->getCasesNumbers())) {
$query->rangeOfCases($this->getRangeCasesFromTo());
}
// Filter cases mixed by range of cases and specific cases like '1,3-5,8'
if (!empty($this->getCasesNumbers()) && !empty($this->getRangeCasesFromTo())) {
$query->casesOrRangeOfCases($this->getCasesNumbers(), $this->getRangeCasesFromTo());
}
// Specific case title
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());

View File

@@ -49,6 +49,18 @@ class Paused extends AbstractCases
if ($this->getCaseNumber()) {
$query->case($this->getCaseNumber());
}
// Filter only cases by specific cases like [1,3,5]
if (!empty($this->getCasesNumbers()) && empty($this->getRangeCasesFromTo())) {
$query->specificCases($this->getCasesNumbers());
}
// Filter only cases by range of cases like ['1-5', '10-15']
if (!empty($this->getRangeCasesFromTo()) && empty($this->getCasesNumbers())) {
$query->rangeOfCases($this->getRangeCasesFromTo());
}
// Filter cases mixed by range of cases and specific cases like '1,3-5,8'
if (!empty($this->getCasesNumbers()) && !empty($this->getRangeCasesFromTo())) {
$query->casesOrRangeOfCases($this->getCasesNumbers(), $this->getRangeCasesFromTo());
}
// Specific case title
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());

View File

@@ -48,14 +48,18 @@ class Search extends AbstractCases
if ($this->getCaseNumber()) {
$query->case($this->getCaseNumber());
}
// Filter cases by specific cases like [1,3,5]
if (!empty($this->getCasesNumbers())) {
// Filter only cases by specific cases like [1,3,5]
if (!empty($this->getCasesNumbers()) && empty($this->getRangeCasesFromTo())) {
$query->specificCases($this->getCasesNumbers());
}
// Filter cases by range of cases like ['1-5', '10-15']
if (!empty($this->getRangeCasesFromTo())) {
// Filter only cases by range of cases like ['1-5', '10-15']
if (!empty($this->getRangeCasesFromTo()) && empty($this->getCasesNumbers())) {
$query->rangeOfCases($this->getRangeCasesFromTo());
}
// Filter cases mixed by range of cases and specific cases like '1,3-5,8'
if (!empty($this->getCasesNumbers()) && !empty($this->getRangeCasesFromTo())) {
$query->casesOrRangeOfCases($this->getCasesNumbers(), $this->getRangeCasesFromTo());
}
// Specific case title
if (!empty($this->getCaseTitle())) {
// Join with delegation

View File

@@ -49,6 +49,18 @@ class Supervising extends AbstractCases
if ($this->getCaseNumber()) {
$query->case($this->getCaseNumber());
}
// Filter only cases by specific cases like [1,3,5]
if (!empty($this->getCasesNumbers()) && empty($this->getRangeCasesFromTo())) {
$query->specificCases($this->getCasesNumbers());
}
// Filter only cases by range of cases like ['1-5', '10-15']
if (!empty($this->getRangeCasesFromTo()) && empty($this->getCasesNumbers())) {
$query->rangeOfCases($this->getRangeCasesFromTo());
}
// Filter cases mixed by range of cases and specific cases like '1,3-5,8'
if (!empty($this->getCasesNumbers()) && !empty($this->getRangeCasesFromTo())) {
$query->casesOrRangeOfCases($this->getCasesNumbers(), $this->getRangeCasesFromTo());
}
// Specific case title
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());

View File

@@ -50,6 +50,18 @@ class Unassigned extends AbstractCases
if ($this->getCaseNumber()) {
$query->case($this->getCaseNumber());
}
// Filter only cases by specific cases like [1,3,5]
if (!empty($this->getCasesNumbers()) && empty($this->getRangeCasesFromTo())) {
$query->specificCases($this->getCasesNumbers());
}
// Filter only cases by range of cases like ['1-5', '10-15']
if (!empty($this->getRangeCasesFromTo()) && empty($this->getCasesNumbers())) {
$query->rangeOfCases($this->getRangeCasesFromTo());
}
// Filter cases mixed by range of cases and specific cases like '1,3-5,8'
if (!empty($this->getCasesNumbers()) && !empty($this->getRangeCasesFromTo())) {
$query->casesOrRangeOfCases($this->getCasesNumbers(), $this->getRangeCasesFromTo());
}
// Specific case title
if ($this->getCaseTitle()) {
$query->title($this->getCaseTitle());

View File

@@ -135,18 +135,49 @@ class Application extends Model
*/
public function scopeRangeOfCases($query, array $rangeCases)
{
foreach ($rangeCases as $fromTo) {
$fromTo = explode("-", $fromTo);
if (count($fromTo) === 2) {
$from = $fromTo[0];
$to = $fromTo[1];
if ($to > $from) {
$query->orWhere(function ($query) use ($from, $to) {
$query->casesFrom($from)->casesTo($to);
});
$query->where(function ($query) use ($rangeCases) {
foreach ($rangeCases as $fromTo) {
$fromTo = explode("-", $fromTo);
if (count($fromTo) === 2) {
$from = $fromTo[0];
$to = $fromTo[1];
if ($to > $from) {
$query->orWhere(function ($query) use ($from, $to) {
$query->casesFrom($from)->casesTo($to);
});
}
}
}
}
});
}
/**
* Scope more than one range of cases
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param array $cases
* @param array $rangeCases
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCasesOrRangeOfCases($query, array $cases, array $rangeCases)
{
$query->where(function ($query) use ($cases, $rangeCases) {
// Get the cases related to the task self service
$query->specificCases($cases);
foreach ($rangeCases as $fromTo) {
$fromTo = explode("-", $fromTo);
if (count($fromTo) === 2) {
$from = $fromTo[0];
$to = $fromTo[1];
if ($to > $from) {
$query->orWhere(function ($query) use ($from, $to) {
$query->casesFrom($from)->casesTo($to);
});
}
}
}
});
}
/**

View File

@@ -488,18 +488,49 @@ class Delegation extends Model
*/
public function scopeRangeOfCases($query, array $rangeCases)
{
foreach ($rangeCases as $fromTo) {
$fromTo = explode("-", $fromTo);
if (count($fromTo) === 2) {
$from = $fromTo[0];
$to = $fromTo[1];
if ($to > $from) {
$query->orWhere(function ($query) use ($from, $to) {
$query->casesFrom($from)->casesTo($to);
});
$query->where(function ($query) use ($rangeCases) {
foreach ($rangeCases as $fromTo) {
$fromTo = explode("-", $fromTo);
if (count($fromTo) === 2) {
$from = $fromTo[0];
$to = $fromTo[1];
if ($to > $from) {
$query->orWhere(function ($query) use ($from, $to) {
$query->casesFrom($from)->casesTo($to);
});
}
}
}
}
});
}
/**
* Scope more than one range of cases
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param array $cases
* @param array $rangeCases
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCasesOrRangeOfCases($query, array $cases, array $rangeCases)
{
$query->where(function ($query) use ($cases, $rangeCases) {
// Get the cases related to the task self service
$query->specificCases($cases);
foreach ($rangeCases as $fromTo) {
$fromTo = explode("-", $fromTo);
if (count($fromTo) === 2) {
$from = $fromTo[0];
$to = $fromTo[1];
if ($to > $from) {
$query->orWhere(function ($query) use ($from, $to) {
$query->casesFrom($from)->casesTo($to);
});
}
}
}
});
}
/**
@@ -1924,10 +1955,8 @@ class Delegation extends Model
'TASK.TAS_ASSIGN_TYPE', // Task assign rule
'APP_DELEGATION.DEL_TITLE', // Thread title
'APP_DELEGATION.DEL_THREAD_STATUS', // Thread status
'APP_DELEGATION.USR_UID', // Current UserUid
'APP_DELEGATION.USR_ID', // Current UserId
'USERS.USR_USERNAME', // Current UserName
'USERS.USR_FIRSTNAME', // Current User FirstName
'USERS.USR_LASTNAME', // Current User LastName
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
// Additional column for other functionalities
'APP_DELEGATION.APP_UID', // Case Uid for Open case
@@ -1937,8 +1966,6 @@ class Delegation extends Model
]);
// Join with task
$query->joinTask();
// Join with task
$query->joinUser();
// Get the open threads
$query->threadOpen();
// Related to the specific case number
@@ -1950,6 +1977,12 @@ class Delegation extends Model
$item['TAS_COLOR'] = $abs->getTaskColor($item['DEL_TASK_DUE_DATE']);
$item['TAS_COLOR_LABEL'] = AbstractCases::TASK_COLORS[$item['TAS_COLOR']];
$item['UNASSIGNED'] = ($item['TAS_ASSIGN_TYPE'] === 'SELF_SERVICE' ? true : false);
$userInfo = User::getInformation($item['USR_ID']);
$item['user_tooltip'] = $userInfo;
$item['USR_USERNAME'] = !empty($userInfo['usr_username']) ? $userInfo['usr_username'] : '';
$item['USR_LASTNAME'] = !empty($userInfo['usr_lastname']) ? $userInfo['usr_lastname'] : '';
$item['USR_FIRSTNAME'] = !empty($userInfo['usr_firstname']) ? $userInfo['usr_firstname'] : '';
return $item;
});

View File

@@ -50,6 +50,7 @@ class Home extends Api
* @param int $process
* @param int $task
* @param string $caseTitle
* @param string $filterCases
* @param string $paged
* @param string $sort
*
@@ -65,6 +66,7 @@ class Home extends Api
int $process = 0,
int $task = 0,
string $caseTitle = '',
string $filterCases = '',
string $paged = '0,15',
string $sort = 'APP_NUMBER,DESC'
) {
@@ -74,6 +76,7 @@ class Home extends Api
$properties = [];
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -105,6 +108,7 @@ class Home extends Api
* @param int $process
* @param int $task
* @param string $caseTitle
* @param string $filterCases
* @param string $paged
* @param string $sort
*
@@ -120,6 +124,7 @@ class Home extends Api
int $process = 0,
int $task = 0,
string $caseTitle = '',
string $filterCases = '',
string $paged = '0,15',
string $sort = 'APP_NUMBER,DESC'
) {
@@ -129,6 +134,7 @@ class Home extends Api
$properties = [];
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -160,6 +166,7 @@ class Home extends Api
* @param int $process
* @param int $task
* @param string $caseTitle
* @param string $filterCases
* @param string $paged
* @param string $sort
*
@@ -175,6 +182,7 @@ class Home extends Api
int $process = 0,
int $task = 0,
string $caseTitle = '',
string $filterCases = '',
string $paged = '0,15',
string $sort = 'APP_NUMBER,DESC'
) {
@@ -184,6 +192,7 @@ class Home extends Api
$properties = [];
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -217,6 +226,7 @@ class Home extends Api
* @param int $process
* @param int $task
* @param string $caseTitle
* @param string $filterCases
* @param string $paged
* @param string $sort
*
@@ -232,6 +242,7 @@ class Home extends Api
int $process = 0,
int $task = 0,
string $caseTitle = '',
string $filterCases = '',
string $paged = '0,15',
string $sort = 'APP_NUMBER,DESC'
) {
@@ -241,6 +252,7 @@ class Home extends Api
$properties = [];
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -272,6 +284,7 @@ class Home extends Api
* @param int $process
* @param int $task
* @param string $caseTitle
* @param string $filterCases
* @param string $filter
* @param string $caseStatus
* @param string $startCaseFrom
@@ -293,6 +306,7 @@ class Home extends Api
int $process = 0,
int $task = 0,
string $caseTitle = '',
string $filterCases = '',
string $filter = 'IN_PROGRESS',
string $caseStatus = '',
string $startCaseFrom = '',
@@ -306,6 +320,7 @@ class Home extends Api
$properties = [];
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -570,18 +585,19 @@ class Home extends Api
/**
* Get the search cases
*
* @url GET /:app_number/pending-tasks
* @url GET /:appNumber/pending-tasks
*
* @param int $app_number
* @param int $appNumber
*
* @return array
*
* @access protected
* @class AccessControl {@permission PM_CASES}
*/
public function getPendingTasks(int $app_number)
public function getPendingTasks(int $appNumber)
{
$result = Delegation::getPendingTask($app_number);
// Get the pending task
$result = Delegation::getPendingTask($appNumber);
return $result;
}