Skip to content

Commit

Permalink
fixed: field value can be of type string
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Mar 9, 2023
1 parent 155e086 commit 6c9ba90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Version 2.0.1

Compatibility: requires minimum Kimai 2.0

- Fixed: field value can be of type string

## Version 2.0

Compatibility: requires minimum Kimai 2.0
Expand Down
12 changes: 5 additions & 7 deletions Timesheet/Calculator/DeductionTimeCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ public function calculate(Timesheet $record, array $changeset): void

$meta = $record->getActivity()->getMetaField(DeductionTimeBundle::META_FIELD_DEDUCTION)?->getValue();

if (!\is_bool($meta) || $meta === false) {
return;
}

$duration = $record->getDuration(false);
if ($duration > 0) {
$record->setDuration($duration * -1);
if ($meta === true || $meta === '1') {
$duration = $record->getDuration(false);
if ($duration > 0) {
$record->setDuration($duration * -1);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Configure certain activities as deduction time, resulting in negative durations for timesheets.",
"homepage": "https://www.kimai.org/store/keleo-deduction-time-bundle.html",
"type": "kimai-plugin",
"version": "2.0",
"version": "2.0.1",
"keywords": [
"kimai",
"kimai-plugin"
Expand Down

0 comments on commit 6c9ba90

Please sign in to comment.