rounding rules via admin screen, round begin when starting record (#1229)
This commit is contained in:
@@ -10,10 +10,21 @@
|
||||
namespace App\Timesheet\TrackingMode;
|
||||
|
||||
use App\Entity\Timesheet;
|
||||
use App\Timesheet\UserDateTimeFactory;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class PunchInOutMode implements TrackingModeInterface
|
||||
final class PunchInOutMode implements TrackingModeInterface
|
||||
{
|
||||
/**
|
||||
* @var UserDateTimeFactory
|
||||
*/
|
||||
private $dateTime;
|
||||
|
||||
public function __construct(UserDateTimeFactory $dateTime)
|
||||
{
|
||||
$this->dateTime = $dateTime;
|
||||
}
|
||||
|
||||
public function canEditBegin(): bool
|
||||
{
|
||||
return false;
|
||||
@@ -36,6 +47,9 @@ class PunchInOutMode implements TrackingModeInterface
|
||||
|
||||
public function create(Timesheet $timesheet, Request $request): void
|
||||
{
|
||||
if (null === $timesheet->getBegin()) {
|
||||
$timesheet->setBegin($this->dateTime->createDateTime());
|
||||
}
|
||||
}
|
||||
|
||||
public function getId(): string
|
||||
|
||||
Reference in New Issue
Block a user