Release 2.0.33 (#4273)

* added function to check if meta-field is defined by a plugin
* hide un-defined meta-fields in details view
* fix default charset = utf8mb4
* remove broken DATABASE_VERSION fallback
* split off upgrade infos for version 1.x
* fix page out of range #4279
This commit is contained in:
Kevin Papst
2023-09-07 22:24:08 +02:00
committed by GitHub
parent 31348da4c0
commit 6e1207578e
27 changed files with 495 additions and 424 deletions

View File

@@ -112,6 +112,7 @@ final class ActivityController extends BaseApiController
$query->setSearchTerm(new SearchTerm($term));
}
$query->setIsApiCall(true);
$data = $this->repository->getActivitiesForQuery($query);
$view = new View($data, 200);
$view->getContext()->setGroups(self::GROUPS_COLLECTION);

View File

@@ -90,6 +90,7 @@ final class CustomerController extends BaseApiController
$query->setSearchTerm(new SearchTerm($term));
}
$query->setIsApiCall(true);
$data = $this->repository->getCustomersForQuery($query);
$view = new View($data, 200);
$view->getContext()->setGroups(self::GROUPS_COLLECTION);

View File

@@ -144,6 +144,7 @@ final class ProjectController extends BaseApiController
$query->setSearchTerm(new SearchTerm($term));
}
$query->setIsApiCall(true);
$data = $this->repository->getProjectsForQuery($query);
$view = new View($data, 200);
$view->getContext()->setGroups(self::GROUPS_COLLECTION);

View File

@@ -250,6 +250,7 @@ final class TimesheetController extends BaseApiController
$query->setModifiedAfter($factory->createDateTime($modifiedAfter));
}
$query->setIsApiCall(true);
$data = $this->repository->getPagerfantaForQuery($query);
$results = (array) $data->getCurrentPageResults();

View File

@@ -85,6 +85,7 @@ final class UserController extends BaseApiController
$query->setSearchTerm(new SearchTerm($term));
}
$query->setIsApiCall(true);
$data = $this->repository->getUsersForQuery($query);
$view = new View($data, 200);
$view->getContext()->setGroups(self::GROUPS_COLLECTION);

View File

@@ -17,11 +17,11 @@ class Constants
/**
* The current release version
*/
public const VERSION = '2.0.32';
public const VERSION = '2.0.33';
/**
* The current release: major * 10000 + minor * 100 + patch
*/
public const VERSION_ID = 20032;
public const VERSION_ID = 20033;
/**
* The software name
*/

View File

@@ -131,4 +131,9 @@ interface MetaTableTypeInterface
* Returns the order (default: 0).
*/
public function getOrder(): int;
/**
* Whether true if this field is defined by a plugin, or false if it is a value stored in the database.
*/
public function isDefined(): bool;
}

View File

@@ -255,4 +255,12 @@ trait MetaTableTypeTrait
$this->id = null;
}
}
/**
* Whether this field is defined by a plugin or just a value stored in the database.
*/
public function isDefined(): bool
{
return $this->type !== null;
}
}

View File

@@ -371,11 +371,7 @@ class ActivityRepository extends EntityRepository
public function getPagerfantaForQuery(ActivityQuery $query): Pagination
{
$paginator = new Pagination($this->getPaginatorForQuery($query));
$paginator->setMaxPerPage($query->getPageSize());
$paginator->setCurrentPage($query->getPage());
return $paginator;
return new Pagination($this->getPaginatorForQuery($query), $query);
}
protected function getPaginatorForQuery(ActivityQuery $query): PaginatorInterface

View File

@@ -224,11 +224,7 @@ class CustomerRepository extends EntityRepository
public function getPagerfantaForQuery(CustomerQuery $query): Pagination
{
$paginator = new Pagination($this->getPaginatorForQuery($query));
$paginator->setMaxPerPage($query->getPageSize());
$paginator->setCurrentPage($query->getPage());
return $paginator;
return new Pagination($this->getPaginatorForQuery($query), $query);
}
public function countCustomersForQuery(CustomerQuery $query): int

View File

