Release 2.30 (#5345)

- added missing InvoiceTemplate company, title) field validator
- graceful fallback for missing working-contract mode
- improve email test command (use configured MAIL_FROM)
- additional form types for simple usage in SystemConfiguration and UserPreferences
- allow to extend the working time query via event
This commit is contained in:
Kevin Papst
2025-02-17 08:32:22 +01:00
committed by GitHub
parent d30166e691
commit b341358d0a
20 changed files with 333 additions and 17 deletions

View File

@@ -10,6 +10,7 @@
namespace App\WorkingTime\Mode;
use App\Entity\User;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
final class WorkingTimeModeFactory
@@ -19,7 +20,8 @@ final class WorkingTimeModeFactory
*/
public function __construct(
#[TaggedIterator(WorkingTimeMode::class)]
private readonly iterable $modes
private readonly iterable $modes,
private readonly LoggerInterface $logger
)
{
}
@@ -39,7 +41,15 @@ final class WorkingTimeModeFactory
public function getModeForUser(User $user): WorkingTimeMode
{
return $this->getMode($user->getWorkContractMode());
try {
return $this->getMode($user->getWorkContractMode());
} catch (\InvalidArgumentException $ex) {
$this->logger->error(
\sprintf('Unknown mode "%s" requested for user %s', $user->getWorkContractMode(), $user->getId())
);
return new WorkingTimeModeNone(); // @CloudRequired
}
}
public function getMode(string $contractMode): WorkingTimeMode