use dialog to duplicate timesheet (#2567)
* fix: display time budget in customer listing if set * updated api methods with annotations * do not require checkboxes for system configurations * open dialog for duplicated timesheets
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace App\Voter;
|
||||
|
||||
use App\Configuration\SystemConfiguration;
|
||||
use App\Entity\Timesheet;
|
||||
use App\Entity\User;
|
||||
use App\Security\RolePermissionManager;
|
||||
@@ -48,9 +47,6 @@ final class TimesheetVoter extends Voter
|
||||
'duplicate'
|
||||
];
|
||||
|
||||
private $configuration;
|
||||
private $cacheAllowCopy;
|
||||
|
||||
private $permissionManager;
|
||||
private $lockdownService;
|
||||
|
||||
@@ -59,11 +55,10 @@ final class TimesheetVoter extends Voter
|
||||
private $editExported;
|
||||
private $now;
|
||||
|
||||
public function __construct(RolePermissionManager $permissionManager, LockdownService $lockdownService, SystemConfiguration $configuration)
|
||||
public function __construct(RolePermissionManager $permissionManager, LockdownService $lockdownService)
|
||||
{
|
||||
$this->permissionManager = $permissionManager;
|
||||
$this->lockdownService = $lockdownService;
|
||||
$this->configuration = $configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,17 +204,6 @@ final class TimesheetVoter extends Voter
|
||||
|
||||
protected function canDuplicate(User $user, Timesheet $timesheet): bool
|
||||
{
|
||||
if ($this->cacheAllowCopy === null) {
|
||||
$this->cacheAllowCopy = $this->configuration->isTimesheetAllowOverlappingRecords();
|
||||
}
|
||||
|
||||
// This is a quickfix, because the API cannot open dialogs. if the method is copied to the timesheet controller,
|
||||
// we could open the edit dialog instead of directly saving the copied entry.
|
||||
// Probably add a new permission is required to differentiate between API and UI.
|
||||
if (!$this->cacheAllowCopy) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->isAllowedInLockdown($user, $timesheet)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user