@@ -290,10 +290,6 @@ class InvoiceRepository extends EntityRepository
public function getPagerfantaForQuery(InvoiceArchiveQuery $query): Pagination
{
$paginator = new Pagination($this->getPaginatorForQuery($query));
$paginator->setMaxPerPage($query->getPageSize());
$paginator->setCurrentPage($query->getPage());
return $paginator;
return new Pagination($this->getPaginatorForQuery($query), $query);
}
}

View File

@@ -59,11 +59,7 @@ class InvoiceTemplateRepository extends EntityRepository
public function getPagerfantaForQuery(BaseQuery $query): Pagination
{
$paginator = new Pagination($this->getPaginatorForQuery($query));
$paginator->setMaxPerPage($query->getPageSize());
$paginator->setCurrentPage($query->getPage());
return $paginator;
return new Pagination($this->getPaginatorForQuery($query), $query);
}
public function countTemplatesForQuery(BaseQuery $query): int

View File

@@ -347,11 +347,7 @@ class ProjectRepository extends EntityRepository
public function getPagerfantaForQuery(ProjectQuery $query): Pagination
{
$paginator = new Pagination($this->getPaginatorForQuery($query));
$paginator->setMaxPerPage($query->getPageSize());
$paginator->setCurrentPage($query->getPage());
return $paginator;
return new Pagination($this->getPaginatorForQuery($query), $query);
}
private function getPaginatorForQuery(ProjectQuery $query): PaginatorInterface

View File

@@ -35,6 +35,7 @@ class BaseQuery
'order' => self::ORDER_ASC,
'searchTerm' => null,
];
private bool $isApiCall = false;
private int $page = 1;
private int $pageSize = self::DEFAULT_PAGESIZE;
private string $orderBy = 'id';
@@ -387,4 +388,14 @@ class BaseQuery
{
return $this->bookmarkSearch;
}
public function setIsApiCall(bool $isApiCall): void
{
$this->isApiCall = $isApiCall;
}
public function isApiCall(): bool
{
return $this->isApiCall;
}
}

View File

@@ -115,11 +115,7 @@ class TeamRepository extends EntityRepository
public function getPagerfantaForQuery(TeamQuery $query): Pagination
{
$paginator = new Pagination($this->getPaginatorForQuery($query));
$paginator->setMaxPerPage($query->getPageSize());
$paginator->setCurrentPage($query->getPage());
return $paginator;
return new Pagination($this->getPaginatorForQuery($query), $query);
}
protected function getPaginatorForQuery(TeamQuery $query): PaginatorInterface

View File

@@ -408,11 +408,7 @@ class TimesheetRepository extends EntityRepository
public function getPagerfantaForQuery(TimesheetQuery $query): Pagination
{
$paginator = new Pagination($this->getPaginatorForQuery($query));
$paginator->setMaxPerPage($query->getPageSize());
$paginator->setCurrentPage($query->getPage());
return $paginator;
return new Pagination($this->getPaginatorForQuery($query), $query);
}
protected function getPaginatorForQuery(TimesheetQuery $query): PaginatorInterface

View File

@@ -393,11 +393,7 @@ class UserRepository extends EntityRepository implements UserLoaderInterface, Us
public function getPagerfantaForQuery(UserQuery $query): Pagination
{
$paginator = new Pagination($this->getPaginatorForQuery($query));
$paginator->setMaxPerPage($query->getPageSize());
$paginator->setCurrentPage($query->getPage());
return $paginator;
return new Pagination($this->getPaginatorForQuery($query), $query);
}
public function countUsersForQuery(UserQuery $query): int

View File

@@ -9,13 +9,23 @@
namespace App\Utils;
use App\Repository\Query\BaseQuery;
use Pagerfanta\Adapter\AdapterInterface;
use Pagerfanta\Pagerfanta;
final class Pagination extends Pagerfanta
{
public function __construct(AdapterInterface $adapter)
public function __construct(AdapterInterface $adapter, ?BaseQuery $query = null)
{
parent::__construct($adapter);
if ($query !== null) {
$this->setMaxPerPage($query->getPageSize());
$this->setCurrentPage($query->getPage());
}
if ($query === null || !$query->isApiCall()) {
$this->setNormalizeOutOfRangePages(true);
}
}
}