Merged in feature/PMCORE-3517-2 (pull request #8303)

PMCORE-3517 PMCORE-3505

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Paula Quispe
2021-12-06 21:53:22 +00:00
committed by Julio Cesar Laura Avendaño
34 changed files with 1009 additions and 420 deletions

View File

@@ -390,6 +390,15 @@ class CaseList extends Model
'typeSearch' => 'search text',
'enableFilter' => false,
'set' => true
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'process_category',
'name' => G::LoadTranslation('ID_PROCESS_CATEGORY'),
'type' => 'string',
'source' => 'APPLICATION',
'typeSearch' => 'search text',
'enableFilter' => false,
'set' => true
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'task',

View File

@@ -17,6 +17,18 @@ class ProcessCategory extends Model
public $timestamps = false;
/**
* Scope a query to specific category id
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param int $category
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCategory($query, $category)
{
return $query->where('CATEGORY_ID', $category);
}
/**
* Scope a query to specific category name
*
@@ -92,4 +104,22 @@ class ProcessCategory extends Model
return $query->first()->CATEGORY_ID;
}
}
/**
* Get category name
*
* @param int $category
*
* @return string
*/
public static function getCategory(int $category)
{
$query = ProcessCategory::query()->select(['CATEGORY_NAME']);
$query->category($category);
if ($query->first()) {
return $query->first()->CATEGORY_NAME;
} else {
return '';
}
}
}