diff --git a/src/Entity/Project.php b/src/Entity/Project.php index 8820ebdd..fb3523d2 100644 --- a/src/Entity/Project.php +++ b/src/Entity/Project.php @@ -111,8 +111,8 @@ class Project implements EntityWithMetaFields, EntityWithBudget * * @Exporter\Expose(label="label.orderNumber") * - * @ORM\Column(name="order_number", type="text", length=20, nullable=true) - * @Assert\Length(max=20) + * @ORM\Column(name="order_number", type="text", length=50, nullable=true) + * @Assert\Length(max=50) */ private $orderNumber; /** diff --git a/src/Migrations/Version20211008092010.php b/src/Migrations/Version20211008092010.php new file mode 100644 index 00000000..eb7bbc52 --- /dev/null +++ b/src/Migrations/Version20211008092010.php @@ -0,0 +1,40 @@ +getTable('kimai2_projects'); + $column = $projects->getColumn('order_number'); + $column->setOptions(['length' => 50]); + } + + public function down(Schema $schema): void + { + $projects = $schema->getTable('kimai2_projects'); + $column = $projects->getColumn('order_number'); + $column->setOptions(['length' => 20]); + } +} diff --git a/tests/API/ProjectControllerTest.php b/tests/API/ProjectControllerTest.php index 092399e8..2d1d5c00 100644 --- a/tests/API/ProjectControllerTest.php +++ b/tests/API/ProjectControllerTest.php @@ -289,6 +289,7 @@ class ProjectControllerTest extends APIControllerBaseTest 'end' => '2020-02-08T21:11:42', 'budget' => '999', 'timeBudget' => '7200', + 'orderNumber' => '1234567890/WXYZ/SUBPROJECT/1234/CONTRACT/EMPLOYEE1', ]; $this->request($client, '/api/projects', 'POST', [], json_encode($data)); $this->assertTrue($client->getResponse()->isSuccessful()); @@ -300,6 +301,7 @@ class ProjectControllerTest extends APIControllerBaseTest self::assertEquals('2018-02-08T13:02:54+0000', $result['orderDate']); self::assertEquals('2019-02-01T19:32:17+0000', $result['start']); self::assertEquals('2020-02-08T21:11:42+0000', $result['end']); + self::assertEquals('1234567890/WXYZ/SUBPROJECT/1234/CONTRACT/EMPLOYEE1', $result['orderNumber']); } public function testPostActionWithLeastFields()