From 183e361bc81e8129c27a3ed9554c2a2c8ee7ddf7 Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Wed, 9 Dec 2020 17:56:45 +0100 Subject: [PATCH] reset internal rate upon saving (#2) --- CHANGELOG.md | 5 +++-- Timesheet/Calculator/RecalculateRateCalculator.php | 4 ++++ composer.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45a605d..d6410c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # Changelog -## 0.2 (unreleased) +## 0.2 - Added GitHub actions for basic CI - Code Styles +- Reset "internal rates" in newer Kimai versions -Compatible with Kimai 0.9 +Compatible with Kimai > 1.9 ## 0.1 diff --git a/Timesheet/Calculator/RecalculateRateCalculator.php b/Timesheet/Calculator/RecalculateRateCalculator.php index 6750f0e..53f43bb 100644 --- a/Timesheet/Calculator/RecalculateRateCalculator.php +++ b/Timesheet/Calculator/RecalculateRateCalculator.php @@ -37,6 +37,10 @@ public function calculate(Timesheet $record) $record->setFixedRate(null); } + if (null !== $record->getInternalRate()) { + $record->setInternalRate(null); + } + // we have to trigger it again, as there is no order defined for the calculator $this->calculator->calculate($record); } diff --git a/composer.json b/composer.json index 8f66daf..dfab4fa 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.15", - "kevinpapst/kimai2": "1.11", + "kevinpapst/kimai2": ">1.9", "phpstan/phpstan": "^0.12", "phpstan/phpstan-symfony": "^0.12", "symfony/console": "^4.0",