Merged in bugfix/PMCORE-2863 (pull request #7842)
PMCORE-2863 Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
d816eedfef
@@ -12,7 +12,7 @@
|
|||||||
v-model="filter[0].options"
|
v-model="filter[0].options"
|
||||||
:options="taks"
|
:options="taks"
|
||||||
:placeholder="$t('ID_TASK_TITLE')"
|
:placeholder="$t('ID_TASK_TITLE')"
|
||||||
label="TAS_TITLE"
|
label="TAS_PROCESS"
|
||||||
track-by="TAS_ID"
|
track-by="TAS_ID"
|
||||||
:show-no-results="false"
|
:show-no-results="false"
|
||||||
@search-change="asyncFind"
|
@search-change="asyncFind"
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
id="ajax"
|
id="ajax"
|
||||||
:limit="10"
|
:limit="10"
|
||||||
:clear-on-select="true"
|
:clear-on-select="true"
|
||||||
|
:select-label="''"
|
||||||
>
|
>
|
||||||
</multiselect>
|
</multiselect>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
|
|||||||
@@ -73,20 +73,36 @@ class Task extends Model
|
|||||||
* Scope a query to include a specific process
|
* Scope a query to include a specific process
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $category
|
* @param int $proId
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
* @todo Auto populate the PRO_ID in TASK table
|
* @todo Auto populate the PRO_ID in TASK table
|
||||||
*/
|
*/
|
||||||
public function scopeProcessId($query, $proId)
|
public function scopeProcess($query, $proId = '')
|
||||||
{
|
{
|
||||||
$query->join('PROCESS', function ($join) use ($proId) {
|
$query->join('PROCESS', function ($join) use ($proId) {
|
||||||
$join->on('TASK.PRO_UID', '=', 'PROCESS.PRO_UID')
|
$join->on('TASK.PRO_UID', '=', 'PROCESS.PRO_UID');
|
||||||
->where('PROCESS.PRO_ID', '=', $proId);
|
if (!empty($proId)) {
|
||||||
|
$join->where('PROCESS.PRO_ID', '=', $proId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope a query to exclude determined tasks types
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeExcludedTasks($query)
|
||||||
|
{
|
||||||
|
$query->whereNotIn('TAS_TYPE', Task::$typesRunAutomatically)
|
||||||
|
->whereNotIn('TAS_TYPE', Task::DUMMY_TASKS);
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the title of the task
|
* Get the title of the task
|
||||||
*
|
*
|
||||||
@@ -239,17 +255,22 @@ class Task extends Model
|
|||||||
public static function getTasksForHome($text = null, $proId = null, $offset = null, $limit = null)
|
public static function getTasksForHome($text = null, $proId = null, $offset = null, $limit = null)
|
||||||
{
|
{
|
||||||
// Get base query
|
// Get base query
|
||||||
$query = Task::query()->select(['TAS_ID', 'TAS_TITLE']);
|
$query = Task::query()->selectRaw("
|
||||||
|
TAS_ID,
|
||||||
|
TAS_TITLE,
|
||||||
|
CONCAT(TAS_TITLE,' - ',PRO_TITLE) AS TAS_PROCESS
|
||||||
|
");
|
||||||
|
|
||||||
// Set "TAS_TITLE" condition if is sent
|
// Set "TAS_TITLE" condition if is sent
|
||||||
if (!is_null($text)) {
|
if (!is_null($text)) {
|
||||||
$query->title($text);
|
$query->title($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set "PRO_ID" condition if is sent
|
// Join with process
|
||||||
if (!is_null($proId)) {
|
$query->process($proId);
|
||||||
$query->processId($proId);
|
|
||||||
}
|
// Exclude the determined tasks
|
||||||
|
$query->excludedTasks();
|
||||||
|
|
||||||
// Set pagination if offset and limit are sent
|
// Set pagination if offset and limit are sent
|
||||||
if (!is_null($offset) && !is_null($limit)) {
|
if (!is_null($offset) && !is_null($limit)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user