From 239be527b8ef55619f4ee57ff2a817ca5e285461 Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Fri, 22 Feb 2019 17:20:41 +0100 Subject: [PATCH] post release fixes (#584) --- LICENSE | 2 +- src/Constants.php | 2 +- src/Controller/InvoiceController.php | 1 - src/Form/TimesheetEditForm.php | 2 +- src/Voter/TimesheetVoter.php | 13 +++++++++++-- templates/invoice/index.html.twig | 2 +- templates/user/profile.html.twig | 2 +- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/LICENSE b/LICENSE index da5082c1..312dbe21 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2018 Kevin Papst +Copyright (c) 2017-2019 Kevin Papst @ https://www.kevinpapst.de Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Constants.php b/src/Constants.php index 42ac89d3..00df31c9 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -37,5 +37,5 @@ class Constants /** * Used in multiple views */ - public const HOMEPAGE = 'https://v2.kimai.org'; + public const HOMEPAGE = 'https://www.kimai.org'; } diff --git a/src/Controller/InvoiceController.php b/src/Controller/InvoiceController.php index 361fd4f7..d42fae5f 100644 --- a/src/Controller/InvoiceController.php +++ b/src/Controller/InvoiceController.php @@ -70,7 +70,6 @@ class InvoiceController extends AbstractController $query->setOrder(InvoiceQuery::ORDER_ASC); $query->setBegin($begin); $query->setEnd($end); - $query->setUser($this->getUser()); $query->setState(InvoiceQuery::STATE_STOPPED); return $query; diff --git a/src/Form/TimesheetEditForm.php b/src/Form/TimesheetEditForm.php index 38abe7de..7c1a30ab 100644 --- a/src/Form/TimesheetEditForm.php +++ b/src/Form/TimesheetEditForm.php @@ -120,7 +120,7 @@ class TimesheetEditForm extends AbstractType ]); } else { $builder->add('end', DateTimePickerType::class, [ - 'label' => 'label.begin', + 'label' => 'label.end', 'model_timezone' => $timezone, 'view_timezone' => $timezone, 'required' => false, diff --git a/src/Voter/TimesheetVoter.php b/src/Voter/TimesheetVoter.php index 69be44b8..1eb411af 100644 --- a/src/Voter/TimesheetVoter.php +++ b/src/Voter/TimesheetVoter.php @@ -119,8 +119,17 @@ class TimesheetVoter extends AbstractVoter */ protected function canStart(Timesheet $timesheet, User $user, TokenInterface $token) { - // we could check the amount of active entries - // if a teamlead starts an entry for another user, check that this user is part of his team + // possible improvements for the future: + // we could check the amount of active entries (maybe slow) + // if a teamlead starts an entry for another user, check that this user is part of his team (needs to be done for teams) + + if (null === $timesheet->getActivity()) { + return false; + } + + if (null === $timesheet->getProject()) { + return false; + } if (!$timesheet->getActivity()->getVisible() || !$timesheet->getProject()->getVisible()) { return false; diff --git a/templates/invoice/index.html.twig b/templates/invoice/index.html.twig index e59d953c..cb99583e 100644 --- a/templates/invoice/index.html.twig +++ b/templates/invoice/index.html.twig @@ -60,7 +60,7 @@ {% endif %} {{ entry.begin|date_short }} - {{ widgets.username(entry.user) }} + {{ widgets.label_user(entry.user) }} {% if entry.description is not empty %} {{ entry.description|desc2html }} diff --git a/templates/user/profile.html.twig b/templates/user/profile.html.twig index 209a8e27..d4997f37 100644 --- a/templates/user/profile.html.twig +++ b/templates/user/profile.html.twig @@ -131,7 +131,7 @@ {# colors = purple, blue, aqua, red, green #}
  • {{ 'label.id'|trans }} {{ user.id }}
  • {{ 'label.username'|trans }} {{ user.username }}
  • -
  • {{ 'profile.first_entry'|trans }} {{ stats.firstEntry|date }}
  • +
  • {{ 'profile.first_entry'|trans }} {{ stats.firstEntry|date_short }}
  • {% if is_granted('view_rate_own_timesheet') %}
  • {{ 'label.hourly_rate'|trans }} {{ user.preferenceValue('hourly_rate') }}
  • {% endif %}