Release 1.6.1 (#1282)
This commit is contained in:
@@ -12,6 +12,7 @@ namespace App\Invoice\Calculator;
|
||||
use App\Entity\Timesheet;
|
||||
use App\Invoice\InvoiceItem;
|
||||
use App\Invoice\InvoiceItemInterface;
|
||||
use App\Invoice\InvoiceItemWithAmountInterface;
|
||||
|
||||
abstract class AbstractMergedCalculator extends AbstractCalculator
|
||||
{
|
||||
@@ -32,7 +33,11 @@ abstract class AbstractMergedCalculator extends AbstractCalculator
|
||||
$duration += $entry->getDuration();
|
||||
}
|
||||
|
||||
$invoiceItem->setAmount($invoiceItem->getAmount() + 1);
|
||||
$amount = 1;
|
||||
if ($entry instanceof InvoiceItemWithAmountInterface) {
|
||||
$amount = $entry->getAmount();
|
||||
}
|
||||
$invoiceItem->setAmount($invoiceItem->getAmount() + $amount);
|
||||
$invoiceItem->setUser($entry->getUser());
|
||||
$invoiceItem->setRate($invoiceItem->getRate() + $entry->getRate());
|
||||
$invoiceItem->setDuration($duration);
|
||||
|
||||
@@ -45,8 +45,8 @@ class ShortInvoiceCalculator extends AbstractMergedCalculator implements Calcula
|
||||
if (count($keys) > 1) {
|
||||
$invoiceItem->setAmount(1);
|
||||
$invoiceItem->setFixedRate($invoiceItem->getRate());
|
||||
$invoiceItem->setHourlyRate($invoiceItem->getRate());
|
||||
}
|
||||
$invoiceItem->setHourlyRate($invoiceItem->getRate());
|
||||
|
||||
return [$invoiceItem];
|
||||
}
|
||||
|
||||
@@ -13,7 +13,10 @@ use App\Entity\Activity;
|
||||
use App\Entity\Project;
|
||||
use App\Entity\User;
|
||||
|
||||
class InvoiceItem
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class InvoiceItem
|
||||
{
|
||||
/**
|
||||
* @var float
|
||||
@@ -28,7 +31,7 @@ class InvoiceItem
|
||||
*/
|
||||
private $rate = 0.00;
|
||||
/**
|
||||
* @var int
|
||||
* @var float
|
||||
*/
|
||||
private $amount = 0;
|
||||
/**
|
||||
@@ -141,12 +144,12 @@ class InvoiceItem
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAmount(): int
|
||||
public function getAmount(): float
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
public function setAmount(int $amount): InvoiceItem
|
||||
public function setAmount(float $amount): InvoiceItem
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
|
||||
15
src/Invoice/InvoiceItemWithAmountInterface.php
Normal file
15
src/Invoice/InvoiceItemWithAmountInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Invoice;
|
||||
|
||||
interface InvoiceItemWithAmountInterface
|
||||
{
|
||||
public function getAmount(): float;
|
||||
}
|
||||
Reference in New Issue
Block a user