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:
@@ -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
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace App\WorkingTime;
|
||||
use App\Entity\User;
|
||||
use App\Entity\WorkingTime;
|
||||
use App\Event\WorkingTimeApproveMonthEvent;
|
||||
use App\Event\WorkingTimeQueryStatsEvent;
|
||||
use App\Event\WorkingTimeYearEvent;
|
||||
use App\Event\WorkingTimeYearSummaryEvent;
|
||||
use App\Repository\TimesheetRepository;
|
||||
@@ -235,6 +236,9 @@ final class WorkingTimeService
|
||||
->addGroupBy('day')
|
||||
;
|
||||
|
||||
$event = new WorkingTimeQueryStatsEvent($qb, $user, $begin, $end);
|
||||
$this->eventDispatcher->dispatch($event);
|
||||
|
||||
$results = $qb->getQuery()->getResult();
|
||||
|
||||
$durations = [];
|
||||
|
||||
Reference in New Issue
Block a user