PMCORE-1216

This commit is contained in:
Paula Quispe
2020-10-16 15:53:54 -04:00
parent 415b3f19df
commit 2e76cfdeae
15 changed files with 621 additions and 28 deletions

View File

@@ -465,6 +465,16 @@ class AbstractCases implements CasesInterface
$this->oldestThan = $oldestThan;
}
/**
* Get Oldest Than value
*
* @return string
*/
public function getOldestThan()
{
return $this->oldestThan;
}
/**
* Set order by column
*
@@ -488,16 +498,6 @@ class AbstractCases implements CasesInterface
return $this->orderByColumn;
}
/**
* Get Oldest Than value
*
* @return string
*/
public function getOldestThan()
{
return $this->oldestThan;
}
/**
* Set order direction
*

View File

@@ -3,11 +3,9 @@
namespace ProcessMaker\BusinessModel\Cases;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
class Inbox extends AbstractCases
{
/**
* Get the data corresponding to List Inbox
*
@@ -39,7 +37,7 @@ class Inbox extends AbstractCases
break;
}
if ($this->getProcessId() != '') {
if (!empty($this->getProcessId())) {
// Scope to search for an specific process
$query->processId($this->getProcessId());
}

View File

@@ -0,0 +1,63 @@
<?php
namespace ProcessMaker\BusinessModel\Cases;
use ProcessMaker\Model\Delegation;
class Reassign extends AbstractCases
{
/**
* Get the data corresponding to Reassign
*
* @return array
*/
public function getData()
{
// Start the query for get the cases related to the user
$query = Delegation::query()->select();
// Scope that sets the queries for reassign
if (!empty($this->getUserId())) {
$query->inbox($this->getUserId());
}
// Scope to search for an specific process
if (!empty($this->getProcessId())) {
$query->processId($this->getProcessId());
}
// The order by clause
$query->orderBy($this->getOrderByColumn(), $this->getOrderDirection());
// The limit by clause
$query->offset($this->getOffset())->limit($this->getLimit());
// Execute the query
$results = $query->get();
// Return the values as an array format
return $results->values()->toArray();
}
/**
* Get the number of rows corresponding to the List Inbox
*
* @return int
*/
public function getCounter()
{
$query = Delegation::query()->select();
// Scope that sets the queries for reassign
if (!empty($this->getUserId())) {
$query->inbox($this->getUserId());
} else {
// Scope that sets the queries for List Inbox
$query->inboxWithoutUser();
}
// Return the number of rows
return $query->count();
}
}