allow custom export repositories (#2182)

This commit is contained in:
Kevin Papst
2020-12-10 15:00:14 +01:00
committed by GitHub
parent c3fe8d1c39
commit 7a3388646b
18 changed files with 320 additions and 72 deletions

View File

@@ -41,7 +41,9 @@
{{ form_row(form.projects) }}
{{ form_row(form.activities) }}
{{ form_row(form.tags) }}
{{ form_row(form.users) }}
{% if form.users is defined %}
{{ form_row(form.users) }}
{% endif %}
{{ form_row(form.exported) }}
{{ form_row(form.state) }}
{{ form_row(form.markAsExported) }}
@@ -289,13 +291,13 @@
});
$('body').on('click', '#export-buttons .startExportBtn', function() {
$('#type').val($(this).attr('data-type'));
$('#renderer').val($(this).attr('data-type'));
var $form = $("#export-form");
var prevAction = $form.attr('action');
var prevMethod = $form.attr('method');
$form.attr('target', '_blank').attr('method', 'POST').attr('action', '{{ path('export_data') }}');
$form.submit();
$('#type').val('');
$('#renderer').val('');
$form.removeAttr('target').attr('action', prevAction).attr('method', prevMethod);
});
});

View File

@@ -1,13 +1,13 @@
{% set showUserColumn = showUserColumn ?? true %}
{% set showInternalRate = showInternalRate ?? false %}
{% set showRateColumn = showRateColumn ?? true %}
{% set showRateColumn = showRateColumn ?? is_granted('view_rate_other_timesheet') %}
{% set showRateBudget = showRateBudget ?? false %}
{% set showTimeBudget = showTimeBudget ?? false %}
{% set decimal = decimal ?? false %}
{% if query.user %}
{# this is only triggered, if a user exports from his personal timesheet screen #}
{# this is only triggered, if a user exports from his personal timesheet screen #}
{% if query.user is not null %}
{% set showUserColumn = false %}
{# if exporting via the admin screen, users without view_rate_own_timesheet might still see their own rates - maybe merge view_rate_own_timesheet and view_rate_other_timesheet into a new view_rate permission? #}
{# if exporting via the admin screen, users without view_rate_own_timesheet might still see their own rates #}
{% set showRateColumn = is_granted('view_rate_own_timesheet') %}
{% endif %}
<html lang="{{ app.request.locale }}">
@@ -268,15 +268,12 @@ mpdf-->
</td>
<td class="duration">{{ entry.duration|duration(decimal) }}</td>
{% if showRateColumn %}
{% if is_granted('view_rate', entry) %}
{% set rate = rate + entry.rate %}
{% set rateInternal = rateInternal + entry.internalRate %}
{% set entryRate = entry.rate|money(entry.project.customer.currency) %}
{% set entryRateInternal = entry.internalRate|money(entry.project.customer.currency) %}
{% else %}
{% set entryRate = '&ndash;' %}
{% set entryRateInternal = '&ndash;' %}
{% endif %}
{# no check for is_granted('view_rate', entry) because it is only available for timesheets,
but maybe missing for other potential export repositories #}
{% set rate = rate + entry.rate %}
{% set rateInternal = rateInternal + entry.internalRate %}
{% set entryRate = entry.rate|money(entry.project.customer.currency) %}
{% set entryRateInternal = entry.internalRate|money(entry.project.customer.currency) %}
{% if showInternalRate %}
<td class="cost">{{ entryRateInternal }}</td>
{% endif %}

View File

@@ -451,7 +451,7 @@
{% endif %}
</td>
<td class="column-tags" {% if not columns.tags %}style="display: none"{% endif %}>
{% if entry.tags is not empty %}
{% if entry.tags is defined and entry.tags is not empty %}
{{ entry.tagsAsArray|join(', ') }}
{% endif %}
</td>