bugfixes (#3078)
* fix phpdoc * fix invoice export field order * prevent empty migration warning * do not trigger export validation on new timesheets * update license year * remove trailing comma in function call for php compatibility * add new composer plugin config * bump phpunit schema version
This commit is contained in:
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2017-2019 Kevin Papst @ https://www.kevinpapst.de
|
Copyright (c) 2017-2022 Kevin Papst @ https://www.kevinpapst.de
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -107,7 +107,11 @@
|
|||||||
"preferred-install": {
|
"preferred-install": {
|
||||||
"*": "dist"
|
"*": "dist"
|
||||||
},
|
},
|
||||||
"sort-packages": true
|
"sort-packages": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"composer/package-versions-deprecated": true,
|
||||||
|
"symfony/flex": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
|
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
bootstrap="tests/bootstrap.php"
|
bootstrap="tests/bootstrap.php">
|
||||||
>
|
|
||||||
<php>
|
<php>
|
||||||
<ini name="error_reporting" value="-1" />
|
<ini name="error_reporting" value="-1" />
|
||||||
<ini name="max_execution_time" value="-1" />
|
<ini name="max_execution_time" value="-1" />
|
||||||
@@ -64,9 +61,8 @@
|
|||||||
</filter>
|
</filter>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
begins a database transaction before every testcase and rolls it back after the test finished, so
|
wrap tests inside database transactions, so tests can safely manipulate contents without
|
||||||
tests can manipulate the database without affecting other tests
|
affecting other tests. @see https://github.com/dmaicher/doctrine-test-bundle
|
||||||
@see https://github.com/dmaicher/doctrine-test-bundle
|
|
||||||
-->
|
-->
|
||||||
<extensions>
|
<extensions>
|
||||||
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
|
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ class TranslationCommand extends Command
|
|||||||
$id,
|
$id,
|
||||||
$values['resname'],
|
$values['resname'],
|
||||||
$values['source'],
|
$values['source'],
|
||||||
$values['target'],
|
$values['target']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ class Activity implements EntityWithMetaFields, EntityWithBudget
|
|||||||
|
|
||||||
$currentMeta = $this->meta;
|
$currentMeta = $this->meta;
|
||||||
$this->meta = new ArrayCollection();
|
$this->meta = new ArrayCollection();
|
||||||
/** @var ProjectMeta $meta */
|
/** @var ActivityMeta $meta */
|
||||||
foreach ($currentMeta as $meta) {
|
foreach ($currentMeta as $meta) {
|
||||||
$newMeta = clone $meta;
|
$newMeta = clone $meta;
|
||||||
$newMeta->setEntity($this);
|
$newMeta->setEntity($this);
|
||||||
|
|||||||
@@ -595,7 +595,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
|
|||||||
|
|
||||||
$currentMeta = $this->meta;
|
$currentMeta = $this->meta;
|
||||||
$this->meta = new ArrayCollection();
|
$this->meta = new ArrayCollection();
|
||||||
/** @var ProjectMeta $meta */
|
/** @var CustomerMeta $meta */
|
||||||
foreach ($currentMeta as $meta) {
|
foreach ($currentMeta as $meta) {
|
||||||
$newMeta = clone $meta;
|
$newMeta = clone $meta;
|
||||||
$newMeta->setEntity($this);
|
$newMeta->setEntity($this);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @UniqueEntity("invoiceNumber")
|
* @UniqueEntity("invoiceNumber")
|
||||||
* @UniqueEntity("invoiceFilename")
|
* @UniqueEntity("invoiceFilename")
|
||||||
*
|
*
|
||||||
* @Exporter\Order({"id", "createdAt", "invoiceNumber", "status", "customer", "subtotal", "total", "tax", "currency", "vat", "dueDays", "dueDate", "paymentDate", "user", "invoiceFilename", "comment"})
|
* @Exporter\Order({"id", "createdAt", "invoiceNumber", "status", "customer", "subtotal", "total", "tax", "currency", "vat", "dueDays", "dueDate", "paymentDate", "user", "invoiceFilename", "customerNumber", "comment"})
|
||||||
* @Exporter\Expose("customer", label="label.customer", exp="object.getCustomer() === null ? null : object.getCustomer().getName()")
|
* @Exporter\Expose("customer", label="label.customer", exp="object.getCustomer() === null ? null : object.getCustomer().getName()")
|
||||||
* @Exporter\Expose("customerNumber", label="label.number", exp="object.getCustomer() === null ? null : object.getCustomer().getNumber()")
|
* @Exporter\Expose("customerNumber", label="label.number", exp="object.getCustomer() === null ? null : object.getCustomer().getNumber()")
|
||||||
* @Exporter\Expose("dueDate", label="invoice.due_days", type="datetime", exp="object.getDueDate() === null ? null : object.getDueDate()")
|
* @Exporter\Expose("dueDate", label="invoice.due_days", type="datetime", exp="object.getDueDate() === null ? null : object.getDueDate()")
|
||||||
|
|||||||
@@ -38,5 +38,7 @@ final class Version20211008092010 extends AbstractMigration
|
|||||||
$projects = $schema->getTable('kimai2_projects');
|
$projects = $schema->getTable('kimai2_projects');
|
||||||
$column = $projects->getColumn('order_number');
|
$column = $projects->getColumn('order_number');
|
||||||
$column->setOptions(['length' => 20]);
|
$column->setOptions(['length' => 20]);
|
||||||
|
|
||||||
|
$this->preventEmptyMigrationWarning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ final class TimesheetExportedValidator extends ConstraintValidator
|
|||||||
throw new UnexpectedTypeException($timesheet, TimesheetEntity::class);
|
throw new UnexpectedTypeException($timesheet, TimesheetEntity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($timesheet->getId() === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$timesheet->isExported()) {
|
if (!$timesheet->isExported()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,8 +66,9 @@ class TimesheetExportedValidatorTest extends ConstraintValidatorTestCase
|
|||||||
$this->validator = $this->createMyValidator(false);
|
$this->validator = $this->createMyValidator(false);
|
||||||
$this->validator->initialize($this->context);
|
$this->validator->initialize($this->context);
|
||||||
|
|
||||||
$timesheet = new Timesheet();
|
$timesheet = $this->createMock(Timesheet::class);
|
||||||
$timesheet->setExported(true);
|
$timesheet->method('isExported')->willReturn(true);
|
||||||
|
$timesheet->method('getId')->willReturn(1);
|
||||||
|
|
||||||
$this->validator->validate($timesheet, new TimesheetExported());
|
$this->validator->validate($timesheet, new TimesheetExported());
|
||||||
|
|
||||||
@@ -77,6 +78,20 @@ class TimesheetExportedValidatorTest extends ConstraintValidatorTestCase
|
|||||||
->assertRaised();
|
->assertRaised();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNotTriggersOnNewTimesheet()
|
||||||
|
{
|
||||||
|
$this->validator = $this->createMyValidator(false);
|
||||||
|
$this->validator->initialize($this->context);
|
||||||
|
|
||||||
|
$timesheet = $this->createMock(Timesheet::class);
|
||||||
|
$timesheet->method('isExported')->willReturn(true);
|
||||||
|
$timesheet->method('getId')->willReturn(null);
|
||||||
|
|
||||||
|
$this->validator->validate($timesheet, new TimesheetExported());
|
||||||
|
|
||||||
|
$this->assertNoViolation();
|
||||||
|
}
|
||||||
|
|
||||||
public function testDoesNotTriggerWithPermission()
|
public function testDoesNotTriggerWithPermission()
|
||||||
{
|
{
|
||||||
$this->validator = $this->createMyValidator(true);
|
$this->validator = $this->createMyValidator(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user