Fixes for 1.12 (#4655)

* fix missing locales
* bump composer packages
* changed translations
* assert timezone on customer
* include user accountNumber in excel export
* improve next customer number calculation
* fix z-index of contextmenu / action dropdown
This commit is contained in:
Kevin Papst
2024-02-22 13:03:09 +01:00
committed by GitHub
parent 36c578452e
commit f016221e8e
28 changed files with 892 additions and 210 deletions

View File

@@ -28,10 +28,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
final class CustomerService
{
public function __construct(
private CustomerRepository $repository,
private SystemConfiguration $configuration,
private ValidatorInterface $validator,
private EventDispatcherInterface $dispatcher
private readonly CustomerRepository $repository,
private readonly SystemConfiguration $configuration,
private readonly ValidatorInterface $validator,
private readonly EventDispatcherInterface $dispatcher
) {
}
@@ -74,7 +74,6 @@ final class CustomerService
}
/**
* @param Customer $customer
* @param string[] $groups
* @throws ValidationFailedException
*/
@@ -122,15 +121,28 @@ final class CustomerService
}
public function calculateNextCustomerNumber(): string
{
// we cannot use max(number) because a varchar column returns unexpected results
$start = $this->repository->countCustomer();
do {
$number = $this->getNextNumber($start++);
$customer = $this->findCustomerByNumber($number);
} while ($customer !== null);
return $number;
}
private function getNextNumber(int $counter): string
{
$format = $this->configuration->find('customer.number_format');
if (empty($format) || !\is_string($format)) {
$format = '{cc,4}';
}
$numberGenerator = new NumberGenerator($format, function (string $originalFormat, string $format, int $increaseBy): string|int {
$numberGenerator = new NumberGenerator($format, function (string $originalFormat, string $format, int $increaseBy) use ($counter): string|int {
return match ($format) {
'cc' => $this->repository->count([]) + $increaseBy,
'cc' => $counter + $increaseBy,
default => $originalFormat,
};
});