diff --git a/src/DataFixtures/TimesheetFixtures.php b/src/DataFixtures/TimesheetFixtures.php
index 3d66ed53..627bee7f 100644
--- a/src/DataFixtures/TimesheetFixtures.php
+++ b/src/DataFixtures/TimesheetFixtures.php
@@ -35,7 +35,7 @@ class TimesheetFixtures extends Fixture implements DependentFixtureInterface
public const MIN_TIMESHEETS_PER_USER = 50;
public const MAX_TIMESHEETS_PER_USER = 500;
public const MAX_TIMESHEETS_TOTAL = 5000;
- public const MAX_RUNNING_TIMESHEETS_PER_USER = 2;
+ public const MAX_RUNNING_TIMESHEETS_PER_USER = 1;
public const TIMERANGE_DAYS = 1095; // 3 years
public const TIMERANGE_RUNNING = 1047; // in minutes = 17:45 hours
public const MIN_MINUTES_PER_ENTRY = 15;
diff --git a/src/EventSubscriber/UserPreferenceSubscriber.php b/src/EventSubscriber/UserPreferenceSubscriber.php
index fea3d6bc..320a4be6 100644
--- a/src/EventSubscriber/UserPreferenceSubscriber.php
+++ b/src/EventSubscriber/UserPreferenceSubscriber.php
@@ -158,6 +158,12 @@ class UserPreferenceSubscriber implements EventSubscriberInterface
->setValue(false)
->setOrder(800)
->setType(CheckboxType::class),
+
+ (new UserPreference())
+ ->setName('timesheet.export_decimal')
+ ->setValue(false)
+ ->setOrder(900)
+ ->setType(CheckboxType::class),
];
}
diff --git a/src/Export/Base/HtmlRenderer.php b/src/Export/Base/HtmlRenderer.php
index 9cc646d5..0d0b7b0b 100644
--- a/src/Export/Base/HtmlRenderer.php
+++ b/src/Export/Base/HtmlRenderer.php
@@ -53,6 +53,18 @@ class HtmlRenderer
return $event->getFields();
}
+ protected function getOptions(TimesheetQuery $query): array
+ {
+ $decimal = false;
+ if (null !== $query->getCurrentUser()) {
+ $decimal = (bool) $query->getCurrentUser()->getPreferenceValue('timesheet.export_decimal', $decimal);
+ } elseif (null !== $query->getUser()) {
+ $decimal = (bool) $query->getUser()->getPreferenceValue('timesheet.export_decimal', $decimal);
+ }
+
+ return ['decimal' => $decimal];
+ }
+
/**
* @param ExportItemInterface[] $timesheets
* @param TimesheetQuery $query
@@ -75,7 +87,7 @@ class HtmlRenderer
$this->dispatcher->dispatch($event);
$userPreferences = $event->getPreferences();
- $content = $this->twig->render('export/renderer/default.html.twig', [
+ $content = $this->twig->render('export/renderer/default.html.twig', array_merge([
'entries' => $timesheets,
'query' => $query,
'summaries' => $this->calculateSummary($timesheets),
@@ -84,7 +96,7 @@ class HtmlRenderer
'projectMetaFields' => $projectMetaFields,
'activityMetaFields' => $activityMetaFields,
'userPreferences' => $userPreferences,
- ]);
+ ], $this->getOptions($query)));
$response = new Response();
$response->setContent($content);
diff --git a/src/Export/Base/PDFRenderer.php b/src/Export/Base/PDFRenderer.php
index 49af2bbb..a87efc4e 100644
--- a/src/Export/Base/PDFRenderer.php
+++ b/src/Export/Base/PDFRenderer.php
@@ -46,6 +46,18 @@ class PDFRenderer
return 'export/renderer/pdf.html.twig';
}
+ protected function getOptions(TimesheetQuery $query): array
+ {
+ $decimal = false;
+ if (null !== $query->getCurrentUser()) {
+ $decimal = (bool) $query->getCurrentUser()->getPreferenceValue('timesheet.export_decimal', $decimal);
+ } elseif (null !== $query->getUser()) {
+ $decimal = (bool) $query->getUser()->getPreferenceValue('timesheet.export_decimal', $decimal);
+ }
+
+ return ['decimal' => $decimal];
+ }
+
/**
* @param ExportItemInterface[] $timesheets
* @param TimesheetQuery $query
@@ -56,12 +68,13 @@ class PDFRenderer
*/
public function render(array $timesheets, TimesheetQuery $query): Response
{
- $content = $this->twig->render($this->getTemplate(), [
+ $content = $this->twig->render($this->getTemplate(), array_merge([
'entries' => $timesheets,
'query' => $query,
'now' => $this->dateTime->createDateTime(),
'summaries' => $this->calculateSummary($timesheets),
- ]);
+ 'decimal' => false,
+ ], $this->getOptions($query)));
$content = $this->converter->convertToPdf($content);
diff --git a/src/Export/Timesheet/HtmlRenderer.php b/src/Export/Timesheet/HtmlRenderer.php
index e74dd6e8..c5bf9579 100644
--- a/src/Export/Timesheet/HtmlRenderer.php
+++ b/src/Export/Timesheet/HtmlRenderer.php
@@ -34,6 +34,18 @@ final class HtmlRenderer implements TimesheetExportInterface
$this->dispatcher = $dispatcher;
}
+ private function getOptions(TimesheetQuery $query): array
+ {
+ $decimal = false;
+ if (null !== $query->getCurrentUser()) {
+ $decimal = (bool) $query->getCurrentUser()->getPreferenceValue('timesheet.export_decimal', $decimal);
+ } elseif (null !== $query->getUser()) {
+ $decimal = (bool) $query->getUser()->getPreferenceValue('timesheet.export_decimal', $decimal);
+ }
+
+ return ['decimal' => $decimal];
+ }
+
/**
* @param Timesheet[] $timesheets
* @param TimesheetQuery $query
@@ -53,11 +65,12 @@ final class HtmlRenderer implements TimesheetExportInterface
$this->dispatcher->dispatch($event);
$timesheetMetaFields = $event->getFields();
- $content = $this->twig->render('timesheet/export.html.twig', [
+ $content = $this->twig->render('timesheet/export.html.twig', array_merge([
'entries' => $timesheets,
'query' => $query,
'metaColumns' => $timesheetMetaFields,
- ]);
+ 'decimal' => false,
+ ], $this->getOptions($query)));
$response = new Response();
$response->setContent($content);
diff --git a/templates/export/renderer/default.html.twig b/templates/export/renderer/default.html.twig
index e0eb5161..2125ce4c 100644
--- a/templates/export/renderer/default.html.twig
+++ b/templates/export/renderer/default.html.twig
@@ -2,6 +2,7 @@
{% import "macros/datatables.html.twig" as tables %}
{% extends 'export/layout.html.twig' %}
+{% set decimal = decimal|default(false) %}
{% set columnTitles = {} %}
{% set columns = {
'date': true,
@@ -201,7 +202,7 @@
{% if customer is not same as(summary.customer) %}
- {{ customerDuration|duration }}
+ {{ customerDuration|duration(decimal) }}
{{ customerRate|money(customerCurrency) }}
{% set customerCurrency = summary.currency %}
@@ -212,7 +213,7 @@
{{ summary.customer }}
{{ summary.project }}
- {{ summary.duration|duration }}
+ {{ summary.duration|duration(decimal) }}
{{ summary.rate|money(summary.currency) }}
{% set customerDuration = customerDuration + summary.duration %}
@@ -221,7 +222,7 @@
{% if customer is not same as(null) %}
- {{ customerDuration|duration }}
+ {{ customerDuration|duration(decimal) }}
{{ customerRate|money(customerCurrency) }}
{% endif %}
@@ -251,7 +252,7 @@
{% if customer is not same as(summary.customer) %}
- {{ customerDuration|duration }}
+ {{ customerDuration|duration(decimal) }}
{{ customerRate|money(customerCurrency) }}
{% set customerCurrency = summary.currency %}
@@ -264,7 +265,7 @@
{{ summary.customer }}
{{ summary.project }}
{{ activitySummary.activity }}
- {{ activitySummary.duration|duration }}
+ {{ activitySummary.duration|duration(decimal) }}
{{ activitySummary.rate|money(activitySummary.currency) }}
{% endfor %}
@@ -274,7 +275,7 @@
{% if customer is not same as(null) %}
- {{ customerDuration|duration }}
+ {{ customerDuration|duration(decimal) }}
{{ customerRate|money(customerCurrency) }}
{% endif %}
@@ -384,7 +385,7 @@
{{ entry.fixedRate|money(entry.project.customer.currency) }}
- {{ entry.duration|duration }}
+ {{ entry.duration|duration(decimal) }}
{{ entry.rate|money(entry.project.customer.currency) }}
@@ -399,7 +400,7 @@
{% endif %}
{% endfor %}
- {{- timeWorked|duration -}}
+ {{- timeWorked|duration(decimal) -}}
{%- if currency is not null and currency is not same as(false) %}
diff --git a/templates/export/renderer/pdf.html.twig b/templates/export/renderer/pdf.html.twig
index b19ca999..89be4501 100644
--- a/templates/export/renderer/pdf.html.twig
+++ b/templates/export/renderer/pdf.html.twig
@@ -1,5 +1,6 @@
{% set showUserColumn = true %}
{% set showRateColumn = true %}
+{% set decimal = decimal|default(false) %}
{% if query.user %}
{# this is only triggered, if a user exports from his personal timesheet screen#}
{% set showUserColumn = false %}
@@ -106,7 +107,7 @@ mpdf-->
{% if customer is not same as(summary.customer) %}
- {{ customerDuration|duration }}
+ {{ customerDuration|duration(decimal) }}
{% if showRateColumn %}
{{ customerRate|money(customerCurrency) }}
{% endif %}
@@ -120,7 +121,7 @@ mpdf-->
{{ summary.customer }}
{{ summary.project }}
- {{ summary.duration|duration }}
+ {{ summary.duration|duration(decimal) }}
{% if showRateColumn %}
{{ summary.rate|money(summary.currency) }}
{% endif %}
@@ -132,7 +133,7 @@ mpdf-->
{% if customer is not same as(null) %}
- {{ customerDuration|duration }}
+ {{ customerDuration|duration(decimal) }}
{% if showRateColumn %}
{{ customerRate|money(customerCurrency) }}
{% endif %}
@@ -189,7 +190,7 @@ mpdf-->
{{ entry.description|escape|desc2html }}
{% endif %}
- {{ entry.duration|duration }}
+ {{ entry.duration|duration(decimal) }}
{% if showRateColumn %}
{% if is_granted('view_rate', entry) %}
@@ -208,7 +209,7 @@ mpdf-->
{% else %}
{% endif %}
- {{ duration|duration }}
+ {{ duration|duration(decimal) }}
{% if showRateColumn %}
{% if currency is not null %}{{ rate|money(currency) }}{% endif %}
{% endif %}
diff --git a/templates/timesheet-team/actions.html.twig b/templates/timesheet-team/actions.html.twig
index e6e78fb9..1ddda23a 100644
--- a/templates/timesheet-team/actions.html.twig
+++ b/templates/timesheet-team/actions.html.twig
@@ -38,6 +38,10 @@
{% set actions = actions|merge({'repeat': {'url': path('restart_timesheet', {'id' : timesheet.id}), 'class': 'api-link', 'attr': {'data-payload': '{"copy": "all"}', 'data-event': 'kimai.timesheetStart kimai.timesheetUpdate', 'data-method': 'PATCH', 'data-msg-error': 'timesheet.start.error', 'data-msg-success': 'timesheet.start.success'}}}) %}
{% endif %}
+ {% if is_granted('duplicate', timesheet) %}
+ {% set actions = actions|merge({'copy': {'url': path('duplicate_timesheet', {'id' : timesheet.id}), 'class': 'api-link', 'attr': {'data-payload': '{"copy": "all"}', 'data-event': 'kimai.timesheetStart kimai.timesheetUpdate', 'data-method': 'PATCH', 'data-msg-error': 'action.update.error', 'data-msg-success': 'action.update.success'}}}) %}
+ {% endif %}
+
{% if is_granted('edit', timesheet) %}
{% set class = '' %}
{% if view != 'edit' %}
diff --git a/templates/timesheet/actions.html.twig b/templates/timesheet/actions.html.twig
index c258a5c2..c40bb0c5 100644
--- a/templates/timesheet/actions.html.twig
+++ b/templates/timesheet/actions.html.twig
@@ -40,7 +40,7 @@
{% endif %}
{% if is_granted('duplicate', timesheet) %}
- {% set actions = actions|merge({'copy': {'url': path('duplicate_timesheet', {'id' : timesheet.id}), 'class': 'api-link', 'attr': {'data-payload': '{"copy": "all"}', 'data-event': 'kimai.timesheetStart kimai.timesheetUpdate', 'data-method': 'PATCH', 'data-msg-error': 'timesheet.update.error', 'data-msg-success': 'timesheet.update.success'}}}) %}
+ {% set actions = actions|merge({'copy': {'url': path('duplicate_timesheet', {'id' : timesheet.id}), 'class': 'api-link', 'attr': {'data-payload': '{"copy": "all"}', 'data-event': 'kimai.timesheetStart kimai.timesheetUpdate', 'data-method': 'PATCH', 'data-msg-error': 'action.update.error', 'data-msg-success': 'action.update.success'}}}) %}
{% endif %}
{% if is_granted('edit', timesheet) %}
diff --git a/templates/timesheet/export.html.twig b/templates/timesheet/export.html.twig
index 35319b96..80c444a9 100644
--- a/templates/timesheet/export.html.twig
+++ b/templates/timesheet/export.html.twig
@@ -4,6 +4,7 @@
{% block title %}{{ 'menu.export'|trans }}{% endblock %}
{% block invoice %}
+ {% set decimal = decimal|default(false) %}
{% set showUserColumn = true %}
{% if query.user %}
{% set showUserColumn = false %}
@@ -72,7 +73,7 @@
{% for field in metaColumns %}
{{ tables.datatable_meta_column(entry, field) }}
{% endfor %}
- {{ entry.duration|duration }}
+ {{ entry.duration|duration(decimal) }}
{% endfor %}
@@ -86,7 +87,7 @@
{% endfor %}
{{ 'invoice.total_working_time'|trans }}
- {{ timeWorked|duration }}
+ {{ timeWorked|duration(decimal) }}
diff --git a/templates/user/layout.html.twig b/templates/user/layout.html.twig
index 65f9a6e6..20e7a5a2 100644
--- a/templates/user/layout.html.twig
+++ b/templates/user/layout.html.twig
@@ -1,8 +1,8 @@
{% extends 'base.html.twig' %}
{% import "user/actions.html.twig" as actions %}
-{% block page_title %}{{ 'profile.title'|trans }}{% endblock %}
-{% block page_subtitle %}{% if not user.alias is empty %}{{ user.alias }} - {% endif %}{{ user.username }}{% endblock %}
+{% block page_title %}{% if not user.alias is empty %}{{ user.alias }}{% else %}{{ user.username }}{% endif %}{% endblock %}
+{% block page_subtitle %}{% if not user.alias is empty %}{{ user.username }}{% endif %}{% endblock %}
{% block page_actions %}{{ actions.user(user, tab) }}{% endblock %}
{% block main %}
diff --git a/translations/messages.de.xlf b/translations/messages.de.xlf
index cb53eadb..252fa376 100644
--- a/translations/messages.de.xlf
+++ b/translations/messages.de.xlf
@@ -505,6 +505,10 @@
label.timesheet.daily_stats
Tägliche Statistiken im Timesheet anzeigen
+
+ label.timesheet.export_decimal
+ Dezimal Format für Export nutzen
+