Version 2.0.1 (#3853)
* configure email validation mode to fix deprecation message * allow to use non brand icon in saml provider * new method getCalculatedDuration() * getRawData() by id * only stop entries if new one is running * fix validator tampering with timesheet duration * fix allow setting null as customer * bump packages
This commit is contained in:
@@ -322,12 +322,21 @@ class Timesheet implements EntityWithMetaFields, ExportableItem
|
||||
{
|
||||
// only auto calculate if manually set duration is null - the result is important for eg. validations
|
||||
if ($calculate && $this->duration === null && $this->begin !== null && $this->end !== null) {
|
||||
return $this->end->getTimestamp() - $this->begin->getTimestamp();
|
||||
return $this->getCalculatedDuration();
|
||||
}
|
||||
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
public function getCalculatedDuration(): ?int
|
||||
{
|
||||
if ($this->begin !== null && $this->end !== null) {
|
||||
return $this->end->getTimestamp() - $this->begin->getTimestamp();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @return Timesheet
|
||||
|
||||
Reference in New Issue
Block a user