PMCORE-1216
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListCompletedPeer extends BaseListCompletedPeer {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ require_once 'classes/model/om/BaseListMyInbox.php';
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListMyInbox extends BaseListMyInbox implements ListInterface
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListMyInboxPeer extends BaseListMyInboxPeer {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ require_once 'classes/model/om/BaseListParticipatedHistory.php';
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListParticipatedHistory extends BaseListParticipatedHistory implements ListInterface
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListParticipatedHistoryPeer extends BaseListParticipatedHistoryPeer {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ require_once 'classes/model/om/BaseListUnassignedGroup.php';
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListUnassignedGroup extends BaseListUnassignedGroup
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
* @deprecated Method deprecated in Release 3.6.0
|
||||
*/
|
||||
class ListUnassignedGroupPeer extends BaseListUnassignedGroupPeer {
|
||||
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -78,6 +78,30 @@ class Delegation extends Model
|
||||
return $query->where('DEL_INDEX', '=', $index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to get the started by me
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeCaseStarted($query)
|
||||
{
|
||||
return $query->where('DEL_INDEX', '=', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to get the completed by me
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeCaseCompleted($query)
|
||||
{
|
||||
return $query->appStatusId(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include a specific delegate date
|
||||
*
|
||||
@@ -190,6 +214,17 @@ class Delegation extends Model
|
||||
return $query->where('APP_DELEGATION.DEL_THREAD_STATUS', '=', 'OPEN');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to get the last thread
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeLastThread($query)
|
||||
{
|
||||
return $query->where('APP_DELEGATION.DEL_LAST_INDEX', '=', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include threads without user
|
||||
*
|
||||
@@ -411,6 +446,27 @@ class Delegation extends Model
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope the Inbox cases
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeInboxWithoutUser($query)
|
||||
{
|
||||
// This scope is for the join with the APP_DELEGATION table
|
||||
$query->appStatusId(2);
|
||||
|
||||
// Scope for the restriction of the task that must not be searched for
|
||||
$query->excludeTaskTypes(Task::DUMMY_TASKS);
|
||||
|
||||
// Scope that establish that the DEL_THREAD_STATUS must be OPEN
|
||||
$query->threadOpen();
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a self service cases
|
||||
*
|
||||
@@ -449,6 +505,24 @@ class Delegation extends Model
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a participated cases
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param int $user
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeParticipated($query, $user)
|
||||
{
|
||||
// Scope to set the user
|
||||
$query->userId($user);
|
||||
// Scope to set the last thread
|
||||
$query->lastThread();
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get specific cases unassigned that the user can view
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user