Release 2.6.0 (#4472)
- Added: calendar entry title combination for customer, project and activity - Added: show not_invoiced and not_exported data in detail screens - Added: force logout if user is disabled - Added: reduced amount of database queries on several screens - Fixed: open-close status on work-contract screen for users without configuration - Fixed: failsafe order/orderBy in query if manually manipulated to be null - Fixed: unify statistic calculation (not_invoiced and not_exported) across screens - Tech: bump packages - Tech: Symfony 6.4
This commit is contained in:
@@ -11,42 +11,24 @@ namespace App\Reporting\ProjectView;
|
||||
|
||||
use App\Entity\Project;
|
||||
use App\Model\BudgetStatisticModelInterface;
|
||||
use App\Model\ProjectBudgetStatisticModel;
|
||||
use App\Model\Statistic\BudgetStatistic;
|
||||
use DateTime;
|
||||
|
||||
final class ProjectViewModel
|
||||
{
|
||||
private int $timesheetCounter = 0;
|
||||
private int $durationDay = 0;
|
||||
private int $durationWeek = 0;
|
||||
private int $durationMonth = 0;
|
||||
private int $durationTotal = 0;
|
||||
private float $rateTotal = 0.00;
|
||||
private int $notExportedDuration = 0;
|
||||
private float $notExportedRate = 0.00;
|
||||
private int $notBilledDuration = 0;
|
||||
private float $notBilledRate = 0.00;
|
||||
private int $billableDuration = 0;
|
||||
private float $billableRate = 0.00;
|
||||
private ?DateTime $lastRecord = null;
|
||||
private ?BudgetStatisticModelInterface $budgetStatisticModel = null;
|
||||
|
||||
public function __construct(private Project $project)
|
||||
public function __construct(private ProjectBudgetStatisticModel $budgetStatisticModel)
|
||||
{
|
||||
}
|
||||
|
||||
public function getProject(): Project
|
||||
{
|
||||
return $this->project;
|
||||
}
|
||||
|
||||
public function getTimesheetCounter(): int
|
||||
{
|
||||
return $this->timesheetCounter;
|
||||
}
|
||||
|
||||
public function setTimesheetCounter(int $timesheetCounter): void
|
||||
{
|
||||
$this->timesheetCounter = $timesheetCounter;
|
||||
return $this->budgetStatisticModel->getProject();
|
||||
}
|
||||
|
||||
public function getDurationDay(): int
|
||||
@@ -79,84 +61,47 @@ final class ProjectViewModel
|
||||
$this->durationMonth = $durationMonth;
|
||||
}
|
||||
|
||||
public function getDurationTotal(): int
|
||||
private function getTotals(): BudgetStatistic
|
||||
{
|
||||
return $this->durationTotal;
|
||||
if ($this->budgetStatisticModel->getStatisticTotal() === null) {
|
||||
throw new \InvalidArgumentException('Totals must not be null');
|
||||
}
|
||||
|
||||
return $this->budgetStatisticModel->getStatisticTotal();
|
||||
}
|
||||
|
||||
public function setDurationTotal(int $durationTotal): void
|
||||
public function getDurationTotal(): int
|
||||
{
|
||||
$this->durationTotal = $durationTotal;
|
||||
return $this->getTotals()->getDuration();
|
||||
}
|
||||
|
||||
public function getNotExportedDuration(): int
|
||||
{
|
||||
return $this->notExportedDuration;
|
||||
}
|
||||
$totals = $this->getTotals();
|
||||
|
||||
public function setNotExportedDuration(int $notExportedDuration): void
|
||||
{
|
||||
$this->notExportedDuration = $notExportedDuration;
|
||||
return $totals->getDurationBillable() - $totals->getDurationBillableExported();
|
||||
}
|
||||
|
||||
public function getNotExportedRate(): float
|
||||
{
|
||||
return $this->notExportedRate;
|
||||
}
|
||||
$totals = $this->getTotals();
|
||||
|
||||
public function setNotExportedRate(float $notExportedRate): void
|
||||
{
|
||||
$this->notExportedRate = $notExportedRate;
|
||||
}
|
||||
|
||||
public function getNotBilledDuration(): int
|
||||
{
|
||||
return $this->notBilledDuration;
|
||||
}
|
||||
|
||||
public function setNotBilledDuration(int $notBilledDuration): void
|
||||
{
|
||||
$this->notBilledDuration = $notBilledDuration;
|
||||
}
|
||||
|
||||
public function getNotBilledRate(): float
|
||||
{
|
||||
return $this->notBilledRate;
|
||||
}
|
||||
|
||||
public function setNotBilledRate(float $notBilledRate): void
|
||||
{
|
||||
$this->notBilledRate = $notBilledRate;
|
||||
return $totals->getRateBillable() - $totals->getRateBillableExported();
|
||||
}
|
||||
|
||||
public function getBillableDuration(): int
|
||||
{
|
||||
return $this->billableDuration;
|
||||
}
|
||||
|
||||
public function setBillableDuration(int $billableDuration): void
|
||||
{
|
||||
$this->billableDuration = $billableDuration;
|
||||
return $this->getTotals()->getDurationBillable();
|
||||
}
|
||||
|
||||
public function getBillableRate(): float
|
||||
{
|
||||
return $this->billableRate;
|
||||
}
|
||||
|
||||
public function setBillableRate(float $billableRate): void
|
||||
{
|
||||
$this->billableRate = $billableRate;
|
||||
return $this->getTotals()->getRateBillable();
|
||||
}
|
||||
|
||||
public function getRateTotal(): float
|
||||
{
|
||||
return $this->rateTotal;
|
||||
}
|
||||
|
||||
public function setRateTotal(float $rateTotal): void
|
||||
{
|
||||
$this->rateTotal = $rateTotal;
|
||||
return $this->getTotals()->getRate();
|
||||
}
|
||||
|
||||
public function getLastRecord(): ?DateTime
|
||||
@@ -173,9 +118,4 @@ final class ProjectViewModel
|
||||
{
|
||||
return $this->budgetStatisticModel;
|
||||
}
|
||||
|
||||
public function setBudgetStatisticModel(BudgetStatisticModelInterface $budgetStatisticModel): void
|
||||
{
|
||||
$this->budgetStatisticModel = $budgetStatisticModel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user