Release 2.6.0 (#4472)
- Added: calendar entry title combination for customer, project and activity - Added: show not_invoiced and not_exported data in detail screens - Added: force logout if user is disabled - Added: reduced amount of database queries on several screens - Fixed: open-close status on work-contract screen for users without configuration - Fixed: failsafe order/orderBy in query if manually manipulated to be null - Fixed: unify statistic calculation (not_invoiced and not_exported) across screens - Tech: bump packages - Tech: Symfony 6.4
This commit is contained in:
@@ -142,8 +142,12 @@ class BaseQuery
|
||||
return $this->orderBy;
|
||||
}
|
||||
|
||||
public function setOrderBy(string $orderBy): self
|
||||
public function setOrderBy(?string $orderBy): self
|
||||
{
|
||||
if ($orderBy === null) {
|
||||
$orderBy = (string) $this->defaults['orderBy']; // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
$this->orderBy = $orderBy;
|
||||
|
||||
return $this;
|
||||
@@ -154,8 +158,12 @@ class BaseQuery
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
public function setOrder(string $order): self
|
||||
public function setOrder(?string $order): self
|
||||
{
|
||||
if ($order === null) {
|
||||
$order = (string) $this->defaults['order']; // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
if (\in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
namespace App\Repository\Query;
|
||||
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\Project;
|
||||
use App\Entity\User;
|
||||
|
||||
class TeamQuery extends BaseQuery
|
||||
@@ -19,12 +22,27 @@ class TeamQuery extends BaseQuery
|
||||
* @var User[]
|
||||
*/
|
||||
private array $users = [];
|
||||
/**
|
||||
* @var array<Customer>
|
||||
*/
|
||||
private array $customers = [];
|
||||
/**
|
||||
* @var array<Project>
|
||||
*/
|
||||
private array $projects = [];
|
||||
/**
|
||||
* @var array<Activity>
|
||||
*/
|
||||
private array $activities = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setDefaults([
|
||||
'orderBy' => 'name',
|
||||
'users' => [],
|
||||
'customers' => [],
|
||||
'projects' => [],
|
||||
'activities' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -33,20 +51,16 @@ class TeamQuery extends BaseQuery
|
||||
return !empty($this->users);
|
||||
}
|
||||
|
||||
public function addUser(User $user): self
|
||||
public function addUser(User $user): void
|
||||
{
|
||||
$this->users[$user->getId()] = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeUser(User $user): self
|
||||
public function removeUser(User $user): void
|
||||
{
|
||||
if (isset($this->users[$user->getId()])) {
|
||||
unset($this->users[$user->getId()]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,4 +70,82 @@ class TeamQuery extends BaseQuery
|
||||
{
|
||||
return array_values($this->users);
|
||||
}
|
||||
|
||||
public function hasCustomers(): bool
|
||||
{
|
||||
return \count($this->customers) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Customer[]
|
||||
*/
|
||||
public function getCustomers(): array
|
||||
{
|
||||
return $this->customers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<Customer> $customers
|
||||
*/
|
||||
public function setCustomers(array $customers): void
|
||||
{
|
||||
$this->customers = $customers;
|
||||
}
|
||||
|
||||
public function addCustomer(Customer $customer): void
|
||||
{
|
||||
$this->customers[] = $customer;
|
||||
}
|
||||
|
||||
public function hasProjects(): bool
|
||||
{
|
||||
return \count($this->projects) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Project[]
|
||||
*/
|
||||
public function getProjects(): array
|
||||
{
|
||||
return $this->projects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<Project> $projects
|
||||
*/
|
||||
public function setProjects(array $projects): void
|
||||
{
|
||||
$this->projects = $projects;
|
||||
}
|
||||
|
||||
public function addProject(Project $project): void
|
||||
{
|
||||
$this->projects[] = $project;
|
||||
}
|
||||
|
||||
public function hasActivities(): bool
|
||||
{
|
||||
return \count($this->activities) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Activity[]
|
||||
*/
|
||||
public function getActivities(): array
|
||||
{
|
||||
return $this->activities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<Activity> $activities
|
||||
*/
|
||||
public function setActivities(array $activities): void
|
||||
{
|
||||
$this->activities = $activities;
|
||||
}
|
||||
|
||||
public function addActivity(Activity $activity): void
|
||||
{
|
||||
$this->activities[] = $activity;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user