diff --git a/config/packages/avanzu_admin_theme.yml b/config/packages/avanzu_admin_theme.yml index 74f19c78..fe9d8b07 100644 --- a/config/packages/avanzu_admin_theme.yml +++ b/config/packages/avanzu_admin_theme.yml @@ -1,6 +1,6 @@ avanzu_admin_theme: use_twig: true - use_assetic: true + use_assetic: false bower_bin: "/usr/local/bin/bower" options: default_avatar: build/images/default_avatar.png diff --git a/config/packages/kimai.yaml b/config/packages/kimai.yaml index 633be1e1..acf09a38 100644 --- a/config/packages/kimai.yaml +++ b/config/packages/kimai.yaml @@ -3,7 +3,7 @@ kimai: timesheet: # Whether we display start and end time columns (false) or durations only (true). - # Setting this to true will also change the "edit timesheet" forms, more infos available in the confiugrations docu. + # Setting this to true will also change the "edit timesheet" forms, more infos available in the configurations docu. duration_only: false # Rounding rules are used to round the begin & end dates and the duration for timesheet records. diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php index b51dd300..1c3f79e6 100644 --- a/src/DataFixtures/AppFixtures.php +++ b/src/DataFixtures/AppFixtures.php @@ -116,7 +116,7 @@ class AppFixtures extends Fixture // no alias to test twig username macro [ null, 'Super Administrator', self::USERNAME_SUPER_ADMIN, 'susan_super@example.com', 'ROLE_SUPER_ADMIN', - '/bundles/avanzuadmintheme/img/avatar.png', true + '/build/images/default_avatar.png', true ] ]; } diff --git a/src/DependencyInjection/Compiler/DoctrineCompilerPass.php b/src/DependencyInjection/Compiler/DoctrineCompilerPass.php index 8b76e0f1..35b0c336 100644 --- a/src/DependencyInjection/Compiler/DoctrineCompilerPass.php +++ b/src/DependencyInjection/Compiler/DoctrineCompilerPass.php @@ -11,7 +11,6 @@ namespace App\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\Yaml\Yaml; /** @@ -60,7 +59,7 @@ class DoctrineCompilerPass implements CompilerPassInterface if ($engine === null) { throw new \Exception( 'Could not detect database engine. Please set the environment config DATABASE_ENGINE ' . - 'to one ' . implode(', ', $this->allowedEngines) . ', e.g. in your .env file: DATABASE_ENGINE=sqlite' + 'to one of: "' . implode(', ', $this->allowedEngines) . '" in your .env file: DATABASE_ENGINE=sqlite' ); } diff --git a/src/Entity/Timesheet.php b/src/Entity/Timesheet.php index aa57b095..5d5e29a3 100644 --- a/src/Entity/Timesheet.php +++ b/src/Entity/Timesheet.php @@ -156,20 +156,12 @@ class Timesheet /** * Get duration + * Do not rely on the results of this method for active records. * * @return integer */ public function getDuration() { - if ($this->begin === null) { - return 0; - } - - if ($this->end === null) { - $current = new \DateTime(); - return $current->getTimestamp() - $this->begin->getTimestamp(); - } - return $this->duration; } diff --git a/src/Twig/Extensions.php b/src/Twig/Extensions.php index c7a42b8d..874394e5 100644 --- a/src/Twig/Extensions.php +++ b/src/Twig/Extensions.php @@ -46,7 +46,6 @@ class Extensions extends \Twig_Extension { return [ new TwigFilter('duration', [$this, 'duration']), - new TwigFilter('durationForEntry', [$this, 'durationForEntry']), new TwigFilter('money', [$this, 'money']), new TwigFilter('currency', [$this, 'currency']), new TwigFilter('country', [$this, 'country']), @@ -63,27 +62,22 @@ class Extensions extends \Twig_Extension ]; } - /** - * Returns the formatted duration for a Timesheet entry. - * - * @param Timesheet $entry - * @param bool $includeSeconds - * @return string - */ - public function durationForEntry(Timesheet $entry, $includeSeconds = false) - { - return $this->duration($entry->getDuration(), $includeSeconds); - } - /** * Transforms seconds into a duration string. * - * @param $seconds + * @param int|Timesheet $duration * @param bool $includeSeconds * @return string */ - public function duration($seconds, $includeSeconds = false) + public function duration($duration, $includeSeconds = false) { + $seconds = $duration; + if ($duration instanceof Timesheet) { + $seconds = $duration->getDuration(); + if ($duration->getEnd() === null) { + $seconds = time() - $duration->getBegin()->getTimestamp(); + } + } return $this->durationFormatter->format($seconds, $includeSeconds) . ' h'; } diff --git a/templates/admin/timesheet.html.twig b/templates/admin/timesheet.html.twig index 54bdd0f9..f1800e14 100644 --- a/templates/admin/timesheet.html.twig +++ b/templates/admin/timesheet.html.twig @@ -45,7 +45,7 @@ {% if not duration_only %}
{{ entry.activity.project.name }} ({{ entry.activity.project.customer.name }})
diff --git a/templates/timesheet/index.html.twig b/templates/timesheet/index.html.twig index 7a285b92..3f129623 100644 --- a/templates/timesheet/index.html.twig +++ b/templates/timesheet/index.html.twig @@ -45,7 +45,7 @@ {% if not duration_only %}