diff --git a/config/packages/kimai.yaml b/config/packages/kimai.yaml
index d99d7e4c..84a75493 100644
--- a/config/packages/kimai.yaml
+++ b/config/packages/kimai.yaml
@@ -10,7 +10,6 @@ kimai:
short: 'App\Invoice\ShortInvoiceCalculator'
number_generator:
default: 'App\Invoice\DateNumberGenerator'
- #random: 'App\Invoice\RandomNumberGenerator'
twig:
globals:
diff --git a/src/Controller/InvoiceController.php b/src/Controller/InvoiceController.php
index e23ed9c3..1fe2face 100644
--- a/src/Controller/InvoiceController.php
+++ b/src/Controller/InvoiceController.php
@@ -226,7 +226,7 @@ class InvoiceController extends AbstractController
*/
public function invoiceAction(InvoiceModel $model)
{
- return $this->render('invoice/print.html.twig', [
+ return $this->render('invoice/renderer/print.html.twig', [
'model' => $model,
]);
}
@@ -237,7 +237,7 @@ class InvoiceController extends AbstractController
*/
public function timesheetAction(InvoiceModel $model)
{
- return $this->render('invoice/timesheet.html.twig', [
+ return $this->render('invoice/renderer/timesheet.html.twig', [
'model' => $model,
]);
}
diff --git a/src/Entity/Project.php b/src/Entity/Project.php
index 8d237161..d42367a3 100644
--- a/src/Entity/Project.php
+++ b/src/Entity/Project.php
@@ -52,6 +52,14 @@ class Project
*/
private $name;
+ /**
+ * @var string
+ *
+ * @ORM\Column(name="order_number", type="text", length=20, nullable=true)
+ * @Assert\Length(max=20)
+ */
+ private $orderNumber;
+
/**
* @var string
*
@@ -68,7 +76,7 @@ class Project
private $visible = true;
/**
- * @var string
+ * @var float
*
* @ORM\Column(name="budget", type="decimal", precision=10, scale=2, nullable=false)
* @Assert\NotNull()
@@ -114,13 +122,11 @@ class Project
* Set name
*
* @param string $name
- *
* @return Project
*/
public function setName($name)
{
$this->name = $name;
-
return $this;
}
@@ -138,13 +144,11 @@ class Project
* Set comment
*
* @param string $comment
- *
* @return Project
*/
public function setComment($comment)
{
$this->comment = $comment;
-
return $this;
}
@@ -162,13 +166,11 @@ class Project
* Set visible
*
* @param boolean $visible
- *
* @return Project
*/
public function setVisible($visible)
{
$this->visible = $visible;
-
return $this;
}
@@ -185,21 +187,19 @@ class Project
/**
* Set budget
*
- * @param string $budget
- *
+ * @param float $budget
* @return Project
*/
public function setBudget($budget)
{
$this->budget = $budget;
-
return $this;
}
/**
* Get budget
*
- * @return string
+ * @return float
*/
public function getBudget()
{
@@ -208,12 +208,11 @@ class Project
/**
* @param Activity[] $activities
- * @return $this
+ * @return Project
*/
public function setActivities($activities)
{
$this->activities = $activities;
-
return $this;
}
@@ -225,6 +224,24 @@ class Project
return $this->activities;
}
+ /**
+ * @return string
+ */
+ public function getOrderNumber(): ?string
+ {
+ return $this->orderNumber;
+ }
+
+ /**
+ * @param string $orderNumber
+ * @return Project
+ */
+ public function setOrderNumber($orderNumber)
+ {
+ $this->orderNumber = $orderNumber;
+ return $this;
+ }
+
/**
* @return string
*/
diff --git a/src/Form/ProjectEditForm.php b/src/Form/ProjectEditForm.php
index 5fab9de6..d512bf91 100644
--- a/src/Form/ProjectEditForm.php
+++ b/src/Form/ProjectEditForm.php
@@ -45,29 +45,30 @@ class ProjectEditForm extends AbstractType
}
$builder
- // string - length 255
->add('name', TextType::class, [
'label' => 'label.name',
])
- // text
->add('comment', TextareaType::class, [
'label' => 'label.comment',
+ 'required' => false,
+ ])
+ ->add('orderNumber', TextType::class, [
+ 'label' => 'label.order_number',
+ 'required' => false,
])
- // customer
->add('customer', CustomerType::class, [
'label' => 'label.customer',
'query_builder' => function (CustomerRepository $repo) use ($customer) {
return $repo->builderForEntityType($customer);
},
])
- // boolean
->add('visible', VisibilityType::class, [
'label' => 'label.visible',
])
- // string
->add('budget', MoneyType::class, [
'label' => 'label.budget',
- 'currency' => $builder->getOption('currency'),
+ 'currency' => $customer ? $customer->getCurrency() : $builder->getOption('currency'),
+ 'required' => false,
])
;
}
diff --git a/src/Invoice/RandomNumberGenerator.php b/src/Invoice/RandomNumberGenerator.php
deleted file mode 100644
index fb91be08..00000000
--- a/src/Invoice/RandomNumberGenerator.php
+++ /dev/null
@@ -1,43 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace App\Invoice;
-
-use App\Model\InvoiceModel;
-
-/**
- * Class RandomNumberGenerator is meant for testing purpose only.
- *
- * @author Kevin Papst
- {{ 'invoice.due_days'|trans }}: {{ model.dueDate|date(kimai_context.date_1) }}
- {% if model.customer.number is not empty %}{{ 'label.customer_number'|trans }}: {{ model.customer.number }}
{% endif %}
+ {{ 'invoice.due_days'|trans }}: {{ model.dueDate|date(kimai_context.date_1) }}
+ {% if model.customer.number is not empty %}
+
{{ 'label.customer_number'|trans }}: {{ model.customer.number }}
+ {% endif %}
+ {% if model.query.project is not empty and model.query.project.orderNumber is not empty %}
+
{{ 'label.order_number'|trans }}: {{ model.query.project.orderNumber }}
+ {% endif %}