code improvements (#1423)

* removed unused mapping information
* added support for further field types
* fixed changing date objects for begin and end
* added more project fields as invoice variables
* theme update and asset rebuild
This commit is contained in:
Kevin Papst
2020-01-31 17:07:14 +01:00
committed by GitHub
parent 9e2fccb105
commit 3ff46e06c0
53 changed files with 1964 additions and 1634 deletions

View File

@@ -36,7 +36,9 @@ final class CeilRounding implements RoundingInterface
return;
}
$record->getBegin()->setTimestamp($timestamp - $diff + $seconds);
$newBegin = clone $record->getBegin();
$newBegin->setTimestamp($timestamp - $diff + $seconds);
$record->setBegin($newBegin);
}
/**
@@ -57,7 +59,9 @@ final class CeilRounding implements RoundingInterface
return;
}
$record->getEnd()->setTimestamp($timestamp - $diff + $seconds);
$newEnd = clone $record->getEnd();
$newEnd->setTimestamp($timestamp - $diff + $seconds);
$record->setEnd($newEnd);
}
/**

View File

@@ -36,11 +36,13 @@ final class ClosestRounding implements RoundingInterface
return;
}
$newBegin = clone $record->getBegin();
if ($diff > ($seconds / 2)) {
$record->getBegin()->setTimestamp($timestamp - $diff + $seconds);
$newBegin->setTimestamp($timestamp - $diff + $seconds);
} else {
$record->getBegin()->setTimestamp($timestamp - $diff);
$newBegin->setTimestamp($timestamp - $diff);
}
$record->setBegin($newBegin);
}
/**
@@ -61,11 +63,13 @@ final class ClosestRounding implements RoundingInterface
return;
}
$newEnd = clone $record->getEnd();
if ($diff > ($seconds / 2)) {
$record->getEnd()->setTimestamp($timestamp - $diff + $seconds);
$newEnd->setTimestamp($timestamp - $diff + $seconds);
} else {
$record->getEnd()->setTimestamp($timestamp - $diff);
$newEnd->setTimestamp($timestamp - $diff);
}
$record->setEnd($newEnd);
}
/**

View File

@@ -36,7 +36,9 @@ final class DefaultRounding implements RoundingInterface
return;
}
$record->getBegin()->setTimestamp($timestamp - $diff);
$newBegin = clone $record->getBegin();
$newBegin->setTimestamp($timestamp - $diff);
$record->setBegin($newBegin);
}
/**
@@ -57,7 +59,9 @@ final class DefaultRounding implements RoundingInterface
return;
}
$record->getEnd()->setTimestamp($timestamp - $diff + $seconds);
$newEnd = clone $record->getEnd();
$newEnd->setTimestamp($timestamp - $diff + $seconds);
$record->setEnd($newEnd);
}
/**

View File

@@ -36,7 +36,9 @@ final class FloorRounding implements RoundingInterface
return;
}
$record->getBegin()->setTimestamp($timestamp - $diff);
$newBegin = clone $record->getBegin();
$newBegin->setTimestamp($timestamp - $diff);
$record->setBegin($newBegin);
}
/**
@@ -57,7 +59,9 @@ final class FloorRounding implements RoundingInterface
return;
}
$record->getEnd()->setTimestamp($timestamp - $diff);
$newEnd = clone $record->getEnd();
$newEnd->setTimestamp($timestamp - $diff);
$record->setEnd($newEnd);
}
/**

View File

@@ -57,7 +57,9 @@ final class DurationFixedBeginMode implements TrackingModeInterface
$timesheet->setBegin($this->dateTime->createDateTime());
}
$timesheet->getBegin()->modify($this->configuration->getDefaultBeginTime());
$newBegin = clone $timesheet->getBegin();
$newBegin->modify($this->configuration->getDefaultBeginTime());
$timesheet->setBegin($newBegin);
}
public function getId(): string

View File

@@ -50,7 +50,9 @@ final class DurationOnlyMode extends AbstractTrackingMode
$timesheet->setBegin($this->dateTime->createDateTime());
}
$timesheet->getBegin()->modify($this->configuration->getDefaultBeginTime());
$newBegin = clone $timesheet->getBegin();
$newBegin->modify($this->configuration->getDefaultBeginTime());
$timesheet->setBegin($newBegin);
parent::create($timesheet, $request);
}