code cleanup (#2700)
* fix doctrine definition * do not count api calls as login * remove unknown form options * fix annotations * cleanup deprecations in tests
This commit is contained in:
@@ -255,7 +255,7 @@ class Timesheet implements EntityWithMetaFields, ExportItemInterface
|
||||
* @Serializer\Expose()
|
||||
* @Serializer\Groups({"Default"})
|
||||
*
|
||||
* @ORM\Column(name="exported", type="boolean", nullable=false)
|
||||
* @ORM\Column(name="exported", type="boolean", nullable=false, options={"default": false})
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
private $exported = false;
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Entity\User;
|
||||
use App\Event\UserInteractiveLoginEvent;
|
||||
use App\Repository\UserRepository;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken;
|
||||
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
||||
use Symfony\Component\Security\Http\SecurityEvents;
|
||||
|
||||
@@ -46,6 +47,12 @@ class LastLoginSubscriber implements EventSubscriberInterface
|
||||
|
||||
public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
|
||||
{
|
||||
// do not count API calls as logins
|
||||
// this point could be used to add API rate limitation in the future
|
||||
if ($event->getAuthenticationToken() instanceof PostAuthenticationGuardToken) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = $event->getAuthenticationToken()->getUser();
|
||||
|
||||
if ($user instanceof User) {
|
||||
|
||||
@@ -43,7 +43,6 @@ class ActivityRateForm extends AbstractRateForm
|
||||
'data_class' => ActivityRate::class,
|
||||
'csrf_protection' => true,
|
||||
'csrf_field_name' => '_token',
|
||||
'expand_users' => true,
|
||||
'csrf_token_id' => 'admin_customer_rate_edit',
|
||||
'attr' => [
|
||||
'data-form-event' => 'kimai.activityUpdate'
|
||||
|
||||
@@ -43,7 +43,6 @@ class CustomerRateForm extends AbstractRateForm
|
||||
'data_class' => CustomerRate::class,
|
||||
'csrf_protection' => true,
|
||||
'csrf_field_name' => '_token',
|
||||
'expand_users' => true,
|
||||
'csrf_token_id' => 'admin_customer_rate_edit',
|
||||
'attr' => [
|
||||
'data-form-event' => 'kimai.customerUpdate'
|
||||
|
||||
@@ -43,7 +43,6 @@ class ProjectRateForm extends AbstractRateForm
|
||||
'data_class' => ProjectRate::class,
|
||||
'csrf_protection' => true,
|
||||
'csrf_field_name' => '_token',
|
||||
'expand_users' => true,
|
||||
'csrf_token_id' => 'admin_project_rate_edit',
|
||||
'attr' => [
|
||||
'data-form-event' => 'kimai.projectUpdate'
|
||||
|
||||
@@ -263,6 +263,7 @@ final class ServiceInvoice
|
||||
/**
|
||||
* @param InvoiceQuery $query
|
||||
* @return InvoiceItemInterface[]
|
||||
* @deprecated since 1.14 and will be removed with 2.0
|
||||
*/
|
||||
public function findInvoiceItems(InvoiceQuery $query): array
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace App\Model\Statistic;
|
||||
use App\Model\TimesheetCountedStatistic;
|
||||
|
||||
/**
|
||||
* @final
|
||||
* @internal
|
||||
*/
|
||||
class BudgetStatistic extends TimesheetCountedStatistic
|
||||
{
|
||||
|
||||
@@ -240,7 +240,6 @@ class SystemConfigurationTest extends TestCase
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertEquals(99, $sut->getTimesheetActiveEntriesHardLimit());
|
||||
$this->assertEquals(99, $sut->getTimesheetActiveEntriesSoftLimit());
|
||||
$this->assertFalse($sut->isTimesheetAllowFutureTimes());
|
||||
$this->assertFalse($sut->isTimesheetMarkdownEnabled());
|
||||
$this->assertEquals('duration_only', $sut->getTimesheetTrackingMode());
|
||||
@@ -260,11 +259,19 @@ class SystemConfigurationTest extends TestCase
|
||||
$this->assertEquals(5, $sut->getTimesheetIncrementEnd());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testDeprecatedSettingsWithoutLoader()
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), []);
|
||||
$this->assertEquals(99, $sut->getTimesheetActiveEntriesSoftLimit());
|
||||
}
|
||||
|
||||
public function testTimesheetWithLoader()
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings());
|
||||
$this->assertEquals(7, $sut->getTimesheetActiveEntriesHardLimit());
|
||||
$this->assertEquals(7, $sut->getTimesheetActiveEntriesSoftLimit());
|
||||
$this->assertTrue($sut->isTimesheetAllowFutureTimes());
|
||||
$this->assertTrue($sut->isTimesheetMarkdownEnabled());
|
||||
$this->assertEquals('default', $sut->getTimesheetTrackingMode());
|
||||
|
||||
@@ -156,6 +156,9 @@ class ServiceInvoiceTest extends TestCase
|
||||
self::assertEquals([], $items);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testFindInvoiceItemsWithCustomer()
|
||||
{
|
||||
$sut = $this->getSut([]);
|
||||
|
||||
Reference in New Issue
Block a user