PMCORE-3104

This commit is contained in:
Paula Quispe
2021-08-19 15:23:25 -04:00
parent 7cbba5190c
commit f18e475196
17 changed files with 262 additions and 25 deletions

View File

@@ -152,6 +152,24 @@ class Draft extends AbstractCases
return $query->count(['APPLICATION.APP_NUMBER']);
}
/**
* Count if the user has at least one case in the list
*
* @return bool
*/
public function atLeastOne()
{
$query = Application::query()->select(['APPLICATION.APP_NUMBER']);
// Add the initial scope for draft cases for specific user
$query->draft($this->getUserUid());
// Get only one case
$query->limit(1);
// Get result
$items = $query->get();
return $items->count() > 0;
}
/**
* Count how many cases the user has in DRAFT, needs to apply filters
*