PMCORE-3265 Service support send By filter (inbox, draft, paused, unassigned)
This commit is contained in:
@@ -114,6 +114,9 @@ class AbstractCases implements CasesInterface
|
|||||||
// Filter by specific cases, know as "$appUidCheck" in the old lists classes
|
// Filter by specific cases, know as "$appUidCheck" in the old lists classes
|
||||||
private $casesUids = [];
|
private $casesUids = [];
|
||||||
|
|
||||||
|
// Filter by Send By
|
||||||
|
private $sendBy = '';
|
||||||
|
|
||||||
// Filter range related to the start case date
|
// Filter range related to the start case date
|
||||||
private $startCaseFrom = '';
|
private $startCaseFrom = '';
|
||||||
private $startCaseTo = '';
|
private $startCaseTo = '';
|
||||||
@@ -749,6 +752,26 @@ class AbstractCases implements CasesInterface
|
|||||||
return $this->casesUids;
|
return $this->casesUids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set send by.
|
||||||
|
*
|
||||||
|
* @param type $sendBy
|
||||||
|
*/
|
||||||
|
public function setSendBy(string $sendBy)
|
||||||
|
{
|
||||||
|
$this->sendBy = $sendBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get send by.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSendBy()
|
||||||
|
{
|
||||||
|
return $this->sendBy;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Cases Numbers
|
* Set Cases Numbers
|
||||||
*
|
*
|
||||||
@@ -1381,6 +1404,10 @@ class AbstractCases implements CasesInterface
|
|||||||
if (get_class($this) === Inbox::class && !empty($properties['delegateTo'])) {
|
if (get_class($this) === Inbox::class && !empty($properties['delegateTo'])) {
|
||||||
$this->setDelegateTo($properties['delegateTo']);
|
$this->setDelegateTo($properties['delegateTo']);
|
||||||
}
|
}
|
||||||
|
// Filter by Send By
|
||||||
|
if (get_class($this) === Inbox::class && !empty($properties['sendBy'])) {
|
||||||
|
$this->setSendBy($properties['sendBy']);
|
||||||
|
}
|
||||||
/** Apply filters related to PAUSED */
|
/** Apply filters related to PAUSED */
|
||||||
// Filter date related to delegate from
|
// Filter date related to delegate from
|
||||||
if (get_class($this) === Paused::class && !empty($properties['delegateFrom'])) {
|
if (get_class($this) === Paused::class && !empty($properties['delegateFrom'])) {
|
||||||
@@ -1390,6 +1417,10 @@ class AbstractCases implements CasesInterface
|
|||||||
if (get_class($this) === Paused::class && !empty($properties['delegateTo'])) {
|
if (get_class($this) === Paused::class && !empty($properties['delegateTo'])) {
|
||||||
$this->setDelegateTo($properties['delegateTo']);
|
$this->setDelegateTo($properties['delegateTo']);
|
||||||
}
|
}
|
||||||
|
// Filter by Send By
|
||||||
|
if (get_class($this) === Paused::class && !empty($properties['sendBy'])) {
|
||||||
|
$this->setSendBy($properties['sendBy']);
|
||||||
|
}
|
||||||
/** Apply filters related to UNASSIGNED */
|
/** Apply filters related to UNASSIGNED */
|
||||||
// Filter date related to delegate from
|
// Filter date related to delegate from
|
||||||
if (get_class($this) === Unassigned::class && !empty($properties['delegateFrom'])) {
|
if (get_class($this) === Unassigned::class && !empty($properties['delegateFrom'])) {
|
||||||
@@ -1399,6 +1430,10 @@ class AbstractCases implements CasesInterface
|
|||||||
if (get_class($this) === Unassigned::class && !empty($properties['delegateTo'])) {
|
if (get_class($this) === Unassigned::class && !empty($properties['delegateTo'])) {
|
||||||
$this->setDelegateTo($properties['delegateTo']);
|
$this->setDelegateTo($properties['delegateTo']);
|
||||||
}
|
}
|
||||||
|
// Filter by Send By
|
||||||
|
if (get_class($this) === Unassigned::class && !empty($properties['sendBy'])) {
|
||||||
|
$this->setSendBy($properties['sendBy']);
|
||||||
|
}
|
||||||
|
|
||||||
/** Apply filters related to MY CASES */
|
/** Apply filters related to MY CASES */
|
||||||
// My cases filter: started, in-progress, completed, supervising
|
// My cases filter: started, in-progress, completed, supervising
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class Home
|
|||||||
$sort = explode(',', $sort);
|
$sort = explode(',', $sort);
|
||||||
$properties['sort'] = $sort[0];
|
$properties['sort'] = $sort[0];
|
||||||
$properties['dir'] = $sort[1];
|
$properties['dir'] = $sort[1];
|
||||||
|
$properties['sendBy'] = $sendBy;
|
||||||
$list->setProperties($properties);
|
$list->setProperties($properties);
|
||||||
$result = [];
|
$result = [];
|
||||||
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
||||||
@@ -97,6 +98,7 @@ class Home
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @param callable $callback
|
* @param callable $callback
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -111,6 +113,7 @@ class Home
|
|||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC',
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = '',
|
||||||
callable $callback = null
|
callable $callback = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -133,6 +136,7 @@ class Home
|
|||||||
$sort = explode(',', $sort);
|
$sort = explode(',', $sort);
|
||||||
$properties['sort'] = $sort[0];
|
$properties['sort'] = $sort[0];
|
||||||
$properties['dir'] = $sort[1];
|
$properties['dir'] = $sort[1];
|
||||||
|
$properties['sendBy'] = $sendBy;
|
||||||
$list->setProperties($properties);
|
$list->setProperties($properties);
|
||||||
$result = [];
|
$result = [];
|
||||||
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
||||||
@@ -152,6 +156,7 @@ class Home
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @param callable $callback
|
* @param callable $callback
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -166,6 +171,7 @@ class Home
|
|||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC',
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = '',
|
||||||
callable $callback = null
|
callable $callback = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -188,6 +194,7 @@ class Home
|
|||||||
$sort = explode(',', $sort);
|
$sort = explode(',', $sort);
|
||||||
$properties['sort'] = $sort[0];
|
$properties['sort'] = $sort[0];
|
||||||
$properties['dir'] = $sort[1];
|
$properties['dir'] = $sort[1];
|
||||||
|
$properties['sendBy'] = $sendBy;
|
||||||
// todo: some queries related to the unassigned are using the USR_UID
|
// todo: some queries related to the unassigned are using the USR_UID
|
||||||
$list->setUserUid($usrUid);
|
$list->setUserUid($usrUid);
|
||||||
$list->setProperties($properties);
|
$list->setProperties($properties);
|
||||||
@@ -209,6 +216,7 @@ class Home
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @param callable $callback
|
* @param callable $callback
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -223,6 +231,7 @@ class Home
|
|||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC',
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = '',
|
||||||
callable $callback = null
|
callable $callback = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -245,6 +254,7 @@ class Home
|
|||||||
$sort = explode(',', $sort);
|
$sort = explode(',', $sort);
|
||||||
$properties['sort'] = $sort[0];
|
$properties['sort'] = $sort[0];
|
||||||
$properties['dir'] = $sort[1];
|
$properties['dir'] = $sort[1];
|
||||||
|
$properties['sendBy'] = $sendBy;
|
||||||
$list->setProperties($properties);
|
$list->setProperties($properties);
|
||||||
$result = [];
|
$result = [];
|
||||||
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
||||||
@@ -349,6 +359,7 @@ class Home
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCustomInbox(
|
public function getCustomInbox(
|
||||||
@@ -362,7 +373,8 @@ class Home
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$arguments = func_get_args();
|
$arguments = func_get_args();
|
||||||
@@ -390,6 +402,7 @@ class Home
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCustomUnassigned(
|
public function getCustomUnassigned(
|
||||||
@@ -403,7 +416,8 @@ class Home
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$arguments = func_get_args();
|
$arguments = func_get_args();
|
||||||
@@ -431,6 +445,7 @@ class Home
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCustomPaused(
|
public function getCustomPaused(
|
||||||
@@ -444,7 +459,8 @@ class Home
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$arguments = func_get_args();
|
$arguments = func_get_args();
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ class Inbox extends AbstractCases
|
|||||||
$query->delegateDateTo($this->getDelegateTo());
|
$query->delegateDateTo($this->getDelegateTo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Specific usrId represented by sendBy.
|
||||||
|
if (!empty($this->getSendBy())) {
|
||||||
|
$query->sendBy($this->getSendBy());
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,11 @@ class Paused extends AbstractCases
|
|||||||
$query->delegateDateTo($this->getDelegateTo());
|
$query->delegateDateTo($this->getDelegateTo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Specific usrId represented by sendBy.
|
||||||
|
if (!empty($this->getSendBy())) {
|
||||||
|
$query->sendBy($this->getSendBy());
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ class Unassigned extends AbstractCases
|
|||||||
$query->delegateDateTo($this->getDelegateTo());
|
$query->delegateDateTo($this->getDelegateTo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Specific usrId represented by sendBy.
|
||||||
|
if (!empty($this->getSendBy())) {
|
||||||
|
$query->sendBy($this->getSendBy());
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1032,6 +1032,24 @@ class Delegation extends Model
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope sendBy.
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @param int $usrId
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeSendBy($query, int $usrId)
|
||||||
|
{
|
||||||
|
$query->where(DB::raw($usrId), function ($sql) {
|
||||||
|
$sql->from('APP_DELEGATION AS B')
|
||||||
|
->select('B.USR_ID')
|
||||||
|
->where('B.APP_NUMBER', '=', DB::raw('APP_DELEGATION.APP_NUMBER'))
|
||||||
|
->where('B.DEL_INDEX', '=', DB::raw('APP_DELEGATION.DEL_PREVIOUS'))
|
||||||
|
->limit(1);
|
||||||
|
});
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get specific cases unassigned that the user can view
|
* Get specific cases unassigned that the user can view
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class Home extends Api
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
@@ -119,7 +120,8 @@ class Home extends Api
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -145,6 +147,7 @@ class Home extends Api
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
@@ -163,7 +166,8 @@ class Home extends Api
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -189,6 +193,7 @@ class Home extends Api
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
@@ -207,7 +212,8 @@ class Home extends Api
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -269,6 +275,7 @@ class Home extends Api
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @return array
|
* @return array
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
* @access protected
|
* @access protected
|
||||||
@@ -285,7 +292,8 @@ class Home extends Api
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -310,6 +318,7 @@ class Home extends Api
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @return array
|
* @return array
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
* @access protected
|
* @access protected
|
||||||
@@ -326,7 +335,8 @@ class Home extends Api
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -351,6 +361,7 @@ class Home extends Api
|
|||||||
* @param string $delegateTo
|
* @param string $delegateTo
|
||||||
* @param string $filterCases
|
* @param string $filterCases
|
||||||
* @param string $sort
|
* @param string $sort
|
||||||
|
* @param string $sendBy
|
||||||
* @return array
|
* @return array
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
* @access protected
|
* @access protected
|
||||||
@@ -367,7 +378,8 @@ class Home extends Api
|
|||||||
string $delegateFrom = '',
|
string $delegateFrom = '',
|
||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
string $sendBy = ''
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user